#include <iostream>
#include <vector>
using namespace std;


void solve(vector<int>& a) {
    a[0] = 1;
    for(int i = 1; i <= 30; i++) {
        if(i == 1) {
            a[i] = a[i - 1];
        } if(i == 2) {
            a[i] = a[i - 1] + a[i - 2];
        } else {
            a[i] = a[i - 1] + a[i - 2] + a[i - 3];
        }
    }
    for(int i = 1; i <= 30; i++) {
        a[i] = (a[i] + (3650 - 1)) / 3650;
    }
}

int main() {
    vector<int> a(31);
    solve(a);
    vector<int> inpArray;
    int inp;
    do {
        cin >> inp;
        inpArray.push_back(inp);
    } while(inp != 0);

    for(int i = 0; i < (int)inpArray.size() - 1; i++)
        cout << a[inpArray[i]] << endl;

    return 0;
}

