import scala.annotation.tailrec
import scala.collection.mutable
import scala.io.StdIn._
object Main extends App {
  val memo = Array.fill(31){-1L}
  loop()
  @tailrec def loop(): Unit = {
    val n = readInt()
    if (n == 0) return
    println(((solve(n) + 9) / 10 + 364) / 365)
    loop()
  }
  def solve(n: Int): Long = {
    if (n < 0) {
      0
    } else if (n == 0) {
      1
    } else {
      if (memo(n) < 0) {
        memo(n) = solve(n - 1) + solve(n - 2) + solve(n - 3)
      }
      memo(n)
    }
  }
}

