Pagini recente » Cod sursa (job #610864) | Cod sursa (job #1035141) | Cod sursa (job #2170858) | Cod sursa (job #2458265) | Cod sursa (job #2158372)
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
ifstream f("rsir.in");
ofstream g("rsir.out");
int t1,t0,m,a,b,x,y,z;
long long n;
int rec(int T)
{
if(T==0)return t0;
else if(T==1)return t1;
else return a*pow(rec(T-2),2)+b*pow(rec(T-1),2)+ x*rec(T-2)+y*rec(T-1)+z;
}
int main()
{ int i;
f>>t0>>t1>>a>>b>>x>>y>>z>>m>>n;
g<<rec(n)%m;
return 0;
}