import java.util.*; import java.io.*; import java.math.*; import java.util.regex.Pattern; class Main{ static void solve(){ int h = ni(), w = ni(), k = ni(); long [][] value = new long[h][w]; while(k-->0) { int x = ni(), y = ni(); long v = nl(); x--;y--; value[x][y] = v; } long answer = 0; for(int i=0;i= i + j && x - y >= i - j) { answer += (value[x][y] % MOD); } } } } } output.println(answer); } /* 関数 */ /* 定数 */ static PrintWriter output; static Scanner sc; static int Inf = 1010101010; static long Lnf = (long)1e18; static final long mod = 1000000007; static final long MOD = 998244353 ; /* 長いやつ */ static String cut(String S , int start, int end) { return S.substring(start,end);} static char cut(String S , int start) { return S.charAt(start);} static String tos(int val) { return Integer.toString(val);} static String tos(long val) { return Long.toString(val);} static int toi(String S) { return Integer.parseInt(S);} static long tol(String S) { return Long.parseLong(S);} /* 実装が面倒なやつ */ public static long factorial(long n){ return n <= 0 ? 1 : n * factorial(n-1); } public static int digits(long n) { return String.valueOf(n).length(); } static boolean kaibun(String S) { StringBuilder s = new StringBuilder(); s.append(S); return s.reverse().toString().equals(S); } static boolean isNumber(String value) { boolean result = false; if (value != null) { Pattern pattern = Pattern.compile("^[0-9]+$|-[0-9]+$"); result = pattern.matcher(value).matches(); } return result; } static Map counter(int [] A) { HashMap count = new HashMap<>(); for(int i=0;i counter(long [] A) { HashMap count = new HashMap<>(); for(int i=0;i