Hercy wants to save money for his first car. He puts money in the Leetcode&nbsp;bank every day.

He starts by putting in $1 on Monday, the first day. Every day from Tuesday to Sunday, he will put in $1 more than the day before. On every subsequent Monday, he will put in $1 more than the previous Monday. 

Given n, return the total amount of money he will have in the Leetcode bank at the end of the nth day.

&nbsp;
Example 1:

Input: n = 4
Output: 10
Explanation:&nbsp;After the 4th day, the total is 1 + 2 + 3 + 4 = 10.


Example 2:

Input: n = 10
Output: 37
Explanation:&nbsp;After the 10th day, the total is (1 + 2 + 3 + 4 + 5 + 6 + 7) + (2 + 3 + 4) = 37. Notice that on the 2nd Monday, Hercy only puts in $2.


Example 3:

Input: n = 20
Output: 96
Explanation:&nbsp;After the 20th day, the total is (1 + 2 + 3 + 4 + 5 + 6 + 7) + (2 + 3 + 4 + 5 + 6 + 7 + 8) + (3 + 4 + 5 + 6 + 7 + 8) = 96.


&nbsp;
Constraints:


	1 &lt;= n &lt;= 1000


from itertools import cycle, \
                      repeat, \
                      starmap
from operator import floordiv


class Solution:
    def totalMoney(self, n: int) -> int:
        return sum(starmap(add,zip(
            starmap(floordiv, zip(range(n), repeat(7, n))),
            cycle((1,2,3,4,5,6,7))
        )))
class Solution {
    public int totalMoney(int n) {
        int m=n/7; //(no.of full weeks)
        // first week 1 2 3 4 5 6 7 (sum is 28 i.e. 7*(i+3) if i=1)
        // second week 2 3 4 5 6 7 8 (sum is 35 i.e. 7*(i+3) if i=2)
        //.... so on
        int res=0; //for result
        //calculating full weeks
        for(int i=1;i<=m;i++){
            res+=7*(i+3);
        }
        //calculating left days
        for(int i=7*m;i<n;i++){
            res+=++m;
        }
        return res;
    }
}
class Solution {
public:
    int totalMoney(int n) {
        int res = 0;
        for (int i = 1, c = 1; i <= n; i++, c++) {
            res += c;
            c = i % 7 ? c : (i / 7);
        }
        return res;
    }
};
var totalMoney = function(n) {
    let min = 1;
    let days = 7;
    let total = 0;
    let inc = 1;
    for (let i = 0; i < n; i++) {
        if (days !== 0) {
            total += min;
            min++;
            days--;
        } else {
            inc++;
            min = inc
            days = 7;
            i--;
        }
    }
    return total;
};
Calculate Money in Leetcode Bank