using System;
using System.Collections.Generic;
class Program
{
static string InputPattern = "Input1";
static List<string> GetInputList()
{
var WillReturn = new List<string>();
if (InputPattern == "Input1") {
WillReturn.Add("2");
//1
//1回のjumpで2stepする方法しかありません。
//1step+1stepという連続した同step数のjumpは行う事が出来ません。
}
else if (InputPattern == "Input2") {
WillReturn.Add("4");
//3
//(1,2,1),(3,1),(1,3)の3通りです
}
else if (InputPattern == "Input3") {
WillReturn.Add("49993");
//407466683
}
else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
}
return WillReturn;
}
static void Main()
{
const int Hou = 1000000007;
List<string> InputList = GetInputList();
int N = int.Parse(InputList[0]);
//場合の数[現在位置,前のStep数]なDP表
int[,] DPArr = new int[N + 1, 4];
DPArr[0, 0] = 1;
for (int I = 0; I <= N; I++) {
for (int J = 0; J <= 3; J++) {
if (DPArr[I, J] == 0) continue;
//歩数の候補
var HosuuList = new List<int>() { 1, 2, 3 };
HosuuList.Remove(J);
foreach (int EachHosuu in HosuuList) {
int NewI = I + EachHosuu;
if (NewI > N) break;
int NewJ = EachHosuu;
DPArr[NewI, NewJ] += DPArr[I, J];
DPArr[NewI, NewJ] %= Hou;
}
}
}
int Answer = 0;
for (int J = 1; J <= 3; J++) {
Answer += DPArr[N, J];
Answer %= Hou;
}
Console.WriteLine(Answer);
}
}