import java.math.*;
import java.util.Scanner;
class Main {
public static void main(String[] args){
Scanner in=new Scanner(System.in);
BigInteger a,b,c;
while(in.hasNext()){
int n;
n=in.nextInt();
a=BigInteger.ONE;
b=BigInteger.valueOf(2);
c=BigInteger.valueOf(3);
if(n==0)
System.out.println(a);
else if(n==1)
System.out.println(b);
else if(n==2)
System.out.println(c);
else{
n-=2;
while(n>0){
a=b;
b=c;
c=c.add(a);
n--;
}
System.out.println(c);
}
}
}
}
import java.util.Scanner;
class Main {
public static void main(String[] args){
Scanner in=new Scanner(System.in);
BigInteger a,b,c;
while(in.hasNext()){
int n;
n=in.nextInt();
a=BigInteger.ONE;
b=BigInteger.valueOf(2);
c=BigInteger.valueOf(3);
if(n==0)
System.out.println(a);
else if(n==1)
System.out.println(b);
else if(n==2)
System.out.println(c);
else{
n-=2;
while(n>0){
a=b;
b=c;
c=c.add(a);
n--;
}
System.out.println(c);
}
}
}
}
Comments
Post a Comment