# 無駄な「% D」があったので修正。 N = gets.to_i D = 10 ** 9 + 7 a, b, c = 1, 0, 0 (N-1).times do a, b, c = c, a, (a + b) % D end puts (a + b + c) % D