Allowance (2) X32391


Statement
 

pdf   zip

You have saved nn euros. Additionally, every Monday of the next tt weeks, you will be given a weekly allowance of a1,a2,...,ata_1, a_2, ..., a_t euros, respectively. Every week, you have a fixed amount of expenses that sums up to dd euros.

Write a program that counts how many weeks you end up with a strictly positive balance.

Input

The input consists of three naturals d0d \geq 0, n0n \geq 0 and t>0t> 0, which represent fixed weekly expenses, the initial savings, and the number of weeks with allowance, respectively.

Following, there are the quantities corresponding to the tt weekly allowances a1,...,ata_1, ..., a_t. Every week allowance is a natural number ai0a_{i}\geq 0.

Output

The output is a natural number indicating the number of weeks which end up with a strictly positive balance, after paying the weekly expenses.

Your program must meet the output format described in the examples an it should follow a right programming style. You may also decide to include comments, if appropriate.

Public test cases
  • Input

    10 100 5
    70
    10
    10
    10
    10
    

    Output

    5
    
  • Input

    90 50 3
    100
    10
    10
    

    Output

    1
    
  • Input

    0 0 2
    15
    15
    
    

    Output

    2
    
  • Input

    10 100 1
    0 
    

    Output

    1
    
  • Input

    10 100 1
    0 
    

    Output

    1
    
  • Information
    Author
    Maria J. Blesa
    Language
    English
    Translator
    Maria Serna
    Original language
    Catalan
    Other languages
    Catalan Spanish
    Official solutions
    Unknown.
    User solutions
    C++ Python