import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
/*
* 1부터 숫자를 증가시켜가며 반복
* 666이 존재하는지 계산후 있으면 카운트를 증가
* 입력한 카운트가 되면 반복종료
* */
int number = 1;
int num = 0;
int count = 1;
int goal = Integer.parseInt(br.readLine());
while(count <= goal){
if (String.valueOf(number).contains("666")) {
num = number;
count++;
}
number++;
}
bw.write(String.valueOf(num));
bw.flush();
bw.close();
}
}
댓글 영역