64C.md (989B)
1 Source: https://codeforces.com/problemset/problem/64/C 2 3 C. Table 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 64 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 The integer numbers from 1 to *nm* was put into rectangular table having *n* rows and *m* columns. The numbers was put from left to right, from top to bottom, i.e. the first row contains integers 1, 2, ..., *m*, the second — *m* + 1, *m* + 2, ..., 2 * *m* and so on. 22 23 After it these numbers was written on the paper in another order: from top to bottom, from left to right. First, the numbers in the first column was written (from top to bottom) and so on. 24 25 Print the *k*-th number on the paper. 26 27 Input 28 29 The only line in the input contains three integer numbers *n*, *m* and *k* (1 ≤ *n*, *m* ≤ 20000, 1 ≤ *k* ≤ *nm*). 30 31 Output 32 33 Print the required number. 34 35 Examples 36 37 Input 38 39 ``` 40 3 4 11 41 ``` 42 43 Output 44 45 ``` 46 8 47 ``` 48 49 Input 50 51 ``` 52 20000 10000 200000000 53 ``` 54 55 Output 56 57 ``` 58 200000000 59 ```