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