Question
Candy Distribution with 4-Day Cycle
A teacher distributes candies to students following a 4-day repeating plan:  
  - Day 1: A candies  
  - Day 2: B candies  
  - Day 3: C candies  
  - Day 4: D candies  
After Day 4, the pattern repeats starting from Day 1.  

The distribution continues until the teacher has given out at least N candies in total.  

Task:
Determine the day on which the teacher reaches or exceeds N candies.  
 
Input
A single line containing five space-separated integers in the following order:
N A B C D
Where:
N — the total number of candies to distribute
A — candies given on Day 1
B — candies given on Day 2
C — candies given on Day 3
D — candies given on Day 4
Output
Print a single integer — the day when the total candies reach or exceed N.
Example
Input:
20 3 4 5 2

Output:
6

Explanation:
Day-wise candy distribution:
Day 1: 3 → total = 3
Day 2: 4 → total = 7
Day 3: 5 → total = 12
Day 4: 2 → total = 14
Day 5: 3 → total = 17
Day 6: 4 → total = 21 (≥ 20, stop)
The teacher reaches or exceeds 20 candies on Day 6.

Online