Masala #BKDMSDMPEI

Xotira 32 MB Vaqt 1000 ms Qiyinchiligi 1 %
14

  

IOI

Shohjahon decided that he's going to win gold medal in IOI 2026. To do that, he will solve problems and learn new topics every single day. He has a weekly schedule, on Monday (1st day of the week) he will solve \(a_1\) problems, on Tuesday he will solve \(a_2\) problems and so on up until Sunday. He thinks that if he solves strictly more than \(x\) problems he will be ready for IOI 2026. How much time does he need to be ready?


Kiruvchi ma'lumotlar:

First line contains a number \(x\) (1 ≤ \(x\) ≤ \(10^{18}\)).

Next 7 lines each contain the number \(a_i\), the number of problems he is going to solve on \(i\)th day (1 ≤ \(a_i\) ≤ \(10^3\)).


Chiquvchi ma'lumotlar:

Print the minimum number of days he needs to prepare to be ready for IOI 2026.


Misollar
# input.txt output.txt
1
9
2
1
1
1
1
1
1
8
2
9
1
2
1
1
1
1
1
9
Izoh:

In the first case after working for a full week Shohjahon will have solved 8 problems, on the 8-th day he will solve 2 more problems and total number of solved problems becomes 10, since 10>9 he is ready and minimum number of days required is 8.

Yechimini yuborish
Bu amalni bajarish uchun tizimga kiring, agar profilingiz bo'lmasa istalgan payt ro'yxatdan o'tishingiz mumkin