N = int(eval(input()))

A = list(map(int, input().split()))



K = sum(A) / sum(range(1, N+1))

D = [A[i+1] - A[i] - K for i in range(-1, N-1)]

for d in D:

    if not (d <= 0 and d % N == 0):

        print("NO")

        break

else:

    print("YES")
N = int(eval(input()))

A = list(map(int, input().split()))





# 毎回1+2+...+N個の石が取り除かれる

Sum = sum(A)

if Sum % (N * (N + 1) // 2) != 0:

    print('NO')

    exit()





# 操作回数

K = Sum // (N * (N + 1) // 2)



Diff = [A[i] - A[(i - 1)] for i in range(N)]

# 変化量-1が(N-1)箇所、+(N-1)が一か所を、すべて-1した後に、一か所+1と置き換える

Diff = [d - K for d in Diff]



for d in Diff:

    if d < 0:

        if d % N != 0:

            print('NO')

            exit()

        else:

            K -= abs(d // N)



if K == 0:

    print('YES')

else:

    print('NO')

N = int(eval(input()))
A = list(map(int, input().split()))
K = sum(A) / sum(range(1, N + 1))
D = [A[i + 1] - A[i] - K for i in range(-1, N - 1)]
for d in D:
    if not (d <= 0 and d % N == 0):
        print("NO")
        break
else:
    print("YES")

N = int(eval(input()))
A = list(map(int, input().split()))
# 毎回1+2+...+N個の石が取り除かれる
Sum = sum(A)
if Sum % (N * (N + 1) // 2) != 0:
    print("NO")
    exit()
# 操作回数
K = Sum // (N * (N + 1) // 2)
Diff = [A[i] - A[(i - 1)] for i in range(N)]
# 変化量-1が(N-1)箇所、+(N-1)が一か所を、すべて-1した後に、一か所+1と置き換える
Diff = [d - K for d in Diff]
for d in Diff:
    if d < 0:
        if d % N != 0:
            print("NO")
            exit()
        else:
            K -= abs(d // N)
if K == 0:
    print("YES")
else:
    print("NO")

-K = sum(A) / sum(range(1, N + 1)) -D = [A[i + 1] - A[i] - K for i in range(-1, N - 1)] -for d in D: -    if not (d <= 0 and d % N == 0): -        print("NO") -        break +# 毎回1+2+...+N個の石が取り除かれる +Sum = sum(A) +if Sum % (N * (N + 1) // 2) != 0: +    print("NO") +    exit() +# 操作回数 +K = Sum // (N * (N + 1) // 2) +Diff = [A[i] - A[(i - 1)] for i in range(N)] +# 変化量-1が(N-1)箇所、+(N-1)が一か所を、すべて-1した後に、一か所+1と置き換える +Diff = [d - K for d in Diff] +for d in Diff: +    if d < 0: +        if d % N != 0: +            print("NO") +            exit() +        else: +            K -= abs(d // N) +if K == 0: +    print("YES") -    print("YES") +    print("NO")