#!/bin/bash # yukicoder My Practice # author: Leonardone @ NEETSDKASU # 解説読後 # http://yukicoder.me/problems/882/editorial typeset -i n a b c t mapfile -t n a=0 b=1 c=0 for ((n=$n-1;$n;n--)); do { t=$(((b+c) % 1000000007)); c=$b; b=$a; a=$t; }; done; t=$(((a+b+c) % 1000000007)) echo $t