#include<stdio.h>
void disp( );
void mergesort(int,int,int);
void msortdiv(int,int);
int a[50],n;
void main( )
{
int i;
printf("\nEnter the n value:");
scanf("%d",&n);
printf("\nEnter elements for an array:");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("\nBefore Sorting the elements are:");
disp( );
msortdiv(0,n-1);
printf("\nAfter Sorting the elements are:");
disp( );
return 0;
}
void disp( )
{
int i;
for(i=0;i<n;i++)
printf("%d ",a[i]);
}
import java.util.Scanner;
class Fibo
{
int x;
int y;
Fibo(int a, int b)
{
x=a;
y=b;
}
int fibo2(int z)
{
if(z==1)
return x;
if(z==2)
return y;
int result = (fibo2(z-1)-fibo2(z-2))%1000000007;
if(result >=0)
return result ;
else
return (result+1000000007);
}
}
class Fibo2
{
public static void main(String[] args)
{
int i;
Scanner in = new Scanner(System.in);
short m = in.nextShort();
int n[] = new int[m];
int o[] = new int[m];
int p[] = new int[m];
for (i = 0; i<m ; i++)
{
n[i] = in.nextInt();
o[i] = in.nextInt();
p[i] = in.nextInt();
}
for( i=0; i<m; i++)
{
Fibo ob = new Fibo(n[i],o[i]);
System.out.println(ob.fibo2(p[i]));
}
}
}