#CCBCHMOT0000058. Bội nhỏ nhất của 7 không dưới n (Smallest Multiple of Seven at Least n)
Bội nhỏ nhất của 7 không dưới n (Smallest Multiple of Seven at Least n)
Smallest Multiple of Seven at Least n
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given a nonnegative integer , find the smallest nonnegative integer such that and is divisible by seven. Zero is also a multiple of seven.
Input
One line contains a nonnegative integer .
Output
Print the required integer .
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): .
Examples
Example 1
Input
15
Output
21
Explanation
The neighboring multiples are 14 and 21. Since 14<15≤21, the smallest valid result is 21.
Example 2
Input
14
Output
14
Explanation
Fourteen already is a multiple of seven, so no increment is needed.
Example 3
Input
0
Output
0
Explanation
Zero is divisible by seven and satisfies the threshold.