The Epidemic
An epidemic has out broken in the world and many people are getting infected day by day. Scientists who are studying about this epidemic have already found that this is caused by a virus (not a computer virus) and they have already found the pattern of the growth of this virus.
For simplicity we will brief the growth pattern as follows.
- First a virus cell enters human body in day 1
- This cell grows for five days
- After five days (from 6th day onwards) this cell is a grown cell
- This grown cell make three new virus cells everyday thereafter
- These new cells grow in a similar way
- After 10 days (from 11th day onwards) the new cells born in day 6 are grown and they also start making more new cells.
- Assume no cells die within the period we consider
The pattern of the growth in first 12 days is shown in the following table | Day | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | |:——————————–|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:–:|:–:|:–:|:–:|:–:| | Grown Cells | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 4 | 7 | | New Born Cells for This Day | 0 | 0 | 0 | 0 | 0 | 3 | 3 | 3 | 3 | 3 | 12 | 21 | | Total Child Cells | 1 | 1 | 1 | 1 | 1 | 3 | 6 | 9 | 12 | 15 | 24 | 42 | | Total Cells | 1 | 1 | 1 | 1 | 1 | 4 | 7 | 10 | 13 | 16 | 28 | 49 |
Predicting the number of virus cells in a patient at a given time is crucial when treating the disease. Since the pattern increases very rapidly after 10 days, it is difficult to predict the numbers. Therefore, a computer program is needed to predict the virus cell count in any day.
You are given the number of days(D) passed after the patient is infected. You are supposed to predict the number of grown virus cells and child virus cells.
Input Format
A single integer D, the number of days.
Output Format
A single integer, the total number of virus cells.
Constraints
- 1 \(\leq\) D \(\leq\) 90
Limits
- Time Limit: 1s
- Memory Limit: 256MB
Sample Input 0
10
Sample Output 0
16
Sample Input 1
12
Sample Output 1
49
Open on HackerRank ↗ · Markdown source · Back to the archive