#include <stdio.h>
#if 0
int main() {
    int a, b;
    while (scanf("%d %d", &a, &b) != EOF) { // 注意 while 处理多个 case
        // 64 位输出请用 printf("%lld") to
        printf("%d\n", a + b);
    }
    return 0;
}
#endif

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
   long sz[a][b];
    int i,j;
    long sum =0;
    for (i=0;i<a;i++){
        for(j=0;j<b;j++)
        {
            scanf("%ld", &sz[i][j]);
            sum += sz[i][j];
        }      

    }

    printf("%ld", sum);

    return 0;
}