main = do
    getLine
    putStrLn.show.solve.map (read :: String -> Integer).words=<<getLine

solve a = mod (mainFor a 0 1) 1000000007

mainFor a i j = if i >= length a - 1 then 0 else if j >= length a then mainFor a (i+1) (i+2) else a!!i * a!!j + mainFor a i (j+1)