#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
static const int MAX_N = 30;
int dp[MAX_N+1];
int main() {
    int n;
    dp[0] = dp[1] = 1;
    dp[2] = 2;
    for(int i = 3; i <= 30; i++) dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
    for (;;) {
        scanf("%d", &n);
        if (n == 0) break;
        printf("%d\n", dp[n] / 3650 + 1);
    }
    return 0;
}

