[cpp]
#include <iostream>
using namespace std;
int main()
{
int n;
int a[56]={0,1,2,3};
while(cin>>n&&n)
{
switch(n)
{
case 1:
cout<<a[n]<<endl;
break;
case 2:
cout<<a[n]<<endl;
break;
case 3:
cout<<a[n]<<endl;
break;
default:
for(int i=4;i<56;i++)
a[i]=a[i-1]+a[i-3];
cout<<a[n]<<endl;
break;
}
}
}