PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000174. Giảm tổng chữ số (Decrease the Sum of Digits)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Giảm tổng chữ số (Decrease the Sum of Digits)

Decrease the Sum of Digits

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

You are given positive integers nn and ss. In one operation, you increase nn by exactly 11, and you may repeat the operation as many times as needed.

The decimal digit sum of an integer is the sum of the digits of its ordinary base-ten representation. Find the minimum number of operations required to obtain a number whose digit sum is at most ss.

Input

The only line contains integers n,sn,s, the initial number and the maximum allowed digit sum.

Output

Print one nonnegative integer: the smallest number of unit increments required.

Subtasks

  • Subtask 1 (20 points): 1≤n≤1051\le n\le10^5; 1≤s≤1621\le s\le162.
  • Subtask 2 (30 points): 1≤n≤10101\le n\le10^{10}; 1≤s≤1621\le s\le162.
  • Subtask 3 (50 points): 1≤n≤10181\le n\le10^{18}; 1≤s≤1621\le s\le162.

Examples

Input

500 4

Output

500

Explanation

The initial number 500500 has digit sum 5>45>4. Every integer between 500500 and 999999 has a hundreds digit of at least 55, so none can satisfy the limit. The next number 10001000 has digit sum 11 and requires 1000−500=5001000-500=500 increments; the answer is 500500.