import math n = int(input()) shelves = [list(map(int, input().split())) for _ in range(n)] total_valves = 0 for i in range(1, n + 1): total_valves += i * ((i + 1) // 2) result = total_valves % (10**9 + 7) print(result)
1 2 3 4 5 6 7 8 | import math n = int(input()) shelves = [list(map(int, input().split())) for _ in range(n)] total_valves = 0 for i in range(1, n + 1): total_valves += i * ((i + 1) // 2) result = total_valves % (10**9 + 7) print(result) |