#K81382. Special Number Finder

    ID: 35741 Type: Default 1000ms 256MiB

Special Number Finder

Special Number Finder

You are given an integer N. A number is defined as special if the sum of its digits is divisible by 3. In mathematical terms, let the digits of a number be \(d_1, d_2, \ldots, d_k\); the number is special if \(\sum_{i=1}^{k} d_i \equiv 0 \pmod{3}\). Your task is to find the smallest special number that is greater than or equal to N.

Example:

  • If N = 38, then the smallest special number is 39 because \(3+9=12\) and \(12\) is divisible by 3.

Read input from standard input and write your output to standard output.

inputFormat

The input consists of a single integer N (1 ≤ N ≤ 10^18) given from standard input.

outputFormat

Print a single integer — the smallest special number greater than or equal to N.

## sample
57
57