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