1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#include <bits/stdc++.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()

#define PII pair<int,int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>

#define debug(x) {cout <<#x <<" = " <<x <<endl; }
#define debug2(x,y) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y <<endl; } 
#define debug3(x,y,z) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y << ", " << #z << " = " << z <<endl; } 
#define debugv(x) {{cout <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<endl; }}
#define debugt(t,n) {{cerr <<#t <<" = "; FOR(it,0,(n)) cerr <<t[it] <<", "; cerr <<endl; }}

#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue

#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}
#define jeb() fflush(stdout);

using namespace std;

int K, X, Y;
vector<PII> w;
vector<PII> WEKTORY_PITA = {
	mp(1,0), mp(3,4), mp(4,3), mp(5,12), mp(12,5), mp(8,15), mp(15,8), mp(7,24), mp(24,7), mp(20,21), mp(21,20), mp(12,35), mp(35,12), mp(9,40), mp(40,9), mp(28,45), mp(45,28), mp(11,60), mp(60,11), mp(16,63), mp(63,16), mp(33,56), mp(56,33), mp(48,55), mp(55,48), mp(13,84), mp(84,13), mp(36,77), mp(77,36), mp(39,80), mp(80,39), mp(65,72), mp(72,65), mp(20,99), mp(99,20), mp(60,91), mp(91,60), mp(15,112), mp(112,15), mp(44,117), mp(117,44), mp(88,105), mp(105,88), mp(17,144), mp(144,17), mp(24,143), mp(143,24), mp(51,140), mp(140,51), mp(85,132), mp(132,85), mp(119,120), mp(120,119), mp(52,165), mp(165,52), mp(19,180), mp(180,19), mp(57,176), mp(176,57), mp(104,153), mp(153,104), mp(95,168), mp(168,95), mp(28,195), mp(195,28), mp(84,187), mp(187,84), mp(133,156), mp(156,133), mp(21,220), mp(220,21), mp(140,171), mp(171,140), mp(60,221), mp(221,60), mp(105,208), mp(208,105), mp(120,209), mp(209,120)	
};


PII sum(PII a, PII b) {
	return {a.st + b.st, a.nd + b.nd};
}

int maxX1, maxY1;
int licz[6500][6500]; 

void filtruj_wektory() {
	FORE(i,WEKTORY_PITA) {
		int x = i->st, y = i->nd;
		if (x*x + y*y > K*K) continue;
		if (x > max(X,Y) || y > max(X,Y)) continue;	
		w.pb({x,y});
	}
}

void wylicz_cwiartki () {
	maxX1 = 0, maxY1 = 0;
	int bnd = max(X,Y);
	licz[0][0] = 1;
	int mama = 0;
	FOR(i,0,w.size()) {
		int x = w[i].st, y = w[i].nd;

		maxX1 = min(bnd, maxX1 + x); 
		maxY1 = min(bnd, maxY1 + y);

		FORD(j,maxX1,0) {
			if (j < x) break;
			FORD(k,maxY1,0) {
				if (k < y) break;
				licz[j][k] += licz[j-x][k-y];  
				licz[j][k] &= 0xffffffffL;
				mama = max(mama, licz[j][k]);
			}
		}
	}
}

void dbg(PII p) {
	cout << "(" << p.st << ", " << p.nd << ") "; 
}

int dupa1[250][250];

void wypisz(vector<pair<PII, int> > dupa) {
	FORE(i, dupa) {
		cerr << "("<<i->st.st << ", " << i->st.nd << ") => " << i->nd << endl;
	}
}

int sh2 = 160;
int licz2[350][155][155];
int cp[350][155][155];
int dupa2[700][700];

void case2() {
		FOR(i,0,maxX1 + 1) FOR(j,0,maxY1+1) {
			licz2[sh2+i][j][i] = cp[sh2+i][j][i] = licz[i][j];
		}
		FOR(i,0,w.size()) {
			int x = w[i].nd, y = w[i].st;
			FOR(j1,0,350) {
				FOR(j2,0,152) {
					if (j2 > Y) break;
					FOR(j3,0,152)  {
						if (j1 >= x && j2+y < 152) {
							cp[j1-x][j2+y][j3] += licz2[j1][j2][j3];
							cp[j1-x][j2+y][j3] &= 0xffffffffL;
						}
					}
				}
			}	
			FOR(j1,0,350) FOR(j2,0,152) FOR(j3,0,152)  {
				licz2[j1][j2][j3] = cp[j1][j2][j3];
			}	
		}
		FOR(j1,0,350) {
			int diff = j1-sh2;
			FOR(y,0,152) {
				if (y > Y) continue;
				FOR(x1,0,152) {
					FOR(x2,0,152) {
						int wychyl = -diff + x1 + x2;
						if (wychyl < 0) continue;
						if (wychyl > X) break;
						dupa2[wychyl][y] += (licz2[j1][y][x1]*1LL*licz2[j1][y][x2]) & 0xffffffffL;
						dupa2[wychyl][y] &= 0xffffffffL;
					}
				}
			}
		}

		FORE(i, w) {
			dupa2[i->st][i->nd]--;
			dupa2[i->nd][i->st]--;
		}
		lint ans = 0;
		lint kij = (1LL<<32) - 1LL;
		FOR(i,1,650) {
			if (i > X) break;
			FOR(j,1,650) {
				if (j > Y) break;
				int xi =  (X - i);
				int yi =  (Y - j); 
				ans += (((xi * 1LL * yi)&kij) * 1LL * dupa2[i][j])&kij;
				ans &= kij;
			}
		}
		printf("%lld\n", ans);
}

void case1() {		
		vector<pair<PII,int> > nz;
		FOR(i,0,maxX1+1) FOR(j,0,maxY1+1) {
			if (licz[i][j] != 0) nz.pb({{i,j},licz[i][j]});
		}
		FORE(i1, nz) {
			FORE(i2, nz) {
				FORE(i3, nz) {
					FORE(i4, nz) {
						if ( (i1->st.st + i4->st.nd == i2->st.nd + i3->st.st) 
							&& (i1->st.nd + i2->st.st == i3->st.nd + i4->st.st)) {
								dupa1[i1->st.st+i4->st.nd][i1->st.nd+i2->st.st] += i1->nd * i2->nd * i3->nd * i4->nd;
						}
					}
				}
			}
		}
		FORE(i, w) {
			dupa1[i->st][i->nd]--;
			dupa1[i->nd][i->st]--;
		}
		lint ans = 0;
		lint kij = (1LL<<32) - 1LL;
		FOR(i,1,250) {
			if (i > X) break;
			FOR(j,1,250) {
				if (j > Y) break;
				int xi =  (X - i);
				int yi =  (Y - j); 
				ans += (((xi * 1LL * yi)&kij) * 1LL * dupa1[i][j])&kij;
				ans &= kij;
			}
		}
		printf("%lld\n", ans);
}

int main () {
	read3(X,Y,K);
	filtruj_wektory();
	wylicz_cwiartki();
	if (K <=15) {
		case1();
	} else {
		case2();
	}

	return 0;
}