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

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