A dockyard tracks how many crates its crew loads during a run of n consecutive work shifts. On shift 1, the crew loads exactly 1 crate. On every later shift within the same 7-shift cycle, the crew loads exactly one more crate than on the immediately preceding shift. The first shift of every new 7-shift cycle loads exactly one more crate than the first shift of the immediately preceding cycle (so the very first shift of cycle 1 loads 1 crate, the first shift of cycle 2 loads 2 crates, the first shift of cycle 3 loads 3 crates, and so on); a final, incomplete cycle simply stops wherever the n shifts run out. Given the total number of shifts, report the total number of crates loaded across the whole run.
A single line containing one integer n, the number of shifts.
A single integer: the total number of crates loaded across all n shifts.
1 <= n <= 1000
Example 1
Input
10
Expected
37
Explanation
Cycle 1 covers shifts 1-7, loading 1+2+3+4+5+6+7 = 28 crates. Cycle 2 begins at shift 8, loading one more than cycle 1's first shift (1), so shift 8 loads 2, shift 9 loads 3, and shift 10 loads 4; that partial cycle contributes 2+3+4 = 9. Total: 28 + 9 = 37.
Example 2
Input
4
Expected
10
Explanation
All 4 shifts fall within the first cycle, loading 1, 2, 3, and 4 crates respectively, for a total of 1+2+3+4 = 10.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →