Ուղարկել | Բոլոր լուծումները | Լավագույն լուծումները | Վերադառնալ ցուցակին |
ACM_0088 - THE N DAYS OF CHRISTMAS |
On the first day of Christmas, my true love gave to me, a partridge in a pear tree.
Great. I wanted an iPad.
On the second day of Christmas, my true love gave to me, two turtle doves, and a partridge in a pear tree.
OK, now I have 4 birds: two turtle doves and a partridge today, and a partridge from yesterday. My cats are going crazy.
On the third day of Christmas, my true love gave to me, three french hens, two turtle doves, and a partridge in a pear tree.
What's with the birds? I now have ten of them, and no place to put them (except inside the cats). How long can my true love keep this up?
Given a number of days of Christmas, figure out the total number of gifts I'm going to receive.
Input
There will be several test cases in the input. Each test case will consist of a single integer n (1≤n≤1,000,000), on its own line. The input will end with a line with a single 0.
Output
For each test case, output a single integer, indicating the number of gifts I’m going to receive, in total. Output no spaces, and do not separate answers with blank lines.
Examples
№ |
stdin |
stdout |
1 |
1 2 3 0 |
1 4 10 |
Ավելացրեց. | Հրանտ Հովհաննիսյան |
Ամսաթիվ. | 2014-01-12 |
Ժամանակի սահմանափակումը. | 1s |
Ծրագրի տեքստի սահմանափակումը. | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Լեզուներ. | Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PYPY3 PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE |
Աղբյուրը. | NA Southeast Div II 2013.B |