#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;

int main()
{
    fast;
    int n, m;
    ll br = 0;
    cin >> n >> m;
    int mat[n + 5][m + 5];
    int r[n + 5][m + 5] = {0};
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < m; j++)
        {
            cin >> mat[i][j];
            br += mat[i][j];
        }
    }
    
    cout << br << "\n";
    return 0;
}