A Pot of Honey
Once, Piglet visited Winnie-the-Pooh and found him deep in thought, working on some calculations. It turned out that Eeyore had announced a contest to find the best honey packer. Each day, the main bee website awarded half a liter of honey to the first person who solved the following problem:
The bees have N grams of honey and an unlimited supply of jars, each with a capacity of W grams. They begin filling the jars with honey until the honey runs out. It's possible that the last jar won't be completely filled. The challenge is to determine how many grams of honey will be in this last jar.
Every morning at exactly 9:00, a new value of N was posted on the website. Winnie-the-Pooh would immediately start his calculations, which were quite challenging. However, by the time he found the answer, someone else had already beaten him to it. Piglet decided to help his friend by promising to write a program that would instantly provide the answer for any given natural number N.
Input Data:
The first line of the input contains the number N (N ≤ 10^1000
) — the total amount of honey in grams. The second line contains the number W — the capacity of each jar in grams (W ≤ 10^9
).
Output Data:
The output should be a single line containing one number — the amount of honey left in the last jar.