import java.util.Scanner;public class Main{public static void main(String[] args) {int maxn=1000000+5;int mod=10007;int[] Fibonacci=new int[maxn];Fibo ...
import java.util.Scanner; public class Main{ public static void main(String[] args) { int maxn=1000000+5; int mod=10007; int[] Fibonacci=new int[maxn]; Fibonacci[1]=1; Fibonacci[2]=1; Scanner sc=new Scanner(System.in); int n=sc.nextInt(); for(int i=3;i<=n;i++) { Fibonacci[i]=Fibonacci[i-1]+Fibonacci[i-2]; Fibonacci[i]%=mod; } System.out.println(Fibonacci[n]); sc.close(); } }
import java.util.Scanner;
public class Main{public static void main(String[] args) {int maxn=1000000+5;int mod=10007;int[] Fibonacci=new int[maxn];Fibonacci[1]=1;Fibonacci[2]=1;Scanner sc=new Scanner(System.in);int n=sc.nextInt();for(int i=3;i<=n;i++){Fibonacci[i]=Fibonacci[i-1]+Fibonacci[i-2];Fibonacci[i]%=mod;}System.out.println(Fibonacci[n]);sc.close();}}