import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int[] dp = new int[56];
dp[1] = 1;
dp[2] = 2;
dp[3] = 3;
dp[4] = 4;
for (int i = 5; i <= 55; ++i)
dp[i] = dp[i - 1] + dp[i - 3];
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
int n = scanner.nextInt();
if (n == 0)
break;
System.out.println(dp[n]);
}
}
}