DWITE Contest

Test Case for Question #2 in DWITE 2011-2012 High School Round 5

Contest: DWITE 2011-2012 High School Round 5
Question: #2
Input File: DATA2.txt
Output File: OUT2.txt


Input

713
666
1
1000
15




Output

2409
2233
1
3550
24