M=10**9+7 d=Array.new(4+N=gets.to_i){[0]*4} d[1][1]=d[2][2]=d[3][3]=1 N.times{|i|1.upto(3){|j|d[i+j][j]+=(d[i].sum-d[i][j])%M}} p d[N].sum%M