A - Path to the Target Score Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 166

問題文

高橋君はオンラインゲームをプレイしています。現在の高橋君のスコアは A 点です。ランキング上位に入るにはスコアが B 点以上である必要があります。

高橋君がスコアを増やす唯一の方法は、ゲーム内のアイテムショップで「スコアブースター」を購入することです。スコアブースターは 1 個あたり C コインで購入でき、1 個購入するごとにスコアが 1 点増加します。スコアブースターは 0 個以上の任意の個数を購入できます。

高橋君のスコアを B 点以上にするために必要なコインの最小額を求めてください。

なお、現在のスコアがすでに B 点以上である場合は、スコアブースターを購入する必要がないため、答えは 0 です。

制約

  • 1 \leq A \leq 10^9
  • 1 \leq B \leq 10^9
  • 1 \leq C \leq 10^9
  • 入力はすべて整数である

入力

A B C

1 行に、高橋君の現在のスコア A、ランキング上位に必要な最低スコア B、スコアブースター 1 個あたりの価格 C がスペース区切りで与えられる。

出力

高橋君のスコアを B 点以上にするために必要なコインの最小額を 1 行で出力せよ。

なお、答えは最大で 10^{18} 程度になる場合があることに注意せよ。


入力例 1

50 100 3

出力例 1

150

入力例 2

150 100 5

出力例 2

0

入力例 3

999999000 1000000000 100

出力例 3

100000

Score : 166 pts

Problem Statement

Takahashi is playing an online game. His current score is A points. To reach the top of the rankings, he needs a score of at least B points.

The only way for Takahashi to increase his score is by purchasing "Score Boosters" from the in-game item shop. Each Score Booster costs C coins, and each one purchased increases his score by 1 point. He can purchase any number of Score Boosters, including 0.

Find the minimum number of coins required to bring Takahashi's score to at least B points.

Note that if his current score is already at least B points, he does not need to purchase any Score Boosters, so the answer is 0.

Constraints

  • 1 \leq A \leq 10^9
  • 1 \leq B \leq 10^9
  • 1 \leq C \leq 10^9
  • All inputs are integers

Input

A B C

A single line contains Takahashi's current score A, the minimum score B required to reach the top of the rankings, and the price C per Score Booster, separated by spaces.

Output

Print on a single line the minimum number of coins required to bring Takahashi's score to at least B points.

Note that the answer may be as large as approximately 10^{18}.


Sample Input 1

50 100 3

Sample Output 1

150

Sample Input 2

150 100 5

Sample Output 2

0

Sample Input 3

999999000 1000000000 100

Sample Output 3

100000