[BOJ 7117] Sevens, twos and zeros

View as PDF

Submit solution

Points: 4
Time limit: 1.0s
Memory limit: 128M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

The task is to write a program that outputs the smallest possible number s for an input natural number n. The number s must have the following properties:</p>

  • s ≥ n;
  • the value of s written in decimal form contains only digits 7, 2 and 0 and it does not start with 0;
  • the decimal form of s contains at most 20 digits;
  • the remainder of s divided by n equals 0.
## 입력 형식

A value of natural number n (0 < n < 500000) is input from the keyboard.

출력 형식

The number s as described above must be output on the screen. If it is not possible to find the corresponding value of s to the given value of n, output one word "NAV".

예제 입력 1

3

예제 출력 1

27

예제 입력 2

61

예제 출력 2

70272

Comments

There are no comments at the moment.