Hide

Problem F
The N Days of Christmas

/problems/thendaysofchristmas/file/statement/en/img-0001.jpg
Image by HelloSSTK (Shutterstock); Used under license

Consider the first three verses of the classic Christmas carol, The Twelve Days of Christmas:

On the first day of Christmas my true love gave to me
A partridge in a pear tree.

On the second day of Christmas my true love gave to me
Two turtle doves,
And a partridge in a pear tree.

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.

The carol continues this pattern for a total of $12$ days. On the $d^\textrm {th}$ day, you receive $d$ copies of a new kind of gift, along with $(d-1)$ copies of the gift introduced on the previous day, $(d-2)$ copies of the gift introduced the day before that, and so on. This raises some interesting questions:

  • How many gifts do you receive on the $12^{\textrm{th}}$ day?

  • What is the total number of gifts you have received by the end of the $12^{\textrm{th}}$ day?

But why should the Christmas season be limited to $12$ days? If your goal is to get as many gifts as possible (clearly a noble aspiration), then it is advantageous to generalize $12$ to an integer $N,$ where $N$ can be as large as the number of days in a year $(366$ for a leap year).

Given $N$, what are the answers to the generalized versions of the two questions above?

Input

The input consists of a single integer, $N$, the number of days of Christmas $(1 \leq N \leq 366).$

Output

Output two lines, the first of which contains the number of gifts you receive on the $N^{\textrm{th}}$ day, and the second of which contains the total number of gifts you have received by the end of the $N^{\textrm{th}}$ day.

Sample Input 1 Sample Output 1
2
3
4
Sample Input 2 Sample Output 2
12
78
364

Please log in to submit a solution to this problem

Log in