n = int(eval(input()))

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



s = sum(a)

one = n * (n+1) // 2

if s % one:

    print('NO')

    exit()

times = s // one



cnt = 0

b = a[1:]+[a[0]]

for i,j in zip(a,b):

    dif = j - i

    if (times - dif) % n:

        print('NO')

        exit()

    if (times-dif) // n < 0:

        print('NO')

        exit()

    cnt += (times-dif) // n

if times != cnt:

    print('NO')

else:

    print('YES')

N = int(eval(input()))

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



def solve():

    q = N * (N + 1) // 2

    if sum(A) % q:

        return False

    times = sum(A) // q

    cnt = 0

    for i, j in zip(A, A[1:] + [A[0]]):

        dif = times + i - j

        if dif % N or dif < 0:

            return False

        cnt += dif // N

    return times == cnt



print(('YES' if solve() else 'NO'))

n = int(eval(input()))
a = list(map(int, input().split()))
s = sum(a)
one = n * (n + 1) // 2
if s % one:
    print("NO")
    exit()
times = s // one
cnt = 0
b = a[1:] + [a[0]]
for i, j in zip(a, b):
    dif = j - i
    if (times - dif) % n:
        print("NO")
        exit()
    if (times - dif) // n < 0:
        print("NO")
        exit()
    cnt += (times - dif) // n
if times != cnt:
    print("NO")
else:
    print("YES")

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


def solve():
    q = N * (N + 1) // 2
    if sum(A) % q:
        return False
    times = sum(A) // q
    cnt = 0
    for i, j in zip(A, A[1:] + [A[0]]):
        dif = times + i - j
        if dif % N or dif < 0:
            return False
        cnt += dif // N
    return times == cnt


print(("YES" if solve() else "NO"))

-n = int(eval(input())) -a = list(map(int, input().split())) -s = sum(a) -one = n * (n + 1) // 2 -if s % one: -    print("NO") -    exit() -times = s // one -cnt = 0 -b = a[1:] + [a[0]] -for i, j in zip(a, b): -    dif = j - i -    if (times - dif) % n: -        print("NO") -        exit() -    if (times - dif) // n < 0: -        print("NO") -        exit() -    cnt += (times - dif) // n -if times != cnt: -    print("NO") -else: -    print("YES") +N = int(eval(input())) +A = list(map(int, input().split())) + + +def solve(): +    q = N * (N + 1) // 2 +    if sum(A) % q: +        return False +    times = sum(A) // q +    cnt = 0 +    for i, j in zip(A, A[1:] + [A[0]]): +        dif = times + i - j +        if dif % N or dif < 0: +            return False +        cnt += dif // N +    return times == cnt + + +print(("YES" if solve() else "NO"))