Candle Box

Given Rita's age gap D and the candle totals R and T, find how many of Theo's candles sit in Rita's box.

Easy3MathImplementationInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

Rita blows out her birthday candles every year. Since her fourth birthday she has put one candle into her own candle box for every year of her age: 4 candles at age four, 5 at age five, and so on up to her current age.

Her younger brother Theo picked up the same habit on his third birthday, so he adds 3 candles at age three, 4 at age four, and so on. Before he turned three he owned no candles at all.

The two boxes look the same and the candles are indistinguishable, so over the years Theo dropped some of his candles into Rita's box by mistake. All of Rita's candles are still in her own box, and Theo's candles are split between the two boxes.

You are given DD, Rita's age minus Theo's age, the number of candles RR in Rita's box, and the number of candles TT in Theo's box. Find how many candles Rita has to take out of her box so that only her own candles remain. The input always determines the two ages uniquely.

Input

The first line has one integer DD, Rita's age minus Theo's age.

The second line has one integer RR, the number of candles in Rita's box.

The third line has one integer TT, the number of candles in Theo's box.

Output

Print one integer, the number of candles Rita has to remove from her box.

Constraints

  • 1D201 \le D \le 20
  • 4R<10004 \le R < 1000
  • 0T<10000 \le T < 1000