#K82102. Total Coins Collection

    ID: 35901 Type: Default 1000ms 256MiB

Total Coins Collection

Total Coins Collection

Raj collects coins according to the day of the week. On Monday he collects 1 coin, on Tuesday 2 coins, and so on up to Sunday where he collects 7 coins. This cycle repeats every week. Given a month with N days (with the first day being Monday), compute the total number of coins collected.

The mathematical formulation is as follows:

Let \(w = \left\lfloor \frac{N}{7} \right\rfloor\) be the number of complete weeks, and \(r = N \mod 7\) be the remaining days. Then, the total number of coins is given by:

$$\text{Total Coins} = w \times 28 + \frac{r(r+1)}{2}$$

inputFormat

The first line of the input contains an integer T, the number of test cases. Each of the following T lines contains a single integer N representing the number of days in the month.

outputFormat

For each test case, print a single line with one integer representing the total number of coins collected in that month.## sample

1
7
28

</p>