int a,b,c,m,N,x=0; cin>>a>>b>>m>>N; while(N-1>=0){ c=b; a=a+c; b=a; a=a+c; x=a+b; if(a>=m||b>=m){ break; } N-=1; } cout<<x;