There are N boxes arranged in a circle. The i-th box contains A_i stones.

Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:

* Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.



Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.

Constraints

* 1 ≦ N ≦ 10^5
* 1 ≦ A_i ≦ 10^9

Input

The input is given from Standard Input in the following format:


N
A_1 A_2 … A_N


Output

If it is possible to remove all the stones from the boxes, print `YES`. Otherwise, print `NO`.

Examples

Input

5
4 5 1 2 3


Output

YES


Input

5
6 9 12 10 8


Output

YES


Input

4
1 2 3 1


Output

NO
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res

def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n = I()
    a = LI()
    s = 0
    for i in a:
        s ^= (i%2)
    if s:
        print("NO")
    else:
        print("YES")
    return

#B
def B():
    n = I()
    a = LI()
    m = n*(n+1)>>1
    s = sum(a)
    if s%m:
        print("NO")
        return
    k = s//m
    b = [k+a[i-1]-a[i] for i in range(n)]
    s = 0
    for i in b:
        if i%n or i < 0:
            print("NO")
            return
        s += i//n
    if s == k:
        print("YES")
    else:
        print("NO")
    return

#C
def C():
    n = I()

    return

#D
def D():
    n = I()

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return

#Solve
if __name__ == "__main__":
    B()
