#include using namespace std; #define INF 1234567890 #define ll long long #define MOD 998244353 int N, M, K; int A[55][55]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin.exceptions(ios::badbit | ios::failbit); cin >> N >> M >> K; for(int i=0; i> y >> x >> val; A[y][x] = val; } ll res = 0; for(int i=1; i<=N; i++) for(int j=1; j<=M; j++) for(int y=1; y<=N; y++) for(int x=1; x<=M; x++) if (y+x >= i+j && y-x >= i-j) res += A[y][x], res %= MOD; res %= MOD; res += MOD; res %= MOD; cout << res << "\n"; return 0; }