P27540 [洛谷] [Language Month Competition 202405] Number Modulo
普及-
题目描述

Problem Description

Little S's birthday is approaching, and Little Q has decided to give the number \( x \) as a gift. To do this, she first prepared a four-digit number \( x \).

However, Little S does not like numbers \(\geq k\). Therefore, Little Q needs to transform each digit of \( x \) into the remainder of that digit divided by \( k \).

Please tell Little Q what the final form of \( x \) will look like.

Input Format

A line containing two positive integers \( x \) and \( k \) separated by a space, where \( x \) represents the number prepared by Little Q, guaranteed to be a four-digit positive integer. The meaning of \( k \) is as described in the problem statement.

Output Format

A line containing a non-negative integer, representing the number \( x \) after each digit has been modulo \( k \).

Sample Input and Output

Sample Input #1

7432 3

Sample Output #1

1102

Sample Input #2

7070 7

Sample Output #2

0

Sample Input #3

1234 9

Sample Output #3

1234

Sample Input #4

7123 7

Sample Output #4

123

Notes

Sample 1 Explanation

The digit \( 7 \) modulo \( 3 \) equals \( 1 \), and the digit \( 4 \) modulo \( 3 \) equals \( 1 \), so the final \( x \) becomes \( 1102 \).

Sample 2 Explanation

Both \( 7 \)s modulo \( 7 \) become \( 0 \), so the entire number becomes \( 0 \). Do not output leading zeros. The same applies to Sample 4.

Sample 3 Explanation

The digits \( 1, 2, 3, 4 \) are all \( < 9 \), so the number remains unchanged.

Data Range

For the first \( 30\% \) of the data, it is guaranteed that the tens, hundreds, and thousands digits of \( x \) are all \( < k \).
For the next \( 30\% \) of the data, it is guaranteed that the units, tens, and hundreds digits of \( x \) are all \( < k \).
For \( 100\% \) of the data, it is guaranteed that \( 1000 \leq x \leq 9999 \) and \( 1 \leq k \leq 9 \).

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
7432 3
样例输出
1102