Загрузка данных


n = int(input())
MOD = 1000000000000947286
res = (n * n + 3) // 12
print(res % MOD)