#include <iostream>
using namespace std;
const int N = 4096;
int A[N][N];
int main() {
// traversing a matrix in row major order
for (int r=0; r<N; ++r) for (int c=0; c<N; ++c) A[r][c] = r+c;
long long sum = 0;
for (int loop=0; loop<5; ++loop) {
for (int r=0; r<N; ++r) for (int c=0; c<N; ++c) sum += A[r][c];
}
cout << sum << endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE4gPSA0MDk2OwppbnQgQVtOXVtOXTsKCmludCBtYWluKCkgewoJLy8gdHJhdmVyc2luZyBhIG1hdHJpeCBpbiByb3cgbWFqb3Igb3JkZXIKCWZvciAoaW50IHI9MDsgcjxOOyArK3IpIGZvciAoaW50IGM9MDsgYzxOOyArK2MpIEFbcl1bY10gPSByK2M7Cglsb25nIGxvbmcgc3VtID0gMDsKCWZvciAoaW50IGxvb3A9MDsgbG9vcDw1OyArK2xvb3ApIHsKCQlmb3IgKGludCByPTA7IHI8TjsgKytyKSBmb3IgKGludCBjPTA7IGM8TjsgKytjKSBzdW0gKz0gQVtyXVtjXTsKCX0KCWNvdXQgPDwgc3VtIDw8IGVuZGw7Cn0=