1 #include <iostream> 2 #include <stdio.h> 3 using namespace std; 4 int main() 5 { 6 int i,n,a,b,c,sum; 7 a=3,b=4,c=5; 8 cin>>n; 9 if(n==1) sum=3; 10 else if(n==2) sum=4; 11 else if(n==3) sum=5; 12 else 13 for(i=4;i<=n;i++) 14 { 15 sum=a+b+c; 16 a=b; 17 b=c; 18 c=sum; 19 } 20 cout<<sum<<endl; 21 return 0; 22 }