#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include #define rep(i,n) for(int i=0;i<(n);i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define sz(x) ((int)(x).size()) #define pb push_back using ll = long long; using namespace std; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> H >> W >> K; vector> A(H,vector(W,0)); rep(i,K){ int y,x; ll v; cin >> y >> x >> v; y--; x--; A[y][x] = v; } ll ans = 0; rep(y,H){ rep(x,W){ rep(yy,H){ rep(xx,W){ if(yy+xx>=y+x&&yy-xx>=y-x){ ans += A[yy][xx]; ans %= mod; } } } } } cout << ans << endl; return 0; }