#include <iostream>

using namespace std;
int a[1500][1500];
int main()
{
    int n; int m;
    cin >> n >> m;


    int zbir = 0;

    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            cin >> a[i][j];
            zbir = zbir + a[i][j];
        }
    }
    cout << zbir;
}