gets vv = gets.split.map(&:to_i) puts Enumerator.produce(vv){|r| raise StopIteration if r.size == 1 r.each_cons(2).map { _1.sum } }.to_a[-1][0] % (10**9+7)