import times, strutils, sequtils, math, algorithm, tables, sets, lists, intsets import critbits, future, strformat, deques template `max=`(x,y) = x = max(x,y) template `min=`(x,y) = x = min(x,y) template `mod=`(x,y) = x = x mod y template scan2 = (scan(), scan()) template scan3 = (scan(), scan()) let read* = iterator: string {.closure.} = while true: (for s in stdin.readLine.split: yield s) proc scan(): int = read().parseInt proc scanf(): float = read().parseFloat proc toInt(c:char): int = return int(c) - int('0') proc solve()= var w = scan() h = scan() x = scan() if w==1 and h==1 and 9>=x: echo x elif w==1 and 9*2>=x: var a = min(9,x) b = min(9,x-a) t = @[a,b,0] board = newseqwith(h,0) for i in 0..=x: var a = min(9,x) b = min(9,x-a) t = @[a,b,0] board = newseqwith(w,0) for i in 0..=x: var a = min(9,x) b = min(9,x-a) c = min(9,x-a-b) d = min(9,x-a-b-c) t = @[@[a,b,0],@[c,d,0],@[0,0,0]] board = newseqwith(h,newseqwith(w,0)) for y in 0..=x: echo x elif w==1 and 9*2>=x: var a = min(9,x) b = min(9,x-a) t = @[a,b,0] board = newseqwith(h,0) for i in 0..=x: var a = min(9,x) b = min(9,x-a) t = @[a,b,0] board = newseqwith(w,0) for i in 0..