Đề 15 - A. Số dư lớn nhất


Submit solution

Points: 50
Time limit: 1.0s
Memory limit: 256M

Problem type

Bạn được cung cấp ba số nguyên x, y, n.

Nhiệm vụ: tìm số nguyên K lớn nhất thỏa mãn:

  • 0 ≤ K ≤ n
  • K mod x = y (chia lấy phần dư)

Input

Một dòng duy nhất chứa ba số nguyên x, y, n (2 ≤ x ≤ 109, 0 ≤ y < x; y ≤ n ≤ 109).

Output

Số nguyên K thỏa mãn yêu cầu.

Đảm bảo K luôn tồn tại.

Ví dụ 1

input
7 5 12345
output
12339

Ví dụ 2

input
5 0 4
output
0

Comments

There are no comments at the moment.