import java.util.Scanner;
public class Main {
public static void main(String[] args){
long n;
Scanner sc = new Scanner(System.in);
n = sc.nextLong();
System.out.println(f(n));
}
public static long f(long n){
if(n < 20180001)
return n+2017;
else
return f(f(n-2018));
}
}
通过率只有96%,StackOverFlow,不是很懂