Олимпиадный тренинг

Задача 23369. Sheep Tolya (C, B')


Задача

Темы:
Tolya the sheep knows how to clone - then the same sheep with the same logic and habits appears next to her.
When a sheep encounters n haystacks, the following happens:

-  If n is less than 4, then the sheep throws these n haystacks into the nearest ravine. Otherwise:

-  If n is divisible by 5, then the sheep dumps n/5 haystacks into the nearest ravine; cloned;
    itself processes 3n/5 haystacks using the same procedure, and its clone processes 
     remaining n/5 haystacks using the same procedure. Otherwise:
 
- Sheep eats 4 haystacks and processes the remaining n-4 haystacks using the same procedure.

Tolya the sheep once saw n haystacks - this number is given to you. How many haystacks will there be
eaten by her and all her clones in the described process?
 
Input data format
 The first line contains a natural number n <= 6 n <= 106
 
Output format
Print the number of stacks eaten by Tolya and clones

Enter Output
29 8