#include <iostream>
using namespace std;
#include<vector>
int main() {
   int n,m,i,j,temp;
   long long count = 0;
   cin >> n >> m;
   
   for(i = 0;i<n*m;i++){
     cin >> temp;
     count+=temp;
   }
   
   cout << count <<endl;
   return 0;
}

不用数组的版本