import java.util.Scanner;
import com.sun.org.apache.bcel.internal.generic.IREM;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
if (n==1) {
System.out.println(1);
}else if (n==2) {
System.out.println(2);
}else if (n==3) {
System.out.println(4);
}else {
long []array = new long[n+1];
array[1]=1;
array[2]=2;
array[3]=4;
for (int i = 4; i <= n; i++) {
array[i]=(array[i-1]+array[i-2]+array[i-3])%1000000007;
}
}
}
}