Hide

Problem L
Candle Box

/problems/candlebox/file/statement/en/img-0001.png

Rita loves her Birthday parties. She is really happy when blowing the candles at the Happy Birthday’s clap melody. Every year since the age of four she adds her birthday candles (one for every year of age) to a candle box. Her younger daydreaming brother Theo started doing the same at the age of three. Rita’s and Theo’s boxes look the same, and so do the candles.

One day Rita decided to count how many candles she had in her box:

– No, no, no! I’m younger than that!

She just realized Theo had thrown some of his birthday candles in her box all these years. Can you help Rita fix the number of candles in her candle box?

Task

Given the difference between the ages of Rita and Theo, the number of candles in Rita’s box, and the number of candles in Theo’s box, find out how many candles Rita needs to remove from her box such that it contains the right number of candles.

Input

The first line of the input has one integer $D$, corresponding to the difference between the ages of Rita and Theo.

The second line has one integer $R$, corresponding to the number of candles in Rita’s box.

The third line has one integer $T$, corresponding to the number of candles in Theo’s box.

Constraints

$1$

$\leq $

$D$

$\leq $

$20$

Difference between the ages of Rita and Theo

$4$

$\leq $

$R$

$<$

$1\, 000$

Number of candles in Rita’s box

$0$

$\leq $

$T$

$<$

$1\, 000$

Number of candles in Theo’s box

Output

An integer representing the number of candles Rita must remove from her box such that it contains the right number of candles.

Sample Input 1 Sample Output 1
2
26
8
4

Please log in to submit a solution to this problem

Log in