Forget school, I wanna farm horseshoe crabs ~ Victor, 2019
Victor, deciding that school is dumb and boring, decides to farm horseshoe crabs. After he has bred enough crabs, he sells them to the highest bidder—babies at one thousand dollars each, and adults at two thousand dollars each.
At the end of every month, each adult crab in Victor's care gives birth to
If Victor starts with
Constraints
Subtask 1 [15%]
Subtask 2 [85%]
Input Specification
4 space-separated integers,
Output Specification
The amount of money (in thousands of dollars) made from selling all the crabs in the middle of the
Sample Input 1
4 2 1 1
Sample Output 1
16
Explanation of Sample 1
The number of crabs in Victor's tank at the beginning of every month is as follows:
Month | # of Adults | # of Babies |
---|---|---|
1 | 1 | 0 |
2 | 1 | 2 |
3 | 3 | 2 |
4 | 5 | 6 |
Victor can then sell the adult crabs for 10 thousand dollars and the baby crabs for 6 thousand dollars, for a total of 16 thousand dollars.
Sample Input 2
8 1 3 2
Sample Output 2
38
Comments
stay mad