fun main() { val mod=1000000007 val n = readLine()!!.toInt() val A = IntArray(n) for (i in 0..n-1){ val x = readLine()!!.toInt() if (x