#include <algorithm>
#include <cmath>
#include <iostream>
#include <stack>

class steps
{
public:
    steps(const std::size_t l)
        :walk_limit_(l), walk_size_(), permutation_size_()
    {
        for(std::size_t i = 0; i < walk_limit_; ++i)
        {
            this->push(1);
        }
    };

    void step()
    {
        while(!this->done())
        {
            this->next();
        }
    }

    std::size_t permutation()const
    {
        return permutation_size_;
    }

private:
    void next()
    {
        if(this->formed())
        {
            ++permutation_size_;
            this->inc();
        }
        else if(this->overflow())
        {
            this->pop();
            this->inc();
        }
        else
        {
            this->push(1);
        }
    }

    void inc()
    {
        if(current_pattern_.empty()){return;}
        if(3 == this->top())
        {
            this->pop();
            if(current_pattern_.empty()){return;}
            this->inc();
        }
        else
        {
            ++this->top();
            ++walk_size_;
        }
    }
    
    void push(const std::size_t p)
    {
        walk_size_ += p;
        current_pattern_.push(p);
    }

    void pop()
    {
        walk_size_ -= current_pattern_.top();
        current_pattern_.pop();
    }

    std::size_t& top()
    {
        return current_pattern_.top();
    }

    bool formed()const
    {
        return walk_limit_ == walk_size_;
    }

    bool overflow()const
    {
        return walk_limit_ < walk_size_;
    }

    bool done()const
    {
        return current_pattern_.empty();
    }

    std::stack<std::size_t> current_pattern_;
    std::size_t walk_limit_;
    std::size_t walk_size_;
    std::size_t permutation_size_;
};

std::size_t permutation(const std::size_t limit)
{
    steps s(limit);
    s.step();
    return s.permutation();
}

std::size_t year(const std::size_t perm)
{
    return std::ceil(static_cast<double>(perm) / 10.0 / 365.0);
}

int main()
{
    for(std::size_t n; std::cin >> n, n != 0;)
    {
        std::cout << year(permutation(n)) << std::endl;
    }
}