Under construction

Still being built. Things may change

Quantity of White Mice

Time limit1sMemory limit128 MB

Summary
Simulate monthly mouse pairs with age-based births, death after month n, and newborn removal past 100 survivors to find the month k count.
Level

Easy3 of 10

Topics
Simulation, Implementation
Solved
No attempts yet

Problem

A laboratory keeps one species of white mouse. Each mouse lives only nn months after birth (9<n<139 < n < 13, nn is a natural number). Age counts the month of birth as month 1, so a mouse born in January is in its fourth month in April.

The mice start giving birth in month 7. In months 7 and 8, every pair of parent mice gives birth to one pair of mice per month. Starting in month 9 and lasting mm months (0<m<30 < m < 3, mm is a natural number), every pair of parent mice gives birth to two pairs of mice per month. After that they give birth no more and live out the rest of their life. A mouse dies at the beginning of its month n+1n+1 and is taken out of the lab right away. Month n+1n+1 does not count as time alive.

A month runs in this order.

  1. Every mouse that reaches month n+1n+1 dies and leaves the lab.
  2. Count how many pairs survived from the previous month.
  3. The mice that are due to give birth this month give birth. If the count from step 2 is at most 100 pairs, every pair born this month stays in the lab. If it is more than 100 pairs, every pair born this month goes to another laboratory. Pairs that leave are not part of this lab's count and never give birth here.

At the start the lab holds one newborn pair, and month 1 of that pair is month 1 overall. Find how many pairs of mice are in this lab in month kk (0<k<370 < k < 37, kk is a natural number).

Input

Each line holds one group of data: three natural numbers nn, mm, kk separated by commas. A line holding -1 comes after all the groups and marks the end of the input.

Output

Print one line for each group. The line starts with the input data copied back, then a colon and a space, then the computed number of pairs of white mice.

Examples2

  1. Example 1

    Input
    10,1,6
    10,1,7
    10,1,9
    10,1,10
    10,1,11
    -1
    
    Expected output
    10,1,6: 1
    10,1,7: 2
    10,1,9: 5
    10,1,10: 5
    10,1,11: 4
    
  2. Example 2

    Input
    10,2,8
    10,2,9
    10,2,10
    10,2,11
    -1
    
    Expected output
    10,2,8: 3
    10,2,9: 5
    10,2,10: 7
    10,2,11: 6