1 uses math;
2 const p=12345678;
3 var i,n,m,k,j,k1,k2,ans,tmp:longint;
4 f:array[0..301,0..151,0..20,0..20] of longint;
5 procedure update(var x,y:longint);
6 begin
7 x:=(x+y) mod p
8 end;
9
10 procedure main;
11 begin
12 f[0,0,0,0]:=1;
13 for i:=0 to n+m do
14 for j:=0 to min(i,n) do
15 for k1:=0 to min(min(i,j),k) do
16 for k2:=0 to min(min(i,i-j),k) do
17 begin
18 tmp:=f[i,j,k1,k2];
19 if (k1<k) and (j<n) then update(f[i+1,j+1,k1+1,max(k2-1,0)],tmp);
20 if (k2<k) and ((i-j)<m) then update(f[i+1,j,max(k1-1,0),k2+1],tmp);
21 end;
22 ans:=0;
23 for i:=0 to k do
24 for j:=0 to k do
25 update(ans,f[n+m,n,i,j]);
26 writeln(ans);
27 end;
28
29 begin
30 assign(input,‘input.txt‘);assign(output,‘output.txt‘);
31 reset(input);rewrite(output);
32 readln(n,m,k);
33 main;
34 close(input);close(output);
35 end.