const MOD = 1_0000_0000_7 proc scanf(formatstr: cstring){.header: "", varargs.} var n:int scanf("%ld\n",addr n) var res = 0 for _ in 0.. MOD : c = c mod MOD if d > MOD : d = d mod MOD res += c * d if res > MOD: res = res mod MOD echo res