class Solution { public int totalMoney(int n) { int sum = 0; int[] arr = {1,2,3,4,5,6,7}; int month = n/7; int day = n%7; for(int i=0;i<month;i++){ for(int j = 0;j<arr.length;j++){ sum +=arr[j]+i; } } for(int i=0;i<day;i++){ sum+=arr[i]+month; } return sum; } }