#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; const ll modc = 998244353; int main(){ ll H, W, K, ans=0, x, y, w; cin >> H >> W >> K; vector> c(H+1, vector(W+1)); for (int i=0; i> x >> y >> w; c[x][y] = w; } for (int i=1; i<=H; i++){ for (int j=1; j<=W; j++){ for (int x=1; x<=H; x++){ for (int y=1; y<=W; y++){ if (x+y>=i+j && x-y>=i-j){ ans += c[x][y]; ans %= modc; } } } } } cout << ans << endl; return 0; }