use bigint; $n=0+<>; if($n==1){ print 2; }elsif($n&1){ $n%=1000000006; system "dc -e'5 $n 2/1- 1000000007 | 12* 1000000007%p'"; }else{ $n%=1000000006; system "dc -e'5 $n 2/1- 1000000007 | 4* 1000000007%p'"; }