UFPT2015E - The n Days of Christmas

no tags 

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.

Example

Input:
1
2
3
0 Output: 1
4
10

hide comments
wisfaq: 2015-09-18 13:51:11

Ever thought about eating them yourself?


Added by:Cormac
Date:2015-09-16
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU JS-MONKEY
Resource:ACM ICPC 2013 Southeast USA Regional Programming Contest