Skip to main content
Back to problems
Codeforces
Easy
Math
Number Theory
Weird Rounding

Round a positive integer up to the nearest multiple of 10, then repeatedly apply the same rule until it stops changing.

Acceptance 0%
Also Available On
Other platform versions and source mappings for the same problem.
Problem Statement

You are given a positive integer nn. In one move, you may replace the number by the result of rounding it up to the nearest multiple of 10.

This means:

  • if the last digit is already 0, the number stays the same;
  • otherwise, increase it just enough to make the last digit 0.

Keep applying this operation while the number changes. Return the final value after it becomes stable.

For example, 27303027 \to 30 \to 30, so the answer is $30$.

Task

Compute the final stable value produced by this repeated rounding process.

Input Format

  • The first line contains one integer nn.

Output Format

  • Print one integer: the final value after the repeated rounding process stabilizes.

Constraints

  • 1n1091 \le n \le 10^9
Examples
Sample cases returned by the problem API.

Example 1

Input

27

Output

30

Explanation

27 rounds up to 30. Since 30 already ends in 0, the process stops.

Example 2

Input

40

Output

40

Explanation

40 already ends in 0, so it is unchanged.

Premium problem context

Unlock deeper context for this problem

Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.