405247: GYM101856 K Katryoshka

Memory Limit:1024 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. Katryoshkatime limit per test1 secondmemory limit per test1024 megabytesinputkatryoshka.inoutputstandard output

The Egyptian football team will be in Russia for the World Cup, of course they all would like to buy souvenirs for their families. Luckily they met the king of souvenirs of the famous Russian souvenir Matryoshka; the king makes his masterpiece Katryoshka using different kinds of pieces: wooden eyes, wooden mouths, and wooden bodies. He can form a nice Katryoshka using one of the following ways:

  • Two eyes and a body.
  • Two eyes, mouth and a body.
  • Eye, mouth and a body.
If the king has n eyes, m mouths and k bodies, what is the largest number of Katryoshkas that can be made by the king?Input

The first line of the input contains a single integer 1 ≤ T ≤ 100 the number of test cases. Each test case consists of a single line containing 3 space separated integers 'n m k' the number of eyes, mouths and bodies respectively; where 0 ≤ n, m, k ≤ 108.

Output

For each test case output a line displaying the case number and a single integer which is the largest number of nice Katryoshka pieces.

ExampleInput
4
1 2 3
0 11 2
14 21 23
90 24 89
Output
Case 1: 1
Case 2: 0
Case 3: 14
Case 4: 57

加入题单

上一题 下一题 算法标签: