#include <iostream>
using namespace std;
int main() {
int t,n,m;
long temp,sum;
cin >> t;
for(int i=0;i<t;i++)
{
sum=0;
cin >> n >> m;
for(int j=0;j<n;j++)
{
for(int k=0;k<m;k++)
{
cin >> temp;
sum+=temp;
}
}
cout << (sum) <<endl;
}
}
// 64 位输出请用 printf("%lld")



京公网安备 11010502036488号