Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

func CountPatterns(i int, patternNums []int) int {
	if patternNums[i] != 0 {
		return patternNums[i]
	}
	if i == 0 {
		return 1
	}
	patternNums[i] += CountPatterns(i-1, patternNums)
	if i > 1 {
		patternNums[i] += CountPatterns(i-2, patternNums)
	}
	if i > 2 {
		patternNums[i] += CountPatterns(i-3, patternNums)
	}
	return patternNums[i]
}

func Solve(N int) int {
	patternNums := MakeFilledInts(N+1, 0)
	return (CountPatterns(N, patternNums) + 3649) / 3650
}

func main() {
	for N := scan.Int(); N != 0; N = scan.Int() {
		ans := Solve(N)
		fmt.Println(ans)
	}
}

// --------------------------------------------------------------------------------
// Input

var scan = NewScanner()

type Scanner struct{ *bufio.Scanner }

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(nil, 100000000)
	return &Scanner{sc}
}

func (s *Scanner) String() string {
	s.Scan()
	return s.Text()
}

func (s *Scanner) Strings(l int) []string {
	if l == 0 {
		return []string{}
	}
	sl := make([]string, l, l)
	for i := range sl {
		sl[i] = s.String()
	}
	return sl
}

func (s *Scanner) Int() int {
	n, _ := strconv.Atoi(s.String())
	return n
}

func (s *Scanner) Ints(l int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := range sl {
		sl[i] = s.Int()
	}
	return sl
}

func (s *Scanner) Int64() int64 {
	n, _ := strconv.ParseInt(s.String(), 10, 64)
	return n
}

func (s *Scanner) BigInt() *big.Int {
	return big.NewInt(s.Int64())
}

func (s *Scanner) BigInts(l int) []*big.Int {
	if l == 0 {
		return []*big.Int{}
	}
	sl := make([]*big.Int, l, l)
	for i := range sl {
		sl[i] = s.BigInt()
	}
	return sl
}

func (s *Scanner) Float64() float64 {
	f, _ := strconv.ParseFloat(s.String(), 64)
	return f
}

func (s *Scanner) Floats64(l int) []float64 {
	if l == 0 {
		return []float64{}
	}
	sl := make([]float64, l, l)
	for i := range sl {
		sl[i] = s.Float64()
	}
	return sl
}

// --------------------------------------------------------------------------------
// Output

const (
	Yes = "Yes"
	No  = "No"

	YES = "YES"
	NO  = "NO"
)

func PrintBool(v bool, trueStr, falseStr string) {
	if v {
		fmt.Println(trueStr)
	} else {
		fmt.Println(falseStr)
	}
}

// --------------------------------------------------------------------------------
// sort.BigIntSlice

type BigIntSlice []*big.Int

func (sl BigIntSlice) Len() int {
	return len(sl)
}

func (sl BigIntSlice) Less(i, j int) bool {
	return sl[i].Cmp(sl[j]) == -1
}

func (sl BigIntSlice) Swap(i, j int) {
	sl[i], sl[j] = sl[j], sl[i]
}

// --------------------------------------------------------------------------------
// Mint

const (
	Mod = 1000000007
)

type Mint int

func NewMint(value int) Mint {
	return Mint((value%Mod + Mod) % Mod)
}

func (x Mint) Add(y Mint) Mint {
	if v := x + y; v >= Mod {
		return v - Mod
	} else {
		return v
	}
}

func (x Mint) Sub(y Mint) Mint {
	if v := x + Mod - y; v >= Mod {
		return v - Mod
	} else {
		return v
	}
}

func (x Mint) Mul(y Mint) Mint {
	return (x * y) % Mod
}

func (x Mint) pow(n int) Mint {
	if n == 0 {
		return Mint(1)
	}
	a := x.pow(n >> 1)
	a = a.Mul(a)
	if n&1 != 0 {
		a = a.Mul(x)
	}
	return a
}

func (x Mint) Inverse() Mint {
	return x.pow(Mod - 2)
}

func (x Mint) Div(y Mint) Mint {
	return x * y.Inverse()
}

func (x Mint) Neg() Mint {
	return NewMint(int(-x))
}

// --------------------------------------------------------------------------------
// Factorial

type Factorial struct {
	fact        []Mint
	factInverse []Mint
}

func NewFactorial(n int) *Factorial {
	f := new(Factorial)
	f.init(n)
	return f
}

func (f *Factorial) init(n int) {
	fact := make([]Mint, n+1, n+1)
	fact[0] = NewMint(1)
	for i := 1; i <= n; i++ {
		fact[i] = fact[i-1].Mul(NewMint(i))
	}

	inv := make([]Mint, n+1, n+1)
	inv[n] = fact[n].Inverse()
	for i := n; i >= 1; i-- {
		inv[i-1] = inv[i].Mul(NewMint(i))
	}

	f.fact = fact
	f.factInverse = inv
}

func (f *Fa

C++: #include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

class FastIO {
    static const int BUF_SIZE = 1<<17;
    char inBuf[BUF_SIZE + 2];
    char *in, *inEnd = inBuf + BUF_SIZE;
    char outBuf[BUF_SIZE + 2];
    char *out, *outEnd = outBuf + BUF_SIZE;

    // stdinからBUFFER_SIZE分まで一気に読み込み、読み込んだサイズを返す
    size_t Load() {
        in = inBuf;
        size_t size = fread(inBuf, 1, BUF_SIZE, stdin);
        inBuf[size] = '\0';
        return size;
    }

    // lenの長さの文字列を出力した場合にバッファを超過するなら、バッファをリセットする
    void FlushIfNeed(int len) {
        if (out + len > outEnd) flush();
    }
    // lenの長さの文字列を入力した場合にバッファを超過するなら、バッファをリロードする
    void LoadIfNeed(int len) {
        if (in + len <= inEnd) return;

        unsigned long rest_size = inEnd - in;
        memcpy(inBuf, in, rest_size);
        size_t size = fread(inBuf + rest_size, 1, BUF_SIZE - rest_size, stdin);
        inBuf[rest_size + size] = '\0';
        in = inBuf;
    }

    char GetChar() {
        if (*in == '\0') {
            // これ以上読み込みできなかった場合はとりあえず0を返しておく
            if (Load() == 0) return 0;
        }
        return *in++;
    }
    void PutChar(char c) {
        FlushIfNeed(1);
        *out++ = c;
    }

    // 0以上の整数向けのscan
    template<typename T>
    void ScanNatural(T &x) {
        x = 0;

        // 数字が出てくるまでスキップ
        char c = GetChar();
        while(!isdigit(c)) c = GetChar();

        // 数値に変換
        LoadIfNeed(21);
        x = c&15;
        for (c = *in++; isdigit(c); c = *in++) {
            // c = '0'~'9' = 48~57 のとき、 c & 15 = c - '0'
            x = x * 10 + (c&15);
        }
    }
    // 負数を考慮する整数値scan
    template<typename T>
    void ScanInteger(T &x) {
        x = 0;

        // -記号か数字が出てくるまでスキップ
        char c = GetChar();
        while (c != '-' && !isdigit(c)) c = GetChar();

        // -記号の処理
        bool minus = c == '-';
        if (minus) c = GetChar();

        LoadIfNeed(21);
        x = c&15;
        for (c = *in++; isdigit(c); c = *in++) {
            x = x * 10 + (c&15);
        }
        if (minus) x = -x;
    }

    // 長さの分かっている文字列の出力(lenはBUFFER_SIZE以下)
    void PrintString(const char *s, size_t len) {
        char *new_out_pos = out + len;
        if (new_out_pos > outEnd) {
            flush();
            new_out_pos = out + len;
        }
        memcpy(out, s, len);
        out = new_out_pos;
    }
    // 非負整数値の出力
    template<typename T>
    void PrintNatural(T x) {
        char digit[21], *d_start, *d_end;
        d_start = d_end = digit + 21;
        // x = 0 の場合も0を出力する必要があるので、do whileで最低1桁は処理する
        do {
            // 上の桁に向かって処理していくので、表示順序と逆になる
            --d_start;
            *d_start = x % 10 + '0';
            x /= 10;
        } while (x != 0);

        // 出力
        PrintString(d_start, d_end - d_start);
    }
    // 整数値の出力
    template<typename T>
    void PrintInteger(T x) {
        if (x < 0) {
            PutChar('-');
            x = -x;
        }
        PrintNatural(x);
    }

public:
    // 出力バッファの中身をstdoutに流し出し、出力バッファをリセットする
    void flush() {
        fwrite(outBuf, out - outBuf, 1, stdout);
        out = outBuf;
    }

    FastIO() {
        in = inEnd;
        out = outBuf;
    }
    ~FastIO() {flush();}

    void scan(std::string &s) {
        char c = GetChar();
        while (!isprint(c)) c = GetChar();

        s.clear();
        for (; isprint(c); c = GetChar()) {
            s.push_back(c);
        }
    }
    void scan(ll &x) {ScanInteger(x);}
    void scan(int &x) {ScanInteger(x);}
    void scan(ull &x) {ScanNatural(x);}
    void scan(uint &x) {ScanNatural(x);}
    template<typename First, typename ... Ints>
    void scan(First &arg, Ints&... rest) {
        scan(arg);
        scan(rest...);
    }

    void print(const char *s) {
        size_t len = strlen(s);

        // バッファサイズより大きい文字列を出力しようとした場合は、stdoutにそのまま流す
        if (len > BUF_SIZE) {
            flush();
            printf("%s", s);
            return;
        }

        PrintString(s, len);
    }
    void print(std::string &s) {PrintString(s.c_str(), s.size());}
    void print(char c) {PutChar(c);}
    void print(int x) {PrintInteger(x);}
    void print(ll x) {PrintInteger(x);}
    void print(uint x) {PrintNatural(x);}
    void print(ull x) {PrintNatural(x);}
    template <class T>
    void print(std::vector<T> &v) {
        if (v.size() == 0) return;
        print(*v.begin());
        for (auto it = ++v.begin(); it != v.end(); ++it) {
            PutChar(' ');
            print(*it);
        }
    }
    template <class T>
    void print(std::vector< std::vector<T> > &grid) {
        if (grid.size() == 0) return;
        print(*grid.begin());
        for (auto it = ++grid.begin(); it != grid.end(); ++it) {
            PutChar('\n');
            print(*it);
        }
    }
    template<typename First, typename ... Ints>
    void print(First arg, Ints... rest) {
        print(arg);
        PutChar(' ');
        print(rest...);
    }
    template <typename T>
    void printl(T t) {
        print(t);
        PutChar('\n');
    }
    template <typename First, typename ... Ints>
    void printl(First arg, Ints... rest) {
        print(arg);
        PutChar(' ');
        printl(rest...);
    }

    void SayYes() {PrintString("Yes\n", 4);}
    void SayNo() {PrintString("No\n", 3);}
} io;


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}


int abs(int a) {
    return a < 0 ? -a : a;
}

vector<ll> dp(31, 0);

ll solve(int n) {
    if (dp[n] == 0) {
        dp[n] = solve(n-3) + solve(n-2) + solve(n-1);
    }
    return dp[n];
}

int main() {
    dp[0] = 1;
    dp[1] = dp[0];
    dp[2] = dp[0] + dp[1];

    while (true) {
        int n; io.scan(n);
        if (n == 0) break;
        
        io.printl((solve(n) + 3649)/3650);
    }
    
    return 0;
}