@_=([1,0,0],[0,1,0],[1,1,1]); //,push@_,[map+($_[$'-$_][$_-2]+$_[$'-$_][$_-3])%($m=1e9+7),1..3]for 3..($N=<>-1); print eval(join'+',@{$_[$N]})%$m