#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

long long dp[30+1];

long long get_dp(int n);

int main(void) {
    for (int i = 0; i <= 30; i++) dp[i] = -1;
    while (1) {
        int n;
        cin >> n;
        if (n == 0) break;
        long long ans, tmp;
        tmp = get_dp(n);
        ans = tmp / 10;
        if (ans * 10 < tmp) ans++;
        tmp = ans / 365;
        if (tmp * 365 < ans) tmp++;
        cout << tmp << endl;
    }

    return 0;
}

long long get_dp(int n) {
    if (dp[n] != -1) return dp[n];
    else if (n == 0 || n == 1) return dp[n] = 1;
    else if (n == 2) return dp[n] = 2;
    else return dp[n] = get_dp(n-1) + get_dp(n-2) + get_dp(n-3);
}