Scanf.scanf "%d" (fun n ->
    let z = 1_000_000_007 in
    let ( +@) a b = (a + b) mod z in

    let dp = Array.make 2001 (-1) in
    dp.(0) <- 0;
    dp.(1) <- 0;
    dp.(2) <- 0;
    
    let rec calc q =
        if dp.(q) >= 0 then dp.(q) else (
            let rec loop i acc =
                if i > q then acc else
                    loop (i + 1) (acc +@ calc (q - i))
            in
            let r = loop 3 1 in
            dp.(q) <- r;
            r
        )
    in
    calc n |> Printf.printf "%d\n"
)