using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static string InputPattern = "InputX";
static List<string> GetInputList()
{
var WillReturn = new List<string>();
if (InputPattern == "Input1") {
WillReturn.Add("10");
WillReturn.Add("1 1 1 1 1 1 1 1 1 1");
//Yes
}
else if (InputPattern == "Input2") {
WillReturn.Add("3");
WillReturn.Add("1 1 1");
//No
}
else if (InputPattern == "Input3") {
WillReturn.Add("3");
WillReturn.Add("1 18 1");
//Yes
}
else if (InputPattern == "Input4") {
WillReturn.Add("4");
WillReturn.Add("1 9 1 9");
//No
}
else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
}
return WillReturn;
}
static void Main()
{
List<string> InputList = GetInputList();
long[] AArr1 = InputList[1].Split(' ').Select(pX => long.Parse(pX)).ToArray();
long AArr1Len = AArr1.Length;
long SumVal = AArr1.Sum();
if (SumVal % 10 > 0) {
Console.WriteLine("No");
return;
}
long AnswerSum = SumVal / 10;
var AList2 = new List<long>();
AList2.AddRange(AArr1);
AList2.AddRange(AArr1);
long[] AArr2 = AList2.ToArray();
long AArr2Len = AArr2.Length;
var Ins_Fenwick_Tree = new Fenwick_Tree(AArr2Len);
for (long I = 0; I <= AArr2.GetUpperBound(0); I++) {
Ins_Fenwick_Tree.Add(I, AArr2[I]);
}
// 始点を全探索
for (long I = 0; I <= AArr1.GetUpperBound(0); I++) {
// 終点を二分探索
long L = I;
long R = I + AArr1Len - 1;
long RangeSum1 = Ins_Fenwick_Tree.GetSum(I, L);
long RangeSum2 = Ins_Fenwick_Tree.GetSum(I, R);
// 特殊ケース1
if (RangeSum1 >= AnswerSum) {
if (RangeSum1 == AnswerSum) {
Console.WriteLine("Yes");
return;
}
else {
continue;
}
}
// 特殊ケース2
if (RangeSum2 < AnswerSum) {
continue;
}
while (L + 1 < R) {
long Mid = (L + R) / 2;
long RangeSum3 = Ins_Fenwick_Tree.GetSum(I, Mid);
if (AnswerSum <= RangeSum3) {
R = Mid;
}
else {
L = Mid;
}
}
long RangeSum4 = Ins_Fenwick_Tree.GetSum(I, R);
if (RangeSum4 == AnswerSum) {
Console.WriteLine("Yes");
return;
}
}
Console.WriteLine("No");
}
}
// フェニック木
#region Fenwick_Tree
internal class Fenwick_Tree
{
private long[] mBitArr;
private long mExternalArrUB;
// コンストラクタ
internal Fenwick_Tree(long pExternalArrUB)
{
mExternalArrUB = pExternalArrUB;
// フェニック木の外部配列は0オリジンで、
// フェニック木の内部配列は1オリジンなため、2を足す
mBitArr = new long[pExternalArrUB + 2];
}
// [pSta,pEnd] のSumを返す
internal long GetSum(long pSta, long pEnd)
{
return GetSum(pEnd) - GetSum(pSta - 1);
}
// [0,pEnd] のSumを返す
internal long GetSum(long pEnd)
{
pEnd++; // 1オリジンに変更
long Sum = 0;
while (pEnd >= 1) {
Sum += mBitArr[pEnd];
pEnd -= pEnd & -pEnd;
}
return Sum;
}
// [I] に Xを加算
internal void Add(long pI, long pX)
{
pI++; // 1オリジンに変更
while (pI <= mBitArr.GetUpperBound(0)) {
mBitArr[pI] += pX;
pI += pI & -pI;
}
}
}
#endregion