Recently Vasya found a golden ticket — a sequence which consists of $n$ digits $a_1a_2\dots a_n$. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments with equal sums. For example, ticket $350178$ is lucky since it can be divided into three segments $350$, $17$ and $8$: $3+5+0=1+7=8$. Note that each digit of sequence should belong to exactly one segment.

Help Vasya! Tell him if the golden ticket he found is lucky or not.


-----Input-----

The first line contains one integer $n$ ($2 \le n \le 100$) — the number of digits in the ticket.

The second line contains $n$ digits $a_1 a_2 \dots a_n$ ($0 \le a_i \le 9$) — the golden ticket. Digits are printed without spaces.


-----Output-----

If the golden ticket is lucky then print "YES", otherwise print "NO" (both case insensitive).


-----Examples-----
Input
5
73452

Output
YES

Input
4
1248

Output
NO



-----Note-----

In the first example the ticket can be divided into $7$, $34$ and $52$: $7=3+4=5+2$.

In the second example it is impossible to divide ticket into segments with equal sum.

Difficulty: EASY

Solutions:
from os import path
import sys, time
from math import ceil, floor, gcd, log, log2, factorial
from collections import *
maxx = float('inf')
I = lambda : int(sys.stdin.buffer.readline())
tup = lambda : map(int, sys.stdin.buffer.readline().split())
lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
S = lambda : sys.stdin.readline().replace('\n', '').strip()

def grid(r, c):
	return [lint() for i in range(r)]
stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
localsys = 0
start_time = time.time()
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
n = I()
ls = [int(i) for i in S()]
(pre, s) = ([], 0)
for i in ls:
	s += i
	pre.append(s)
for i in range(n - 1):
	cnt = 0
	su = 0
	for j in range(i + 1, n):
		su += ls[j]
		if su == pre[i]:
			cnt += 1
			su = 0
	if cnt and su == 0:
		print('YES')
		exit()
print('NO')
if localsys:
	print('\n\nTime Elased :', time.time() - start_time, 'seconds')


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : list(input())
ips = lambda : input().split()
t = ii()
n = ip()
s = 0
for i in n:
	s += int(i)
a = set()
for i in range(2, int(math.sqrt(s)) + 1):
	if s % i == 0:
		a.add(i)
		if i != s // i:
			a.add(s // i)
a.add(1)
a.add(0)
f = 0
for i in a:
	k = 0
	w = 0
	flag = 1
	for j in range(t):
		k += int(n[j])
		if k > i:
			flag = 0
			break
		elif k == i:
			w += 1
			k = 0
	if k > 0 or w < 2:
		flag = 0
	if flag:
		f = 1
		break
if f:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(input())
for i in range(n):
	a[i] = int(a[i])
c = 0
s = 0
for i in range(0, n):
	s = sum(a[:i + 1])
	d = i + 1
	c = 0
	su = 0
	while d < n and su <= s:
		su += a[d]
		d += 1
		if su == s:
			su = 0
			c += 1
	if d >= n and c > 0 and (su == 0):
		print('YES')
		exit()
print('NO')


n = int(input())
s = list(map(int, list(input())))
sm = sum(s)
if sum(s) == 0:
	print('YES')
	exit()
for j in range(1, 901):
	if j >= sm:
		break
	if sm % j != 0:
		continue
	ok = 0
	f = 0
	cur_sm = 0
	for k in range(len(s)):
		cur_sm += s[k]
		if cur_sm > j:
			k -= 1
			break
		elif cur_sm == j:
			cur_sm = 0
	if k == len(s) - 1:
		print('YES')
		exit()
print('NO')


def isdiv(arr, i):
	it = 0
	su = 0
	while it < len(arr):
		su += arr[it]
		if su > i:
			return False
		if su == i:
			su = 0
		it += 1
	return True
l = int(input())
arr = list(map(int, list(input())))
divisible = False
total = sum(arr)
for i in range(1, int(total / 2) + 1):
	if total % i == 0:
		divisible = isdiv(arr, i)
		if divisible:
			break
if divisible or all([v == 0 for v in arr]):
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().rstrip()))
sm = sum(a)
ans = False
for cnt in range(2, n + 1):
	if sm % cnt != 0:
		continue
	seq_sum = sm // cnt
	cur_sum = 0
	ans = True
	for i in range(n):
		cur_sum += a[i]
		if cur_sum == seq_sum:
			cur_sum = 0
		if cur_sum > seq_sum:
			ans = False
			break
	if ans:
		break
print('YES' if ans else 'NO')


n = int(input())
a = list(map(int, list(input())))
OK = False
if a == [0 for _ in range(n)]:
	OK = True
else:
	s = sum(a)
	for i in range(1, s):
		if s % i == 0:
			(c, j) = (0, 0)
			while c < i and j < n:
				c += a[j]
				if c == i:
					c = 0
				j += 1
			if c > i:
				continue
			if j == n:
				OK = True
print('YES' if OK else 'NO')


n = int(input())
d = input()
d = d.strip('0')
n = len(d)
s = 0
for i in range(n - 1):
	s += int(d[i])
	c = 0
	f = 0
	for j in range(i + 1, n):
		c += int(d[j])
		if j == n - 1:
			if c == s:
				f = 0
			else:
				f = 1
			break
		if c == s:
			c = 0
			continue
		elif c > s:
			f = 1
			break
	if f == 0:
		print('YES')
		break
else:
	if d.count('0') == n:
		print('YES')
	else:
		print('NO')


b = int(input())
a = input()
kek = 0
for i in range(len(a)):
	kek += int(a[i])
flag = False
for i in range(2, len(a) + 1):
	if kek % i == 0:
		m = 0
		z = kek // i
		k = 0
		flag1 = True
		for j in range(i):
			while m < z and k < len(a):
				m += int(a[k])
				k += 1
			if m != z:
				flag1 = False
				break
			m = 0
		if flag1 == True:
			flag = True
if flag == False:
	print('NO')
else:
	print('YES')


n = int(input())
arr = list(map(int, list(input())))
num = sum(arr)
if num == 0:
	print('YES')
	exit()
for i in range(n - 1):
	s = sum(arr[:i + 1])
	if s == 0:
		continue
	if num % s == 0 and s != num:
		temp = 0
		for j in range(i + 1, n):
			if temp < s:
				temp += arr[j]
				if temp == s:
					temp = 0
				elif temp > s:
					break
		else:
			print('YES')
			exit()
print('NO')


n = int(input())
s = input()
a = [int(i) for i in s]
m = sum(a)
for i in range(2, n + 1):
	if m % i == 0:
		k = m // i
		summ = 0
		cnt = 0
		for i in range(n):
			summ += a[i]
			if summ == k:
				cnt += 1
				summ = 0
		if k * cnt == m:
			print('YES')
			exit(0)
print('NO')


def yesorno(a, k):
	if k == 0:
		return 'YES'
	for i in range(1, int(k ** 0.5) + 1):
		if k % i == 0:
			(x, c) = (i, 0)
			for j in a:
				x -= int(j)
				if x == 0:
					x = i
					c += 1
				elif x < 0:
					c = 0
					break
			if c >= 2:
				return 'YES'
			(x, c) = (k // i, 0)
			for j in a:
				x -= int(j)
				if x == 0:
					x = k // i
					c += 1
				elif x < 0:
					c = 0
					break
			if c >= 2:
				return 'YES'
	return 'NO'
n = int(input())
a = str(input())
k = 0
for i in a:
	k += int(i)
print(yesorno(a, k))


n = int(input())
c = input()
p = [int(c[0])]

def s(l, r):
	return p[r] - p[l - 1]
for i in range(n - 1):
	p.append(p[i] + int(c[i + 1]))
for j in range(n - 1):
	l = j + 1
	b = False
	for r in range(j + 1, n):
		if s(l, r) == p[j]:
			l = r + 1
			b = True
	if l == n or (s(l, n - 1) == 0 and b):
		print('YES')
		break
else:
	print('NO')


n = int(input())
a = input()
s = []
f = 0
for i in range(n):
	s.append(int(a[i]))
xx = sum(s)
for i in range(1001):
	cur = 0
	it = 0
	for j in range(n):
		cur += s[j]
		if cur == i:
			it += 1
			cur = 0
	if cur == 0 and it > 1:
		f = 1
		break
if f == 1:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	a = list(map(int, list(input())))
	ps = [a[0]] * n
	for i in range(1, n):
		ps[i] = ps[i - 1] + a[i]
	(d, c) = ([], 1)
	while c * c <= ps[-1]:
		if not ps[-1] % c:
			d.append(c)
			if c * c != ps[-1] and c != 1:
				d.append(ps[-1] // c)
		c += 1
	if not ps[-1]:
		print('YES')
		exit()
	for i in d:
		(idx, t) = (0, 0)
		for j in range(1, ps[-1] // i + 1):
			while ps[idx] < i * j:
				idx += 1
			if ps[idx] != i * j:
				break
			t += 1
		else:
			if 1 < t:
				print('YES')
				exit()
	print('NO')
main()


n = int(input())
s = input().split('0')
s = ''.join(s)
ch = False
if s == '':
	print('YES')
	ch = True

def su(inp):
	inp = [int(i) for i in inp]
	inp = sum(inp)
	return inp
for i in range(0, len(s) - 1):
	num = su(s[:i + 1])
	(x, y) = (i + 1, i + 1)
	while y < len(s):
		su1 = su(s[x:y + 1])
		if su1 == num:
			if y == len(s) - 1:
				ch = True
			(x, y) = (y + 1, y + 1)
		if su1 < num:
			y += 1
		if su1 > num:
			break
	if ch:
		print('YES')
		break
if not ch:
	print('NO')


def check(i, b):
	o = 0
	for j in range(i + 1, n + 1):
		if i == 0 and (a[n] == a[j] - a[i] == 0 or (a[j] - a[i] > 0 and a[n] % (a[j] - a[i])) == 0) or a[j] - a[i] == b:
			if n == j:
				o = max(o, i)
				break
			elif i:
				o = max(o, check(j, b))
			else:
				o = max(o, check(j, a[j] - a[i]))
	return o
n = int(input())
a = [0]
for i in input():
	a += [a[-1] + int(i)]
if check(0, -1):
	print('YES')
else:
	print('NO')


n = int(input())
m = input()
s0 = 0
for i in range(n - 1):
	s = 0
	s0 += int(m[i])
	k = i + 1
	x = 0
	while s < s0 and k <= len(m) - 1:
		s += int(m[k])
		k += 1
		if s == s0 and k < len(m):
			s = 0
			x = 1
		elif (s == s0 or (s == 0 and x == 1)) and k == len(m):
			s = -1
	if s == -1:
		print('YES')
		break
	elif i == n - 2 and s0 == 0 and (m[-1] == '0'):
		print('YES')
	elif i == n - 2:
		print('NO')


n = int(input())
s = input()
a = [0] * n
for i in range(n):
	a[i] = int(s[i])
s = 0
c = 0
for i in range(450):
	for j in range(len(a)):
		s += a[j]
		if s == i:
			s = 0
			c += 1
	if s == 0 and c > 1:
		print('YES')
		exit()
	s = 0
	c = 0
print('NO')


n = int(input())
s = input()
su = 0
for i in s:
	su += int(i)
tr = 0
if su == 0:
	print('YES')
else:
	for i in range(1, su):
		if su % i == 0:
			t = 0
			x = 1
			for c in s:
				if t + int(c) == i:
					t = 0
				elif t + int(c) > i:
					x = 0
				else:
					t += int(c)
			if x == 1:
				tr = 1
	if tr == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
k = input()
z = 0
i = 0
while i < n:
	z += int(k[i])
	i += 1
if z == 0:
	print('YES')
else:
	y = 1
	q = 0
	while y < z:
		if z % y == 0:
			x = 0
			i = 0
			p = 0
			while i < n:
				x += int(k[i])
				if x > y:
					p = 1
					break
				else:
					if x == y:
						x = 0
					i += 1
			if p == 0:
				q = 1
		y += 1
	if q == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
s = input()
d = [0] * (n + 1)
for i in range(1, n + 1):
	d[i] = d[i - 1] + int(s[i - 1])
for i in range(1, n):
	if d[i] != 0:
		if d[n] / d[i] == d[n] // d[i]:
			dt = d[n] // d[i]
			if dt == 2:
				print('YES')
				break
			cnt = 2
			for j in range(i + 1, n):
				if d[j] == cnt * d[i]:
					cnt += 1
				if cnt == dt:
					break
			if cnt == dt:
				print('YES')
				break
else:
	if sum(d) == 0:
		print('YES')
	else:
		print('NO')


def solve():
	n = int(input())
	l = list(map(int, list(input())))
	divisors = []
	total = sum(l)
	for j in range(2, int(sqrt(total)) + 1):
		if total % j == 0:
			divisors.extend([j, total // j])
	if total == 0:
		print('YES')
		return
	if total != 1:
		divisors.append(1)
	for x in divisors:
		search = x
		index = 0
		summ = 0
		while index < n:
			summ += l[index]
			if summ > search:
				break
			elif summ == search:
				summ = 0
			index += 1
		if summ == 0 and index == n:
			print('YES')
			return
	print('NO')
import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
solve()


_ = input()
a = list(input())
a = list(map(int, a))
n = len(a)
ok = True
for l in range(0, n - 1):
	S = sum(a[0:l + 1])
	ptr = l + 1
	ok = True
	while ptr < n and ok:
		S1 = a[ptr]
		ptr += 1
		while ptr < n and S1 + a[ptr] <= S:
			S1 += a[ptr]
			ptr += 1
		if S1 == S:
			ok = True
		else:
			ok = False
	if ok:
		break
if ok:
	print('YES')
else:
	print('NO')


import sys
from collections import defaultdict, deque
n = int(input())
a = [int(x) for x in input()]
cur = 0
for i in range(0, n - 1):
	cur += a[i]
	ok = True
	j = i + 1
	sm = 0
	while j < n:
		sm = a[j]
		j += 1
		while j < n and sm + a[j] <= cur:
			sm += a[j]
			j += 1
		if sm != cur:
			ok = False
	if ok:
		print('YES')
		exit()
print('NO')


n = int(input())
a = list(map(int, ' '.join(input()).split()))
for i in range(1, n):
	a[i] += a[i - 1]
f = 0
for i in range(n):
	summ = a[i]
	d = a[i]
	c = 1
	for j in range(i + 1, n):
		if a[j] - d == summ:
			c += 1
			d = a[j]
	if d == a[n - 1] and c > 1:
		f = 1
		break
if f == 1:
	print('YES')
else:
	print('NO')


n = int(input())
p = input()
a = []
for i in p:
	a.append(int(i))
for i in range(1, n):
	s = sum(a[0:i])
	s1 = 0
	o = 0
	for j in range(i, n):
		s1 += a[j]
		if s1 == s and j != n - 1 and (a[j + 1] != 0):
			s1 = 0
			o = 0
		elif s1 == s and j != n - 1 and (a[j + 1] == 0):
			continue
		elif s1 == s and j == n - 1:
			o = 0
			s1 = 0
		else:
			o = 1
	if o == 0 and s1 == 0:
		print('YES')
		exit()
print('NO')


import sys
n = int(input())
arr = list(map(int, list(input())))
if n > 1 and sum(arr) == 0:
	print('YES')
	return
arr = [el for el in arr if el != 0]
n = len(arr)
for i in range(1, sum(arr)):
	cur = 0
	cur_sum = 0
	while True:
		while cur < n and cur_sum < i:
			cur_sum += arr[cur]
			cur += 1
		if cur_sum == i:
			cur_sum = 0
		elif cur_sum != i:
			break
		if cur == n:
			print('YES')
			return
print('NO')


from sys import stdin, stdout

def main():
	n = int(stdin.readline())
	s = stdin.readline()
	sum = 0
	a = []
	for v in s:
		if v != '0' and v != '\n':
			a.append(v)
	if not a and n > 1:
		return 'YES'
	n = len(a)
	s = a
	for i in range(n - 1):
		sum += int(s[i])
		j = i + 1
		check = 1
		while j < n:
			temp = int(s[j])
			j += 1
			while j < n:
				if temp >= sum:
					break
				temp += int(s[j])
				j += 1
			if sum != temp:
				check = 1
				break
		if sum != temp:
			check = 0
		if check:
			return 'YES'
	return 'NO'
print(main())


n = int(input())
s = input()
arr = []
sum = 0
for i in s:
	arr.append(int(i))
	sum += int(i)
ok = False
if sum > 0:
	for i in range(2, sum + 1):
		if sum % i == 0:
			sums = 0
			ok = True
			for j in range(n):
				sums += arr[j]
				if sums == sum / i:
					sums = 0
				elif sums > sum / i:
					ok = False
					break
		if ok:
			break
else:
	ok = True
if ok:
	print('YES')
else:
	print('NO')


n = int(input())
a = str(input())
a = [int(i) for i in a]
d = 100000
s = [0] * n
p = 0
z = sum(a)
for i in range(n):
	s[i] = sum(a[:i + 1])
for i in range(n):
	p = 0
	k = i
	j = i + 2
	while j <= n:
		su = sum(a[i + 1:j])
		if su == s[k]:
			p = p + su
			d = su
			i = j - 1
			j = i + 2
		else:
			j = j + 1
	if p + d == z:
		break
if p + d == sum(a):
	print('YES')
else:
	print('NO')


nc = int(input())
c = input()
sc = 0
s = 0
for i in c:
	sc += int(i)
for i in range(2, nc + 1):
	if sc % i == 0:
		s = 0
		for j in c:
			s += int(j)
			if s == sc // i:
				s = 0
			elif s > sc // i:
				break
		if s == 0:
			print('YES')
			exit()
print('NO')


n = int(input())
a = input()
l = -1
p = 0
s = 0
for i in range(n - 1):
	flag = True
	s += int(a[i])
	p = i + 1
	s1 = 0
	while p < n:
		s1 = int(a[p])
		p += 1
		while p < n and s1 + int(a[p]) <= s:
			s1 += int(a[p])
			p += 1
		if s1 != s:
			flag = False
	if s1 != s:
		flag = False
	if flag:
		print('YES')
		exit(0)
print('NO')


n = int(input())
arr = input()
sum = 0
for x in range(n):
	sum += int(arr[x])
ans = 0
for num in range(2, n + 1):
	if sum % num != 0:
		continue
	target = sum / num
	pos = 0
	ok = 1
	for i in range(num):
		cur = 0
		while pos < n and cur < target:
			cur += int(arr[pos])
			pos += 1
		if cur != target:
			ok = 0
			break
	if ok:
		ans = 1
if ans == 1:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
a = []
for i in range(n):
	a.append(int(s[i]))
s = sum(a)
ans = 'NO'
for i in range(2, 1001):
	if s % i != 0:
		continue
	su = s // i
	pos = 0
	ans = 'YES'
	for ii in range(i):
		cur = 0
		while pos < n and cur + a[pos] <= su:
			cur += a[pos]
			pos += 1
		if cur != su:
			ans = 'NO'
	if ans == 'YES':
		break
print(ans)


input()
(f1, m, d, f, c) = (True, 0, [], False, input())
s = sum([int(i) for i in list(c)])
if s == 0:
	print('YES')
else:
	for i in range(2, int(s ** 0.5) + 1):
		if s % i == 0:
			d += [i, s // i]
	d += [1]
	c = [int(i) for i in list(c) if i != '0']
	for i in d:
		L = 0
		for j in c:
			m += j
			if m == i:
				m = 0
				L += 1
			elif m > i:
				f = True
				break
		if f or m != 0 or L <= 1:
			f = False
			m = 0
		else:
			f1 = False
			print('YES')
			break
	if f1:
		print('NO')


n = int(input())
b = input()
m = []
for i in range(n):
	if b[i] != '0':
		m.append(int(b[i]))
deli = []
x = sum(m)
if x == 0:
	print('YES')
elif x == 1:
	print('NO')
else:
	ch = 1
	while x != 1:
		ch += 1
		if x % ch == 0:
			deli.append(ch)
			while x % ch == 0:
				x = x // ch
	f = 0
	p = sum(m)
	for i in range(len(deli)):
		tecs = p // deli[i]
		s = 0
		if f == 1:
			break
		for j in range(len(m)):
			s += m[j]
			if s == tecs:
				s = 0
				if j == len(m) - 1:
					f = 1
			elif s > tecs:
				break
		if f == 1:
			print('YES')
			f = 1
			break
	if f == 0:
		print('NO')


n = int(input())
s = input()
s = [int(i) for i in s]
ans = 0
d = []
for i in s:
	ans += i
	d.append(ans)
flag = 0
for i in range(n - 1):
	k = 1
	ku = 0
	for j in range(i + 1, n):
		ku += s[j]
		if ku == d[i]:
			k += 1
			ku = 0
	if k > 1 and ku == 0:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, list(input())))
for i in range(n - 1):
	sm = sum(a[:i + 1])
	tn = 0
	res = True
	has = False
	for j in range(i + 1, n):
		tn += a[j]
		if tn == sm:
			tn = 0
			has = True
		elif tn > sm:
			res = False
			break
	if tn == 0 and res and has:
		print('YES')
		break
else:
	print('NO')


def check(a, count):
	ks = 0
	for i in range(len(a)):
		ks += a[i]
		if ks > count:
			return False
		elif ks == count:
			ks = 0
	return True
n = int(input())
a = list(map(int, list(input())))
ss = sum(a)
flag = False
for k in range(2, 1000):
	if ss % k == 0:
		if check(a, ss // k):
			flag = True
			break
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
A = []
for i in s:
	A.append(int(i))
ans = False
for cur in range(0, len(A)):
	su = sum(A[:cur + 1])
	i = cur + 1
	cur_s = 0
	z = False
	while i < len(A):
		cur_s += A[i]
		if i == len(A) - 1 and cur_s == su:
			z = True
			break
		if cur_s < su:
			i += 1
		elif cur_s > su:
			break
		else:
			if sum(A[i + 1:]) == 0 and i != n - 1:
				z = True
				break
			i += 1
			cur_s = 0
	if z:
		ans = True
		break
if ans:
	print('YES')
else:
	print('NO')


n = int(input())
c = input()
s = 0
i = 0
while i < n:
	s = s + int(c[i])
	i += 1
g = 2
ok = 0
while g <= n and ok == 0:
	if s % g == 0:
		k = s // g
		i = 0
		sg = 0
		kg = 0
		while i < n:
			sg = sg + int(c[i])
			if sg == k:
				sg = 0
				kg += 1
			elif sg > k:
				break
			i += 1
		if sg == 0 and kg == g:
			ok = 1
	g += 1
if ok == 0:
	print('NO')
else:
	print('YES')


n = int(input())
s = list(filter(lambda o: o != 0, list(map(int, input()))))
yes = False
k = sum(s)
for i in range(len(s) - 1):
	m = sum(s[:i + 1])
	p = 0
	t = 0
	for j in s[i + 1:]:
		p += j
		if p > m:
			break
		elif p == m:
			t += 1
			p = 0
	if (t + 1) * m == k:
		yes = True
		break
if len(s) == 0:
	print('YES')
elif yes:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
summ = 0
for i in range(n):
	summ += int(s[i])
for i in range(2, 101):
	if summ % i == 0:
		d = 0
		for j in range(n):
			d += int(s[j])
			if d * i == summ:
				d = 0
			if d * i > summ:
				break
		if j == n - 1 and d == 0:
			print('YES')
			exit(0)
print('NO')


n = int(input())
a = [int(x) for x in input()]
s = sum(a)
if s == 0:
	if n > 1:
		print('YES')
	else:
		print('NO')
else:
	k = 0
	b = []
	for i in range(n):
		k += a[i]
		if k != 0 and s % k == 0 and (s != k):
			b.append(k)
	ans = 'NO'
	for x in b:
		s1 = 0
		k = 0
		for i in range(n):
			k += a[i]
			if k == x:
				k = 0
				s1 += x
		if s1 == s:
			ans = 'YES'
			break
	print(ans)


import math
n = int(input())
s2 = input()
s2 = list(s2)
s = []
for i in range(n):
	if s2[i] == '0':
		continue
	else:
		s.append(int(s2[i]))
s1 = sum(s)
n = len(s)
l = []
for i in range(2, n + 1):
	if s1 % i == 0:
		l.append(s1 // i)
f = 0
if len(s) == 0:
	f = 1
for i in range(len(l)):
	c = 0
	if f == 1:
		break
	for j in range(n):
		c += s[j]
		if c == l[i]:
			c = 0
			if j == n - 1:
				f = 1
		elif c < l[i]:
			c = c
		else:
			break
if f == 0:
	print('NO')
else:
	print('YES')


n = int(input())
s = list(input())
s = list(map(int, s))
for pref in range(n - 1):
	sm = sum(s[:pref + 1])
	cnt = 0
	g = 0
	for j in range(pref + 1, n):
		cnt += s[j]
		if cnt == sm:
			cnt = 0
			g = 1
	if cnt == 0 and g:
		print('YES')
		exit(0)
print('NO')


def test(x):
	global arr, n
	s = 0
	for i in range(n):
		s += arr[i]
		if s > x:
			return False
		elif s == x:
			s = 0
	return s == 0
n = int(input())
oarr = list(map(int, list(input())))
arr = []
for el in oarr:
	if el:
		arr.append(el)
	else:
		n -= 1
s = 0
for i in range(n - 1):
	s += arr[i]
	if test(s):
		print('YES')
		break
else:
	if n == 0:
		print('YES')
	else:
		print('NO')


n = int(input())
number = input()
sum = 0
flag = False
counter = 0
for i in range(n):
	sum = sum + int(number[i])
if sum == 0 and n > 1:
	flag = True
for i in range(2, sum + 1):
	if sum % i == 0:
		for j in range(n):
			counter = counter + int(number[j])
			if counter == sum / i:
				counter = 0
		if counter == 0:
			flag = True
			counter = 0
			break
		counter = 0
if flag == True:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	ticket = input()
	digits = [int(x) for x in ticket if x != '0']

	def search(value, start):
		next_seg_sum = 0
		for x in digits[start:]:
			if next_seg_sum + x > value:
				if next_seg_sum == value:
					next_seg_sum = 0
				else:
					return False
			next_seg_sum += x
		return next_seg_sum == value

	def is_lucky():
		total_sum = sum(digits)
		if total_sum == 0:
			return True
		seg_sum = 0
		for (i, x) in enumerate(digits):
			seg_sum += x
			if seg_sum * 2 > total_sum:
				return False
			if total_sum % seg_sum == 0:
				if search(seg_sum, i + 1):
					return True
		return False
	print('YES' if is_lucky() else 'NO')
main()


n = int(input())
l = input()
k = []
for i in l:
	k.append(int(i))
g = False
m = 0
for i in range(sum(k)):
	for j in range(len(k)):
		m += k[j]
		if m < i:
			pass
		elif m == i:
			m = 0
		elif m > i:
			pass
	if m == 0:
		g = True
		break
	m = 0
if g or sum(k) == 0:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
s = str(s).strip('0')
n = len(s)
m = []
for i in s:
	m.append(int(i))
from itertools import accumulate
ac = list(accumulate(m))
res = 0
if n == 0:
	res = 1
for i in range(n - 1):
	check = 1
	if ac[i] == 0:
		for j in ac[i + 1:]:
			if j == 0:
				res = 1
			else:
				res = 0
	else:
		for j in range(i + 1, n):
			if ac[j] % ac[i] == 0:
				if ac[j] // ac[i] == check + 1:
					check += 1
					if j == n - 1:
						check = -1
				elif ac[j] // ac[i] == check:
					if j == n - 1:
						check = -1
				else:
					res = 0
					break
		if check == -1:
			res = 1
			break
if res:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
arr = []
ans = 'NO'
for i in range(len(s)):
	arr.append(int(s[i]))
for i in range(1, len(s)):
	si = sum(arr[:i])
	ind = i
	flag = True
	sj = 0
	while ind < len(s):
		if sj + arr[ind] < si:
			sj += arr[ind]
			if ind == len(s) - 1:
				flag = False
		elif sj + arr[ind] == si:
			sj += arr[ind]
		elif si == sj:
			sj = arr[ind]
			if ind == len(s) - 1 and sj != si:
				flag = False
		else:
			flag = False
		ind += 1
	if flag:
		ans = 'YES'
print(ans)


a = int(input())
b = list(map(int, input().replace('', ' ').split()))
k = 0
o = sum(b)
for i in range(452):
	j = 0
	s = 0
	p = []
	while j < a:
		if s + b[j] < i:
			s += b[j]
		elif s + b[j] == i:
			p += [s + b[j]]
			s = 0
		else:
			p = []
			break
		j += 1
	if s == 0 and len(p) != 1 and (len(set(p)) == 1):
		exit(print('YES'))
print('NO')


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
n = ii()
l = [int(i) for i in si()]
sml = sum(l)
if sml == 0:
	exit(print('YES'))
for i in range(sml):
	sm = 0
	c = 0
	for j in range(n):
		sm += l[j]
		if sm == i:
			sm = 0
			c += 1
		elif sm > i:
			break
	if c * i == sml:
		exit(print('YES'))
print('NO')


def ans(b, st, end, count):
	if end + 1 == len(b[0]):
		return count
	index = 0
	i = end + 1
	get = False
	while i < len(b[0]):
		if b[st][end] == b[end + 1][i]:
			index = i
			get = True
		i += 1
	if get:
		count += 1
		return ans(b, end + 1, index, count)
	else:
		return 0
from pprint import pprint
n = int(input())
num = input()
lst = list()
for i in num:
	lst.append(int(i))
b = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
	suml = 0
	for j in range(i, n):
		suml += lst[j]
		b[i][j] = suml
for i in range(n):
	if ans(b, 0, i, 1) > 1:
		print('YES')
		break
	if i == n - 1:
		i = -1
		break
if i == -1:
	print('NO')


def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return factors

def factors(n):
	super = [1]
	for i in prime_factors(n):
		super.extend([j * i for j in super])
	return list(sorted(set(super)))

def det(i, string):
	total = 0
	for j in range(len(string)):
		total += int(string[j])
		if total > i:
			return False
		if total == i:
			total = 0
	return True
length = int(input())
string = input()
_sum = sum((int(i) for i in string))
if _sum == 0:
	print('YES')
else:
	f = factors(_sum)
	for i in f[:-1]:
		if det(i, string):
			print('YES')
			break
	else:
		print('NO')


n = int(input())
s = list(input())
s = list(map(int, s))
new = []
for el in s:
	if el != 0:
		new.append(el)
s = new.copy()
n = len(s)
r = n - 1
if n == 0:
	print('YES')
	exit(0)
elif n == 1:
	print('NO')
	exit(0)
k = 1
j = 1
first = s[0]
second = 0
while True:
	if second < first:
		second += s[j]
		j += 1
	elif second > first:
		second = 0
		first += s[k]
		k += 1
		j = k
	else:
		second = 0
	if j >= n:
		if second == first:
			print('YES')
			exit(0)
		elif k == r:
			print('NO')
			exit(0)
		else:
			second = 0
			first += s[k]
			k += 1
			j = k


n = int(input())
pre_res = 1
max_s = n * 9
s = input()
sums = [1] * (max_s + 1)
i = 1
while i <= max_s:
	sums[i] = i
	i += 1
for c in s:
	if c != '0':
		d = int(c)
		i = 1
		while i <= max_s:
			if sums[i] == i:
				sums[i] = d
			else:
				sums[i] += d
			i += 1
res = 1
i = 1
while i <= max_s:
	if sums[i] == i:
		res += 1
	i += 1
if res == 2:
	print('NO')
else:
	print('YES')


def summ(array):
	o = 0
	for m in array:
		o += m
	return o

def check_array(cur_sum, pos):
	global_flag1 = True
	n_pos = pos
	sum = 0
	for j in talon[pos:]:
		sum += j
		n_pos += 1
		if sum >= cur_sum:
			if cur_sum == sum:
				if n_pos == len(talon):
					print('YES')
					global_flag1 = False
					exit()
				if global_flag1:
					check_array(cur_sum, n_pos)
			else:
				return
useless = input()
talon = input()
talon = [int(x) for x in talon]
for i in range(len(talon)):
	cur = summ(talon[:i + 1])
	check_array(cur, i + 1)
print('NO')


n = int(input())
s = input()
if s == '0' * n:
	print('YES')
else:
	sum1 = 0
	smth = False
	for i in range(n):
		sum1 += int(s[i])
	for i in range(2, sum1 + 1):
		if sum1 % i == 0:
			x = 0
			x += sum1
			x = x // i
			u1 = 0
			now = 0
			flag = True
			while u1 < n:
				if now < x:
					now += int(s[u1])
					u1 += 1
				elif now == x:
					now = 0
				else:
					flag = False
					break
				if now > x:
					flag = False
					break
			if flag and (not smth):
				print('YES')
				smth = True
	if not smth:
		print('NO')


n = int(input())
s = input()
suma_t = 0
flag = 0
for i in range(n - 1):
	suma_t += int(s[i])
	r = 0
	gl = 0
	for j in range(i + 1, n):
		r += int(s[j])
		if r == suma_t:
			r = 0
			gl = 1
	if r == 0 and gl == 1:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
sum = 0
for i in range(n):
	if i == n - 1:
		break
	sum += int(a[i])
	fl = True
	pos = i + 1
	while pos < n:
		sum2 = 0
		sum2 = int(a[pos])
		pos += 1
		while pos < n and sum2 + int(a[pos]) <= sum:
			sum2 += int(a[pos])
			pos += 1
		if sum2 != sum:
			fl = False
			break
	if sum2 != sum:
		fl = False
	if fl:
		break
if fl:
	print('YES')
else:
	print('NO')


import sys
n = int(input())
s = list(map(int, ' '.join(input().strip().split())))
count = 0
for i in range(0, n - 1):
	count += s[i]
	now = 0
	fl = 0
	fll = 0
	for j in range(i + 1, n):
		now += s[j]
		if now == count:
			now = 0
			fll = 1
		elif now > count:
			fl = 1
			break
	if fl == 0 and now == 0 and (fll == 1):
		print('YES')
		sys.exit()
print('NO')


garb = int(input())
bill = str(input())
for k in range(1, len(bill)):
	now_res = 0
	for i in range(k):
		now_res += int(bill[i])
	sec_res = 0
	for i in range(k, len(bill)):
		sec_res += int(bill[i])
		if i != len(bill) - 1 and sec_res == now_res and (bill[i + 1] != '0'):
			sec_res = 0
	if sec_res == now_res:
		print('YES')
		raise SystemExit
print('NO')


n = int(input())
a = list(map(int, input()))
for i in range(901):
	sum_ = 0
	cnt = 0
	flag = True
	for j in range(n):
		sum_ += a[j]
		if sum_ == i:
			sum_ = 0
			cnt += 1
		elif sum_ > i:
			flag = False
			break
	if sum_ != 0 or cnt < 2:
		flag = False
	if flag:
		print('YES')
		break
else:
	print('NO')


def vs(n, a):
	digi = []
	for i in a:
		digi.append(int(i))
	suc = 'NO'
	if n == 2:
		if digi[0] == digi[1]:
			return 'YES'
		else:
			return 'NO'
	for j in range(1, n - 1):
		t = True
		isSum = False
		summ = sum(digi[:j])
		x = j
		thisSum = 0
		while x < n and t:
			thisSum += digi[x]
			if thisSum == summ:
				isSum = True
				thisSum = 0
				x += 1
			elif thisSum < summ:
				x += 1
			else:
				t = False
		if x == n and t and (thisSum == 0) and isSum:
			suc = 'YES'
	return suc
n = int(input())
a = input().strip()
print(vs(n, a))


from sys import stdin, stdout
t = int(stdin.readline())
arr = [int(x) for x in stdin.readline().replace('0', '').replace('', ' ').split()]
n = len(arr)

def f(pos, acc, v):
	global arr, n
	if pos == n - 1:
		if acc + arr[pos] == v:
			return True
		return False
	if arr[pos] + acc == v:
		return f(pos + 1, 0, v)
	elif arr[pos] + acc < v:
		return f(pos + 1, arr[pos] + acc, v)
	else:
		return False
acc = 0
if t != 0 and n == 0:
	stdout.write('YES')
	exit(0)
for i in range(0, n - 1):
	acc += arr[i]
	if f(i, acc - arr[i], acc):
		stdout.write('YES')
		exit(0)
stdout.write('NO')


amount = int(input())
old_ticket = input()
ticket = []
summ = 0
for elem in old_ticket:
	elem = int(elem)
	summ += elem
	ticket.append(elem)
ans = 0
for i in range(2, summ + 1):
	if summ % i == 0:
		j = 0
		current = 0
		res = summ // i
		isit = 0
		while j < amount:
			current += ticket[j]
			if current == res:
				current = 0
			elif current > res:
				isit = 1
				break
			j += 1
		if isit == 0:
			print('YES')
			ans = 1
			break
if summ == 0 and amount > 1:
	print('YES')
elif ans == 0:
	print('NO')


a = int(input())
b = list(map(int, input()))
sb = sum(b)
s = 1
for i in range(2, a + 1):
	if sb % i == 0:
		bc = sb // i
		s = 0
		for j in b:
			s += j
			if s == bc:
				s = 0
			if s > bc:
				break
		if s == 0:
			break
if s == 0:
	print('YES')
else:
	print('NO')


n = int(input())
line = input()
Ar = [int(i) for i in line]
an = False

def find_Next(fr, res):
	for i in range(fr + 1, len(Ar) + 1):
		if sum(Ar[fr:i]) == res:
			if i == len(Ar) or Ar[i] != 0:
				return i
	return -1
for i in range(0, n):
	if an:
		break
	res = sum(Ar[0:i + 1])
	fr = i + 1
	while fr != -1:
		fr = find_Next(fr, res)
		if fr == len(Ar):
			print('YES')
			an = True
			break
if not an:
	print('NO')


n = int(input())
a = list(map(int, list(input())))
for i in range(len(a)):
	sum = 0
	for j in range(i, -1, -1):
		sum += a[j]
	sum1 = 0
	f = 0
	for j in range(i + 1, len(a)):
		sum1 += a[j]
		if sum1 > sum:
			break
		if j == len(a) - 1 and sum1 == sum:
			print('YES')
			exit()
		if sum1 == sum and (j + 1 == len(a) or a[j + 1] != 0):
			sum1 = 0
			continue
		if sum1 > sum:
			break
print('NO')


n = int(input())
arr = [int(z) for z in list(input())]
ans = 0
if n == 2:
	if arr[0] == arr[1]:
		print('YES')
	else:
		print('NO')
	exit()
for l in range(1, n - 1):
	s = sum(arr[:l])
	i = l
	v = [s]
	curr = 0
	while i < n:
		curr += arr[i]
		if i == n - 1:
			if curr > s:
				curr -= arr[i]
				v.append(curr)
				curr = arr[i]
			v.append(curr)
		elif curr > s:
			curr -= arr[i]
			v.append(curr)
			curr = arr[i]
		i += 1
	if len(set(v)) == 1:
		print('YES')
		ans = 1
		exit()
if not ans:
	print('NO')


import sys, math
n = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().rstrip()))
if len(set(arr)) == 1:
	print('YES')
else:
	val = sum(arr)
	factor = set()
	for i in range(1, int(val ** 0.5) + 1):
		if val % i == 0:
			factor.add(i)
			factor.add(val // i)
	can = False
	for i in factor:
		each = val // i
		if 1 < i <= n:
			idx = 0
			temp = 0
			cnt = 0
			while idx < n:
				if temp + arr[idx] < each:
					temp += arr[idx]
				elif temp + arr[idx] > each:
					temp = 0
				else:
					temp = 0
					cnt += 1
				idx += 1
			if cnt == i:
				can = True
	print('YES' if can else 'NO')


from sys import exit
n = int(input())
a = list(map(int, list(input())))
x = sum(a)
flag = False
for i in range(n - 1, -1, -1):
	if a[i] == 0:
		n -= 1
	else:
		break
if n == 0:
	print('YES')
	exit(0)
for i in range(1, x):
	if x % i == 0:
		s = 0
		j = 0
		for j in range(n):
			s += a[j]
			if s > i:
				break
			if s == i:
				if j == n - 1:
					flag = True
					break
				s = 0
		if flag:
			break
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
sum = 0
for i in s:
	sum += int(i)
ch = False
for i in range(1, sum):
	k = sum // i
	if sum % i == 0 and k <= n:
		ind = 0
		cursum = 0
		curbl = 0
		for cnt in range(k):
			while ind < n and cursum < i:
				cursum += int(s[ind])
				ind += 1
			if cursum == i:
				curbl += 1
			cursum = 0
		if curbl == k:
			ch = True
if ch or sum == 0:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(x) for x in input()]
flag = 0
s = sum(a)
if s == 0:
	print('YES')
else:
	for i in range(s, 0, -1):
		if s % i == 0:
			sum1 = 0
			f = 1
			k = 0
			for j in range(len(a)):
				if sum1 + a[j] < i:
					sum1 += a[j]
				elif sum1 + a[j] == i:
					sum1 = 0
					k += 1
				else:
					f = 0
					break
			if f and k >= 2:
				flag = 1
				print('YES')
				break
	if not flag:
		print('NO')


n = int(input())
s = input()
sm = sum(map(int, list(s)))
dv = 2
ans = []
while dv <= n:
	if sm % dv == 0:
		summ = 0
		tmp = True
		for i in range(len(s)):
			summ += int(s[i])
			if summ == sm // dv:
				summ = 0
			elif summ > sm // dv:
				tmp = False
		if tmp:
			ans.append(dv)
	dv += 1
if ans:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
a = []
su = 0
for i in s:
	su += int(i)
	a.append(int(i))
b = []
for i in range(n):
	b.append(-1)
for i in range(n):
	if su % (i + 1) == 0:
		b[i] = su // (i + 1)
t = 0
b[0] = -1
for i in range(n):
	if b[i] != -1:
		k = 0
		su1 = 0
		for j in range(n):
			su1 += a[j]
			if su1 == b[i]:
				k += 1
				su1 = 0
		if k == i + 1 and su1 == 0:
			t = 1
			break
if t == 1:
	print('YES')
else:
	print('NO')


def f(idx, dgt):
	k = 1
	while idx + k - 1 < n and Sums[idx + k - 1] - Sums[idx - 1] < dgt:
		k += 1
	if idx + k - 1 == n - 1 and Sums[idx + k - 1] - Sums[idx - 1] == dgt:
		return True
	elif Sums[idx + k - 1] - Sums[idx - 1] == dgt:
		return f(idx + k, dgt)
	else:
		return False
n = int(input())
A = list(map(int, list(input())))
x = A.count(0)
i = 0
while i < len(A):
	if A[i] == 0:
		A.pop(i)
	else:
		i += 1
n -= x
if len(A) > 0:
	Sums = [0 for i in range(n + 1)]
	Sums[0] = A[0]
	for i in range(1, n):
		Sums[i] = Sums[i - 1] + A[i]
	for i in range(1, n):
		if f(i, Sums[i - 1]):
			print('YES')
			break
	else:
		print('NO')
else:
	print('YES')


n = int(input())
a = list(map(int, input()))
s = sum(a)

def check(a, x):
	n = len(a)
	tmp = 0
	for i in range(n):
		tmp += a[i]
		if tmp == x:
			tmp = 0
		elif tmp > x:
			return False
	return True

def solve():
	if not s:
		return 'YES'
	for i in range(1, s):
		if not s % i and check(a, i):
			return 'YES'
	return 'NO'
print(solve())


n = int(input())
b = list(input())
for i in range(len(b)):
	b[i] = int(b[i])
s = sum(b)
t = False
if s == 0:
	t = True
k = 0
for j in range(s - 1):
	if s % (j + 1) == 0:
		for i in range(n):
			k += b[i]
			if (k == j + 1) & (i + 1 == n):
				k = 0
				t = True
			elif k == j + 1:
				if list(b[i + 1:]).count(0) == len(list(b[i + 1:])):
					t = True
				k = 0
			elif k > j + 1:
				break
	k = 0
if t:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
l = []
total = 0
p = 0
for i in range(0, 450):
	sum1 = 0
	flag = 1
	r = 0
	for k in range(n):
		sum1 = sum1 + int(s[k])
		if sum1 > i:
			flag = 0
		if sum1 == i:
			sum1 = 0
			r = r + 1
	if r >= 2 and sum1 == 0 and (flag == 1):
		print('YES')
		p = 1
		break
if p == 0:
	print('NO')


def __main():
	n = int(input())
	a_seq = tuple(map(int, input()))
	for leftmost_size in range(1, n - 1 + 1):
		segment_sum = sum(a_seq[:leftmost_size])
		if segment_sum != 0 and sum(a_seq[leftmost_size:]) == 0:
			continue
		sum_remain = 0
		for i in range(leftmost_size, n):
			sum_remain += a_seq[i]
			if sum_remain == segment_sum:
				sum_remain -= segment_sum
		if sum_remain == 0:
			print('YES')
			break
	else:
		print('NO')
__main()


def solve(g, su, s, n):
	c = 0
	g2 = 0
	for i in range(n):
		c += int(s[i])
		if c == su:
			c = 0
			g2 += 1
		elif c > su:
			return False
	if c == 0 and g2 == g:
		return True

def main():
	n = int(input())
	s = input()
	summ = 0
	for elem in s:
		summ += int(elem)
	g = 2
	i = 2
	ans = False
	while g <= n:
		if summ % g == 0:
			i = summ // g
			ans = solve(g, i, s, n)
			if ans:
				break
		g += 1
	if ans:
		print('YES')
	else:
		print('NO')
main()


import sys
n = int(input())
a = [int(x) for x in input()]
s1 = 0
for i in range(n - 1):
	s1 += a[i]
	ok = True
	pos = i + 1
	s2 = 0
	while pos < n:
		s2 = a[pos]
		pos += 1
		while pos < n and s2 + a[pos] <= s1:
			s2 += a[pos]
			pos += 1
		if s2 != s1:
			ok = False
			break
	if ok:
		print('YES')
		sys.exit()
print('NO')


N = int(input())
s = input()
summ = 0
for i in range(N):
	summ += int(s[i])
dev = 2
happy = False
while dev <= summ:
	if summ % dev == 0:
		n = summ // dev
		i = 0
		sets = 0
		broke = False
		while i < N and (not broke):
			sets += int(s[i])
			if sets > n:
				broke = True
			if sets == n:
				sets = 0
			i += 1
		if not broke and sets == 0 and (N == i):
			happy = True
			break
	dev += 1
if happy or summ == 0:
	print('YES')
else:
	print('NO')


import sys
input()
s = input()
maxc = len(s) // 2 * 9
for i in range(0, maxc):
	sum = 0
	r = 'Y'
	l = 0
	for c in range(len(s)):
		sum += int(s[c])
		if sum == i:
			sum = 0
			l += 1
		elif sum > i:
			r = 'N'
			break
	if r == 'Y' and sum == 0 and (l > 1):
		print('YES')
		sys.exit()
print('NO')


input()
numbers = input()

def check_segments(temp_numbers, suma, index):
	acc_suma = 0
	for val in temp_numbers[index:]:
		val = int(val)
		acc_suma = acc_suma + val
		if acc_suma == suma:
			acc_suma = 0
	return acc_suma == 0 or acc_suma == suma

def first_segment(temp_numbers):
	suma = 0
	ans = False
	index = 0
	for val in temp_numbers:
		val = int(val)
		suma = suma + val
		index = index + 1
		if index == len(temp_numbers):
			return False
		if check_segments(temp_numbers, suma, index) == True:
			ans = True
			break
	return ans
while len(numbers) != 0 and numbers[-1] == '0':
	numbers = numbers[:-1]
if len(numbers) == 0 or first_segment(numbers) == True:
	print('YES')
else:
	print('NO')


n = int(input())
ds = [int(k) for k in input()]
dp = [[0 for s in range(100 * 100 + 1)] for p in range(n + 1)]
dp[0] = [1 for s in range(100 * 100 + 1)]
for r in range(n):
	s = 0
	for l in reversed(range(r == n - 1, r + 1)):
		s += ds[l]
		if dp[l][s]:
			dp[r + 1][s] = 1
print(['NO', 'YES'][sum(dp[-1]) >= 1])


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
int1 = lambda x: int(x) - 1
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))
ilelec = lambda : map(int1, input().split())
alelec = lambda : list(map(int1, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
N = int(input())
S = input()
T = list(map(int, [*S]))
if len(set(T)) == 1:
	Y(1)
	exit(0)
s = sum(T)
m = max(T)
flg = 0
for i in range(m, s // 2 + 1):
	if s % i == 0:
		U = T.copy()
		tot = 0
		while len(U) > 0:
			x = U.pop()
			if tot + x <= i:
				tot += x
			elif tot + x > i:
				break
			if tot == i:
				tot = 0
		if tot != 0 or len(U) != 0:
			continue
		else:
			flg = 1
			break
Y(flg)


def check(s, n):
	for j in range(len(s)):
		if sum([int(letter) for letter in s[:j + 1]]) == n:
			if j == len(s) - 1:
				return True
			else:
				return check(s[j + 1:], n)
		elif sum([int(letter) for letter in s[:j + 1]]) > n:
			return False

def solve(x):
	x = x.replace('0', '')
	if x == '':
		return 'YES'
	for j in range(len(x)):
		N = sum([int(letter) for letter in x[:j]])
		if check(x[j:], N):
			return 'YES'
	return 'NO'
n = int(input())
x = input()
print(solve(x))


n = int(input())
a = input()
l = []
sigma = 0
s = list(map(int, list(a)))
s = list(filter(lambda a: a != 0, s))
if len(s) == 1:
	l = [0]
for i in range(1, len(s)):
	if s.count(s[i]) == len(s):
		l = []
		break
	if sum(s[i:]) % sum(s[:i]) == 0:
		sigma = sum(s[:i])
		l = []
	l.append(s[i])
	if sum(l) == sigma:
		l = []
if l == []:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input()))
s = sum(a)
divisors = [0, 1]
import math
for i in range(2, math.ceil(s ** (1 / 2)) + 1):
	if s % i == 0:
		divisors.append(i)
		divisors.append(s // i)
for d in divisors:
	l = 0
	cur_s = 0
	while l < len(a):
		cur_s += a[l]
		if cur_s == d:
			cur_s = 0
		elif cur_s > d:
			break
		l += 1
	if d != s and cur_s == 0 and (l == len(a)):
		print('YES')
		exit(0)
print('NO')


import sys
n = int(input())
s = input()
s2 = ''
maxx = 0
all_zero = True
for i in s:
	maxx += int(i)
	if i != '0':
		all_zero = False
		s2 += i
s = s2
n = len(s)
if all_zero:
	print('YES')
	sys.exit()
for i in range(0, maxx):
	start = 0
	p = 0
	summ = 0
	while start + p < n:
		summ += int(s[start + p])
		if summ == i:
			if start + p == n - 1:
				print('YES')
				sys.exit()
			summ = 0
			start = start + p
			p = 0
		elif summ >= i:
			break
		p += 1
print('NO')


n = int(input())
s = input()
minI = 0
while minI < len(s):
	mi = sum((int(s[i]) for i in range(minI + 1)))
	i = minI + 1
	su = 0
	valid = False
	while i < len(s):
		su += int(s[i])
		if su > mi:
			break
		if su == mi:
			if i < len(s) - 1 and (not s[i + 1] == '0'):
				su = 0
			if i == len(s) - 1:
				valid = True
		i += 1
	if valid:
		print('YES')
		break
	minI += 1
if not valid:
	print('NO')


a = input()
ticket = input()

def gold(s, l):
	if len(l) == 0:
		return True
	for i in range(len(l)):
		sum_i = sum([int(l[j]) for j in range(i + 1)])
		if sum_i > s:
			return False
		elif sum_i == s:
			if sum([int(l[j]) for j in range(i + 1, len(l))]) == 0:
				return True
			return gold(s, l[i + 1:len(l)])
	return False

def task(l):
	for i in range(len(l) - 1):
		f_i_sum = sum([int(l[j]) for j in range(i + 1)])
		rest = l[i + 1:len(l)]
		if gold(f_i_sum, rest):
			return True
	return False
if task(ticket):
	print('YES')
else:
	print('NO')


n = int(input())
a = list(filter(None, map(lambda x: int(x) if x != '0' else None, input())))
x = sum(a)
if not a:
	exit(print('YES'))
b = [i for i in range(2, x + 1) if not x % i]
for i in b:
	m = x // i
	p = cnt = 0
	for t in a:
		p = p + t
		if p == m:
			cnt += 1
			p = 0
		elif p > m:
			break
	if cnt == i:
		exit(print('YES'))
print('NO')


n = int(input())
t = list(map(int, input()))
a = []
for i in t:
	if i != 0:
		a.append(i)
if a == []:
	print('YES')
	exit()
for i in range(1, len(a)):
	sumn = sum(a[:i])
	snow = 0
	for j in range(i, len(a)):
		snow += a[j]
		if j == len(a) - 1 and snow == sumn:
			print('YES')
			exit()
		elif snow == sumn:
			snow = 0
		elif snow > sumn:
			break
print('NO')


n = int(input())
a = input()
sum = 0
for x in a:
	sum += int(x)
ans = 'NO'
if sum == 0:
	ans = 'YES'
s = 1
while s * s <= sum and ans == 'NO':
	if sum % s == 0:
		t = 0
		flag = 0
		for x in a:
			t += int(x)
			if t == s:
				flag = 1
			if t > s:
				if flag == 1:
					flag = 0
					t = int(x)
					if t == s:
						flag = 1
		if t == s and t != sum:
			ans = 'YES'
		t = 0
		flag = 0
		for x in a:
			t += int(x)
			if t == sum // s:
				flag = 1
			if t > sum // s:
				if flag == 1:
					flag = 0
					t = int(x)
					if t == sum // s:
						flag = 1
		if t == sum // s and t != sum:
			ans = 'YES'
	s += 1
print(ans)


n = int(input())
num = str(input())
ans = False
for i in range(1, n):
	sum_ = sum((int(num[j]) for j in range(i)))
	_sum = 0
	for j in range(i, n):
		_sum += int(num[j])
		if _sum > sum_:
			break
		elif _sum == sum_:
			while True:
				if j == n - 1:
					break
				if int(num[j + 1]) == 0:
					j += 1
				else:
					break
			if j == n - 1:
				ans = True
			_sum = 0
	if ans:
		break
if ans:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
sums = []
summ = 0
for i in range(n):
	cur = int(a[i])
	summ += cur
	sums.append(summ)
ok = False
if sums[-1] == 0:
	ok = True
for i in range(901):
	if ok:
		break
	first = False
	st = 0
	j = 0
	while j < n:
		summ = sums[j] - sums[st] + int(a[st])
		if summ == i:
			if first and sums[-1] - sums[j] == 0:
				ok = True
			first = True
			st = j + 1
			j += 1
			while j < n and a[j] == '0':
				j += 1
		elif summ > i:
			break
		else:
			j += 1
if ok:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	s = input()
	maxi = -1
	for x in range(901):
		f = False
		acc = 0
		cnt = 0
		for y in range(n):
			if acc + int(s[y]) > x:
				f = True
				break
			elif acc + int(s[y]) == x:
				acc = 0
				cnt += 1
			else:
				acc += int(s[y])
		if f:
			continue
		elif acc == 0 and cnt >= 2:
			maxi = x
	if maxi == -1:
		print('NO')
	else:
		print('YES')
main()


n = int(input())
a = [*filter(lambda x: x != 0, map(int, list(input())))]
if len(a) == 0:
	print('YES')
	quit()
s = a[0]
i = 1
while i < len(a):
	j = i
	s1 = 0
	f = True
	while j < len(a):
		s1 += a[j]
		if s1 == s:
			s1 = 0
		if s1 > s:
			f = False
			break
		j += 1
	if s1 != 0:
		f = False
	if f:
		print('YES')
		quit()
	s += a[i]
	i += 1
print('NO')


class Solve:
	sum = n = m = 0
	list1 = []

	def __init__(self):
		self.n = int(input())
		self.m = int(input())
		m = self.m
		n = self.n
		while n != 0:
			self.list1.append(m % 10)
			self.sum += m % 10
			m = m // 10
			n -= 1

	def check(self, part, sump):
		sum_temp = 0
		cnt = 0
		for i in self.list1:
			sum_temp += i
			if sum_temp == sump:
				cnt += 1
				sum_temp = 0
			elif sum_temp > sump:
				return False
		if cnt == part:
			return True
		return False

	def start(self):
		for i in range(2, self.n + 1):
			if self.sum % i == 0:
				if self.check(i, self.sum // i):
					print('YES')
					return
		print('NO')
method = Solve()
method.start()


n = int(input())
nums = list(map(int, list(input())))
summ = sum(nums)
if summ == 0:
	print('YES')
else:
	a = []
	for i in range(1, summ):
		if summ % i == 0:
			a.append(i)
	flag = False
	for i in range(len(a)):
		curr = 0
		j = 0
		c = summ // a[i]
		while not flag and j < n:
			curr += nums[j]
			if curr == a[i]:
				curr = 0
				if c == 1:
					flag = True
					print('YES')
					break
				c -= 1
			j += 1
		if flag:
			break
	if not flag:
		print('NO')


n = int(input())
bilet = [int(x) for x in list(input())]
summa = sum(bilet)
p = 0
for i in range(n, 1, -1):
	su = 0
	counter = 0
	l = 1
	for item in bilet:
		su += item
		if counter >= i:
			if su > 0:
				counter = 0
		if summa // i == su:
			counter += 1
			p = 1
			su = 0
		l += 1
	if counter >= i:
		print('YES')
		break
else:
	print('NO')


a = int(input())
st = input()
asum = sum((int(i) for i in st))
if asum == 0 and a > 1:
	print('YES')
else:
	for i in range(1, asum + 1):
		if asum % i == 0:
			summ = asum // i
			k = 0
			ensum = 0
			mysum = 0
			for j in st:
				mysum += int(j)
				if mysum == summ:
					k += 1
					ensum += mysum
					mysum = 0
				elif mysum > summ:
					break
			else:
				if not mysum and k > 1 and (ensum == asum):
					print('YES')
					break
	else:
		print('NO')


a = int(input())
b = [int(x) for x in input()]
c = sum(b)
e = []
for i in range(2, len(b) + 1):
	if c % i == 0:
		e.append(i)
d = False
for i in e:
	r = []
	b1 = b[:]
	num = c // i
	k = 0
	while b1:
		k += b1[0]
		b1 = b1[1:]
		if k == num:
			r.append(k)
			k = 0
		elif k > num:
			break
		if len(r) == i:
			d = True
if d:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
li = []
max = 0
for i in range(len(s)):
	if int(s[i]) > max:
		max = int(s[i])
	li.append(int(s[i]))
li2 = []
for l in li:
	li2.append(l)
li2.remove(max)
rest_sum = sum(li2)
if rest_sum < max:
	print('NO')
	exit(0)
i = 0
temp_sum = 0
while i < n:
	temp_sum += li[i]
	another_temp_sum = 0
	j = i + 1
	flag = False
	while j < n:
		another_temp_sum += li[j]
		if another_temp_sum == temp_sum:
			flag = True
			another_temp_sum = 0
		elif another_temp_sum > temp_sum:
			break
		j += 1
	if j == n and 0 == another_temp_sum and flag:
		print('YES')
		exit(0)
	i += 1
print('NO')


def main():
	you_can = False
	n = int(input())
	raw = input()
	s = 0
	t = list()
	for c in raw:
		t.append(int(c))
		s += int(c)
	fs = list()
	r = s
	cur = 2
	while r > 1:
		if r % cur == 0:
			fs.append(cur)
		while r % cur == 0:
			r /= cur
		cur += 1
	if s != 0:
		for f in fs:
			need = s // f
			cur_sum = 0
			cnt = 0
			for i in t:
				cur_sum += i
				if cur_sum > need:
					break
				if cur_sum == need:
					cur_sum = 0
					cnt += 1
			if cnt == f:
				you_can = True
				break
	else:
		you_can = True
	if you_can:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
s = input()
for i in range(901):
	j = 0
	summa = 0
	f = True
	q = 0
	while j < n and f:
		summa += int(s[j])
		if summa > i:
			f = False
		elif summa == i:
			q += 1
			summa = 0
		j += 1
	if summa == 0 and f and (q > 1):
		print('YES')
		return
print('NO')


n = int(input())
z = list(map(int, input()))
if len(z) == 1:
	print('NO')
	exit(0)
if max(z) == 0:
	print('YES')
	exit(0)
if ''.join((str(c) for c in z)).count('0') == len(z) - 1:
	print('NO')
	exit(0)
b = True
for need in range(9 * n + 1):
	cnt = 0
	sm = 0
	ok = True
	for i in z:
		sm += i
		if sm > need:
			if sm - i == need:
				cnt += 1
				sm = i
				continue
			ok = False
			break
	if ok and cnt > 0 and (sm == need):
		b = False
		break
if b:
	print('NO')
else:
	print('YES')


import math
import bisect

def dividers(n, maxd):
	lst = []
	for d in range(maxd, n):
		if n % d == 0:
			lst.append(d)
	return list(sorted(lst))

def partition(d, div):
	i = 0
	j = 1
	while j < len(d):
		s = sum(d[i:j])
		if d[j] == 0:
			j += 1
		elif s == div:
			i = j
		elif s < div:
			j += 1
		else:
			return False
	return sum(d[i:j]) == div
input()
d = list(map(int, input())) + [0]
(n, maxd) = (sum(d), max(d))
if n == 0:
	print('YES')
elif maxd == n:
	print('NO')
else:
	for div in dividers(n, maxd):
		if partition(d, div):
			print('YES')
			break
	else:
		print('NO')


n = int(input())
a = str(input()) + 'qq'
f = a
maks = 0
sum = 0
delki = []
num = 0
ksu = 0
br = 1
otv = 0
sx = []
sxe = []
prt = 1
for i in range(0, n):
	if int(a[i]) > int(maks):
		maks = a[i]
for i in range(0, n):
	sum += int(a[i])
for i in range(int(maks), int(sum)):
	if int(sum) % i == 0:
		delki.append(i)
if sum == 0:
	print('YES')
	import sys
	sys.exit()
for i in range(0, len(delki)):
	f = a
	br = 1
	sum1 = int(delki[i])
	while f[0] != 'q' and br != 0:
		sumot = int(f[0])
		ksu = 0
		while sumot != sum1 and br != 0:
			ksu += 1
			sumot += int(f[ksu])
			if int(sumot) > int(sum1):
				br = 0
		else:
			if br != 0:
				while f[ksu + 1] == '0':
					ksu += 1
				sx.append([f[0:ksu + 1]])
				f = f[ksu + 1:]
	else:
		if f[0] == 'q' and br != 0:
			otv += 1
if otv == 0:
	print('NO')
else:
	print('YES')


def main():
	n = int(input())
	arr = list(map(int, list(input())))
	s = set()
	arr = list(filter(lambda a: a != 0, arr))
	if len(arr) == 0:
		print('YES')
		exit(0)
	s.add(arr[0])
	for i in range(1, len(arr)):
		arr[i] += arr[i - 1]
		s.add(arr[i])
	for v in arr:
		acc = v
		cnt = 0
		if arr[-1] % v != 0:
			continue
		while acc != 0 and acc < arr[-1] and (acc in s):
			acc += v
			cnt += 1
		if cnt != 0 and arr[-1] == acc:
			print('YES')
			exit(0)
	print('NO')
main()


n = int(input())
a = input()
ans = 0
needs = 0
for i in range(n):
	needs += int(a[i])
	currs = 0
	for j in range(i + 1, n):
		currs += int(a[j])
		if currs > needs:
			break
		elif currs == needs:
			if j == n - 1:
				ans = 1
				break
			elif a[j + 1] != '0':
				currs = 0
if ans:
	print('YES')
else:
	print('NO')


def foo(bbr, s):
	if s == sum(bbr):
		return True
	if not bbr:
		return False
	ans = 0
	for i in range(1, len(bbr)):
		if s == sum(bbr[:i]):
			ans += foo(bbr[i:], s)
	return ans
n = int(input())
arr = list(map(int, input()))
ans = 0
for i in range(1, len(arr)):
	ans += foo(arr[i:], sum(arr[:i]))
	if ans:
		break
print('YES' if ans else 'NO')


n = int(input())
s = input()
cur = 0
T = False
for i in range(len(s) - 1):
	cur += int(s[i])
	cnt = 0
	for j in range(i + 1, len(s)):
		cnt += int(s[j])
		if cnt != 0:
			T = False
		if cnt == cur:
			cnt = 0
			T = True
		elif cnt > cur:
			T = False
			break
	if T:
		print('YES')
		exit()
print('NO')


n = int(input())
m = list(input())
s = 0
for i in range(len(m)):
	m[i] = int(m[i])
	s += m[i]
gg = 0
for i in range(len(m)):
	if m[i] != m[0]:
		gg = 1
		break
if gg == 0:
	print('YES')
	exit()
a = []
last = 0
for i in range(2, s + 1):
	if s % i == 0:
		a.append(i)
for i in range(len(a)):
	ss = 0
	flag = True
	for ii in range(a[i]):
		for l in range(len(m)):
			ss += m[l]
			if ss == s / a[i]:
				ss = 0
				last = l
			if ss > s / a[i]:
				flag = False
				last = 0
				break
		if flag == False:
			break
		else:
			print('YES')
			exit()
print('NO')


l = int(input())
a = input()
all_sum = 0
for i in a:
	all_sum += int(i)
fl = False
for i in range(2, all_sum + 3):
	if all_sum % i == 0:
		num_s = 0
		fl = True
		for j in a:
			num_s += int(j)
			if num_s == all_sum // i:
				num_s = 0
			elif num_s > all_sum // i:
				fl = False
				break
		if num_s < all_sum // i and num_s != 0:
			fl = False
		if fl:
			break
if fl:
	print('YES')
else:
	print('NO')


n = int(input())
digits = [int(d) for d in input()]
ret = 'NO'
for i in range(n - 1):
	sum1 = 0
	for i2 in range(i + 1):
		sum1 += digits[i2]
	next1 = i + 1
	temp = 0
	reseted = False
	while next1 != n:
		temp += digits[next1]
		next1 += 1
		if temp > sum1:
			break
		if temp == sum1:
			reseted = True
			temp = 0
	if temp == 0 and reseted:
		ret = 'YES'
		break
print(ret)


n = int(input())
s = input()
dl = []
ch = []
sum = 0
for i in range(n):
	sum += int(s[i])
	if s[i] != '0':
		ch.append(int(s[i]))
for i in range(1, sum):
	if sum % i == 0:
		dl.append(i)
if len(dl) > 0:
	for i in range(len(dl)):
		sum = 0
		tr = 0
		k = 0
		for j in range(len(ch)):
			sum += ch[j]
			if sum == dl[i]:
				tr = 1
				sum = 0
				k += 1
			else:
				tr = 0
		if tr == 1 and k > 1:
			break
elif sum == 0:
	tr = 1
else:
	tr = 0
if tr == 1:
	print('YES')
else:
	print('NO')


n = int(input())
b = input()
s = 0
f = 0
r = 0
if int(b) == 0:
	f = 1
for i in range((n - 1) * (1 - f)):
	s += int(b[i])
	z = 0
	k = i + 1
	r = 0
	while z < s and k < n:
		z += int(b[k])
		k += 1
		if z == s:
			z = 0
			r = 1
	if z == 0 and r == 1:
		f = 1
		break
if f:
	print('YES')
else:
	print('NO')


n = int(input())
data = list(map(int, input()))
sums = []
summ = 0
for i in data:
	summ += i
	sums.append(summ)
sumset = set(sums)
if sumset == {0}:
	print('YES' if n > 1 else 'NO')
else:
	for i in range(1, sums[-1]):
		if sums[-1] % i == 0:
			for j in range(i, sums[-1], i):
				if j not in sumset:
					break
			else:
				print('YES')
				break
	else:
		print('NO')


n = int(input())
a = input()
r = 'NO'
for _ in range(9 * n + 1):
	c = 0
	cur = 0
	for i in range(n):
		cur += int(a[i])
		if cur == _:
			cur = 0
			c += 1
	if cur == 0 and c > 1:
		r = 'YES'
		break
print(r)


n = int(input())
a = int(input())
s = 0
t = a
b = []
for i in range(n):
	s += t % 10
	b.append(t % 10)
	t //= 10
b.reverse()
i = 2
ans = False
if s == 0:
	ans = True
while i <= s:
	if s % i != 0:
		i += 1
		continue
	l = s // i
	c = 0
	su = 0
	for j in range(n):
		if su > l:
			break
		else:
			su += b[j]
			if su == l:
				su = 0
				c += 1
	if c == i:
		ans = True
	i += 1
if ans:
	print('YES')
else:
	print('NO')


from sys import stdin
n = int(input())
s = stdin.readline().rstrip('\n')
from collections import defaultdict
l1 = []
c = 0
d = defaultdict(int)
for i in s:
	c += int(i)
	l1.append(c)
	d[c] = 1
ans = 'NO'
for i in range(2, n + 1):
	if l1[-1] % i == 0 and d[l1[-1] // i] == 1:
		for j in range(1, i + 1):
			if d[l1[-1] // i * j] != 1:
				break
		if j == i:
			ans = 'YES'
			break
print(ans)


m = int(input())
b = list(map(int, list(input())))
a = []
n = 0
for i in range(m):
	if b[i] != 0:
		a.append(b[i])
		n += 1
if n <= 1 and (not (n == 1 and m != 1)):
	print('YES')
else:
	for i in range(n - 1):
		if i == 0:
			s = a[0]
		else:
			s += a[i]
		s1 = 0
		for j in range(i + 1, n):
			if s1 < s:
				s1 += a[j]
				if s1 == s:
					if j == n - 1:
						print('YES')
						exit(0)
					else:
						s1 = 0
			else:
				break
	else:
		print('NO')


import sys
from collections import deque
import bisect

def chk(l, r, total):
	b = len(l)
	prev = 0
	i = 0
	f = 1
	cnt = 0
	while i < b:
		prev = prev + l[i]
		if cnt == total and prev == r:
			i = i + 1
			continue
		if prev == r:
			cnt += 1
			if cnt != total:
				prev = 0
		i = i + 1
	if cnt < total or i != b:
		f = 0
	return f
for _ in range(1):
	n = int(input())
	s = input()
	l = []
	som = 0
	for i in s:
		l.append(int(i))
		som += int(i)
	flag = 0
	for i in range(2, n + 1):
		if som % i == 0:
			r = som // i
			if chk(l, r, i):
				flag = 1
				break
		if flag:
			break
	if flag:
		print('YES')
	else:
		print('NO')


def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return factors

def factors(n):
	super = [1]
	for i in prime_factors(n):
		super.extend([j * i for j in super])
	return list(sorted(set(super)))

def test(n, val):
	now = 0
	for i in n:
		now += int(i)
		if now > val:
			return False
		if now == val:
			now = 0
	if now != 0:
		return False
	return True
length = int(input())
string = input()
n = sum((int(i) for i in string))
if n == 0:
	if length >= 2:
		print('YES')
	else:
		print('NO')
else:
	for i in factors(n)[:-1]:
		if test(string, i):
			print('YES')
			break
	else:
		print('NO')


n = int(input())
s = input().strip()
s = s.replace('0', '')
c = False
p1 = 0
for i in range(len(s) - 1):
	p1 += int(s[i])
	p2 = 0
	for j in range(i + 1, len(s)):
		p2 += int(s[j])
		if p1 == p2:
			p2 = 0
			c = True
		else:
			c = False
	if c:
		print('YES')
		break
else:
	if s == '':
		print('YES')
	else:
		print('NO')


n = int(input())
a = [int(x) for x in input()]
f = False
for s in range(1, sum(a)):
	i = 0
	sc = 0
	fc = True
	k = 0
	while i < n and fc:
		sc = 0
		k += 1
		while i < n and sc + a[i] <= s:
			sc += a[i]
			i += 1
		fc = sc == s
	if fc and k >= 2:
		f = True
		break
print('YES' if f or sum(a) == 0 else 'NO')


n = int(input())
word = input()
word = [int(elt) for elt in word]
somme = sum(word)
x = True
for i in range(2, n + 1):
	if somme % i == 0:
		part = somme // i
		x = False
		somPar = 0
		j = 0
		while j < n and (not x):
			somPar += word[j]
			if somPar < part:
				j += 1
			elif somPar == part:
				somPar = 0
				j += 1
			else:
				j = n
				x = True
		if not x:
			break
if not x:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, list(input())))
sum_num = sum(a)

def check(segsum):
	cur_sum = 0
	for i in range(n):
		cur_sum += a[i]
		if cur_sum == segsum:
			cur_sum = 0
		elif cur_sum > segsum:
			return False
	return True
ans = False
if sum_num == 0:
	ans = True
i = 1
while i < sum_num:
	if sum_num % i == 0:
		if check(i):
			ans = True
			break
	i += 1
print('YES' if ans else 'NO')


def check_len(st, s):
	p = 0
	for (ind, i) in enumerate(st):
		p += int(i)
		if p == s:
			if ind == len(st) - 1:
				return True
			return True and check_len(st[ind + 1:], s)
	else:
		return False
n = int(input())
a = list(filter(lambda x: x != '0', input()))
s = 0
if len(a) == 0:
	print('YES')
else:
	for (ind, i) in enumerate(a):
		s += int(i)
		if check_len(a[ind + 1:], s):
			print('YES')
			break
	else:
		print('NO')


x = int(input())
listik = list(map(int, input()))
summa = sum(listik)
if len(listik) % x == 0:
	x = True
	for i in listik:
		if i == listik[0]:
			pass
		else:
			break
	else:
		x = False
		print('YES')
if x:
	for i in range(1, summa // 2 + 1):
		if summa % i == 0:
			SumMin = 0
			for j in listik:
				if SumMin + j > i:
					break
				elif SumMin + j == i:
					SumMin = 0
				else:
					SumMin += j
			else:
				if SumMin == 0 or SumMin == i:
					print('YES')
					break
	else:
		print('NO')


n = int(input())
s = input()
total = 0
for c in s:
	total += int(c)
if total == 0:
	print('YES')
	exit(0)
for i in range(1, int(total / 2) + 1):
	now = 0
	yes = True
	if total % i != 0:
		continue
	for j in range(n):
		now += int(s[j])
		if now == i:
			now = 0
		elif now > i:
			yes = False
	if yes:
		print('YES')
		exit(0)
print('NO')


n = int(input())
s = input()
for sum in range(9 * n + 1):
	cnt = 0
	cursum = 0
	for i in s:
		cursum += int(i)
		if cursum == sum:
			cnt += 1
			cursum = 0
	if cursum == 0 and cnt > 1:
		print('YES')
		exit(0)
print('NO')


n = int(input())
a = [int(i) for i in input()]
isit = 0
prefsum = 0
for i in range(n):
	prefsum += a[i]
	x = 0
	rnds = 0
	for j in range(i + 1, n):
		x += a[j]
		if x == prefsum:
			x = 0
			rnds += 1
		if x > prefsum:
			break
	if (x == prefsum or x == 0) and i < n - 1 and rnds:
		print('YES')
		isit = 1
		break
if not isit or n == 1:
	print('NO')


def f(s, k):
	if len(s) == 0:
		return True
	for i in range(len(s)):
		if sum(s[:i + 1]) == k:
			return f(s[i + 1:], k)
		elif sum(s[:i + 1]) > k:
			return False

def fit(s):
	p = sum(s)
	for i in range(len(s) - 1):
		b = sum(s[:i + 1])
		if p % b == 0 and f(s[i + 1:], b):
			return True
	return False
input()
s = [int(t) for t in input() if t != '0']
print('YES' if len(s) == 0 or fit(s) else 'NO')


n = int(input())
numbers = list(map(int, list(input())))
s = sum(numbers)
if s == 0:
	print('YES')
	exit()
if s == 1:
	print('NO')
	exit()
div = [s]
for i in range(2, int(s ** 0.5) + 1):
	if s % i == 0:
		div.append(i)
		div.append(s // i)
for i in div:
	needed = s // i
	current = 0
	good = True
	for j in numbers:
		current += j
		if current == needed:
			current = 0
		elif current > needed:
			good = False
			break
	if good:
		print('YES')
		exit()
print('NO')


n = int(input())
a = [int(i) for i in input()]
s = 0
for i in a:
	s += i
for i in range(a.count(0)):
	a.remove(0)
	n -= 1
k = 0
p = 0
f = False
for i in range(n):
	k += a[i]
	if f:
		break
	if k != 0 and s % k == 0:
		for j in range(i + 1, n):
			p += a[j]
			if p > k:
				p = 0
				break
			if j == n - 1 and p != 0:
				f = True
			if p == k:
				p = 0
if f or s == 0:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(i) for i in input()]
s = sum(a)
devisors = []
k = 0
for i in range(1, s):
	if s % i == 0 and s / i <= n:
		devisors.append(i)

def is_gold(devisor, s):
	sum1 = 0
	for j in a:
		sum1 += j
		if sum1 == devisor:
			sum1 = 0
			continue
		if sum1 > devisor:
			return False
	if sum1 == 0:
		return True
	else:
		return False
for devisor in devisors:
	if is_gold(devisor, s):
		k = 1
		break
print('YES' if k == 1 or s == 0 else 'NO')


from math import sqrt

def factors(k):
	ret = []
	for i in range(1, int(sqrt(k)) + 1):
		if k % i == 0:
			ret.append(i)
			ret.append(k // i)
	ret.sort()
	return ret

def is_del(st, y):
	if y == sum(list(map(int, st))):
		return False
	su = 0
	for i in st:
		su += int(i)
		if su > y:
			return False
		if su == y:
			su = 0
	if su == 0:
		return True
	else:
		return False
a = int(input())
s = input()
n = int(s)
d = factors(sum(list(map(int, s))))
if sum(list(map(int, s))) == 0:
	print('YES')
	exit()
else:
	d = d[::-1]
	for i in d:
		if is_del(s, i):
			print('YES')
			exit()
	print('NO')


from sys import stdin
A = int(stdin.readline())
B = stdin.readline()
C = list()
sum = 0
for k in range(0, A):
	sum += int(B[k])
	C.append(sum)
Q = 0
U = 0
if sum == 0:
	print('YES')
	U = 1
if U == 0:
	for k in range(0, len(C)):
		if C[k] == 0:
			continue
		if sum % C[k] == 0:
			SUM = 0
			q = 0
			for t in range(k + 1, len(C)):
				SUM += int(B[t])
				if SUM == C[k]:
					SUM = 0
					q = 1
				elif SUM > C[k]:
					break
				if t == len(C) - 1:
					if q == 1:
						print('YES')
						Q = 1
						break
		if Q == 1:
			break
if Q == 0 and U == 0:
	print('NO')


n = int(input())
s = input()
arr = list()
arr.append(int(s[0]))
summ = arr[0]
bigflg = False
for i in range(1, len(s)):
	arr.append(int(s[i]))
	summ += arr[i]
for i in range(2, len(s) + 1):
	if summ % i == 0:
		amount = summ / i
		sm = 0
		flg = True
		for j in range(len(arr)):
			sm += arr[j]
			if sm > amount:
				flg = False
				break
			if sm == amount:
				sm = 0
		if sm == 0 and flg:
			bigflg = True
			print('YES')
			break
if not bigflg:
	print('NO')


n = int(input())
x = list(map(int, list(input())))
s = sum(x)
a = 1
for i in range(2, n + 1):
	if s % i == 0:
		j = 0
		a = 0
		while j < n:
			a += x[j]
			if a == s // i:
				a = 0
			elif a > s // i:
				break
			j += 1
		if a == 0:
			print('YES')
			break
if i == n and a:
	print('NO')


def valid(a, l):
	sum = 0
	for i in l:
		sum += i
		if sum == a:
			sum = 0
		if sum > a:
			break
	if sum == 0:
		return True
	else:
		return False
n = int(input())
t = input()
s = [int(i) for i in t]
l = s[0]
r = s[-1]
s = s[1:-1]
while len(s) > 0:
	if r == l:
		if valid(l, s):
			print('YES')
			exit()
		else:
			l += s[0]
			s = s[1:]
	elif r > l:
		l += s[0]
		s = s[1:]
	else:
		r += s[-1]
		s = s[:-1]
if l == r:
	print('YES')
	exit()
print('NO')


n = int(input())
c = [int(x) for x in list(input())]
s = sum(c)
d = []
for i in range(1, int(pow(sum(c), 0.5)) + 1):
	if s % i == 0:
		d.append(i)
		d.append(s // i)
e = 0
for i in d:
	x = 0
	f = 0
	for j in c:
		if x + j < i:
			x = x + j
		elif x + j == i:
			x = 0
		else:
			f = 1
			break
	if f == 0 and i < s:
		e = 1
		break
if s == 0 and len(c) > 1:
	e = 1
if e == 1:
	print('YES')
else:
	print('NO')


n = int(input())
(b, s) = (input(), 0)
p = True
for i in range(n):
	if not p:
		break
	s += int(b[i])
	(s1, j) = (0, i + 1)
	while j < n:
		if s1 + int(b[j]) <= s:
			s1 += int(b[j])
			j += 1
		elif s1 == s:
			s1 = int(b[j])
			j += 1
		else:
			break
	else:
		if s1 == s:
			print('YES')
			p = False
			break
else:
	print('NO')


def sum_o(s):
	if s == '':
		return 0
	res = 0
	for el in s:
		res += int(el)
	return res

def can(s, summ):
	if sum_o(s) == summ:
		return True
	res = ''
	for i in range(len(s)):
		wl = s[i]
		res += wl
		if sum_o(res) == summ:
			if can(s[i + 1:], summ):
				return True
			else:
				return False
		if sum_o(res) > summ:
			return False

def main():
	n = int(input())
	s = input()
	for i in range(1, n):
		if can(s[i:], sum_o(s[:i])):
			return 'YES'
	return 'NO'
print(main())


def can_compose(s, need_sum):
	n = len(s)
	i = 0
	count = 0
	while i < n:
		j = i
		cur_sum = 0
		while j < n:
			cur_sum += int(s[j])
			if cur_sum == need_sum:
				if j + 1 < n and cur_sum + int(s[j + 1]) == need_sum:
					j += 1
					continue
				count += 1
				i = j
				break
			elif cur_sum > need_sum:
				return False
			elif cur_sum < need_sum and j == n - 1:
				return False
			j += 1
		i += 1
	return count > 1
n = int(input())
s = input()
min_sum = 0
max_sum = 9 * n
if len(set(s)) == 1:
	print('YES')
	exit(0)
for segment_sum in range(min_sum, max_sum + 1):
	if can_compose(s, segment_sum):
		print('YES')
		exit(0)
print('NO')


(n, a, s1) = (int(input()), input(), 0)
a = [int(a[i]) for i in range(n)]
for i in range(n - 1):
	s1 += a[i]
	s2 = 0
	for j in range(i + 1, n):
		s2 += a[j]
		if s2 > s1:
			break
		elif s2 == s1:
			if j == n - 1:
				exit(print('YES'))
			elif a[j + 1] != 0:
				s2 = 0
print('NO')


def gold(s, c, o):
	if s == '':
		return 1
	t = int(s[0])
	i = 1
	while t != o:
		try:
			t += int(s[i])
			i += 1
		except:
			if t == 0:
				return 1
			return 0
	return gold(s[i:], c, o)

def mysum(s):
	c = 0
	for i in s:
		c += int(i)
	return c
n = int(input())
s = str(input())
c = 0
b = 0
c = mysum(s)
last = n - 1
if int(s) == 0:
	print('YES')
else:
	for i in range(n):
		if s[n - i - 1] != '0':
			break
		else:
			last = n - i - 2
	for i in range(1, last + 1):
		if gold(s, c, mysum(s[:i])) == 1:
			print('YES')
			b = 1
			break
	if b == 0:
		print('NO')


_ = input()
n = list(map(int, str(input())))
sum1 = 0
for x in n[0:-1]:
	sum1 += x
	sum2 = 0
	ok = True
	segments = 0
	for y in n:
		sum2 += y
		if sum1 == sum2:
			sum2 = 0
			ok = True
			segments += 1
		elif sum1 > sum2 and sum2 != 0:
			ok = False
		elif sum1 < sum2:
			ok = False
			break
	if ok is True and segments > 1:
		print('YES')
		exit()
print('NO')


def f(s, num, need_summ_in_piece):
	l = len(s)
	cur_summ = 0
	summ = sum(s)
	if l == 0:
		if need_summ_in_piece > 0:
			return False
		else:
			return True
	if num > 1:
		for i in range(l):
			cur_summ += s[i]
			if cur_summ == need_summ_in_piece:
				if f(s[i + 1:], num - 1, need_summ_in_piece):
					return True
			elif cur_summ > need_summ_in_piece:
				return False
		return False
	if num == 1:
		if summ == need_summ_in_piece:
			return True
		return False
n = int(input())
a = [int(elem) for elem in input()]
summ1 = sum(a)
divisors = []
f1 = False
for i in range(2, n + 1):
	if summ1 % i == 0:
		divisors.append(i)
for divisor in divisors:
	if f(a, divisor, summ1 / divisor):
		f1 = True
		break
if f1:
	print('YES')
else:
	print('NO')


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 998244353
EPS = 1e-06

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]

def possible(start, s):
	cur = 0
	for i in range(start, n):
		cur += a[i]
		if cur == s:
			cur = 0
		elif cur > s:
			return False
	return cur == 0
n = Int()
a = [int(i) for i in input()]
a = [i for i in a if i != 0]
n = len(a)
ans = 'NO'
if n == 0:
	ans = 'YES'
s = 0
for i in range(n - 1):
	s += a[i]
	if possible(i + 1, s):
		print('YES')
		exit()
print(ans)


n = int(input())
s = input()
sum = 0
a = []
for i in range(len(s)):
	a.append(int(s[i]))
	sum += int(s[i])
pre_sum = 0
tag = 0
for i in range(len(a)):
	pre_sum += a[i]
	if pre_sum != sum and pre_sum != 0 and (sum % pre_sum == 0):
		seg_sum = 0
		for j in range(i + 1, len(a)):
			seg_sum += a[j]
			if seg_sum == pre_sum:
				seg_sum = 0
		if seg_sum == 0:
			tag = 1
			break
if tag == 1 or sum == 0:
	print('YES')
else:
	print('NO')


n = int(input())
l = input()
l = list(map(int, l))
s = 0
D = 0
for i in range(n):
	s += l[i]
	ss = 0
	found = 0
	pos = i + 1
	while pos < n and ss <= s:
		ss += l[pos]
		if ss == s:
			found += 1
			ss = 0
		pos += 1
	if (found > 0 and ss == 0) and D == 0:
		D = 1
		print('YES')
		break
if D == 0:
	print('NO')


n = int(input())
numbers = input()
lucky = 0
for i in range(1000):
	current = 0
	count = 0
	for number in str(numbers):
		current += int(number)
		if current > i:
			break
		elif current == i:
			current = 0
			count += 1
	if count > 1 and current == 0:
		lucky = 1
if lucky:
	print('YES')
else:
	print('NO')


h = int(input())
line = input()
lis = list(line)
su = 0
d = 0
me = True
num = []
ke = True
for i in range(h):
	su += int(lis[i])
for k in range(1, su):
	if su % k == 0:
		num.append(k)
if su == 0:
	print('YES')
	me = False
if not num:
	if me != False:
		print('NO')
		me = False
for g in num:
	if me == False:
		break
	if ke == False:
		break
	c = 0
	count = 0
	bul = True
	while bul:
		if c == len(lis):
			if count == 0:
				print('YES')
				ke = False
				c = 0
				break
			else:
				ke = False
				break
		count += int(lis[c])
		if count > g:
			bul = False
		if count == g:
			count = 0
		c += 1
if me == True:
	if count != 0:
		print('NO')


def can_divide(ar, x):
	if sum(ar) == x or len(ar) == 0:
		return True
	if x == 0 and sum(ar) != 0:
		return False
	summ = 0
	t = 0
	while t < len(ar) and summ < x:
		summ += ar[t]
		t += 1
	if summ == x:
		return can_divide(ar[t:], x)
	return False

def check(s):
	arr = list(map(int, s))
	for i in range(1, len(arr)):
		if can_divide(arr[i:], sum(arr[:i])):
			return True
	return False
n = int(input())
if check(input()):
	print('YES')
else:
	print('NO')


n = int(input())
s = list(map(int, input()))
for i in range(1, n):
	sum1 = sum(s[:i])
	j = i
	sum2 = 0
	while j < n:
		if sum1 == sum2 and s[j] != 0:
			sum2 = 0
		sum2 += s[j]
		j += 1
	if sum1 == sum2:
		print('YES')
		exit()
print('NO')


n = int(input())
tic = input()
tic = tic.replace('0', '')
n = len(list(tic))
if n == 0:
	F = True
else:
	F = False
i = 0
while i < n:
	s = sum(map(int, tic[0:i + 1]))
	sT = 0
	for j in range(i + 1, n):
		sT += int(tic[j])
		if sT > s:
			sT = 0
			break
		elif sT == s:
			sT = 0
			if j == n - 1:
				F = True
	i += 1
if F:
	print('YES')
else:
	print('NO')


n = int(input())
aS = list(map(int, input()))
a = []
for i in aS:
	if i > 0:
		a.append(i)
n = len(a)
if n == 0:
	print('YES')
	exit()
cur = 0
for i in range(n - 1):
	cur += a[i]
	ans = True
	co = i + 1
	while co < n:
		ad = 0
		while co < n and ad < cur:
			ad += a[co]
			co += 1
		if ad != cur:
			ans = False
			break
	if ans:
		print('YES')
		exit()
print('NO')


from sys import exit
n = int(input())
arr = list(input())
arr = list(map(int, arr))
sm = sum(arr)
if sm == 0:
	print('YES')
	exit(0)
for i in range(1, sm):
	if sm % i == 0:
		now = 0
		flag = False
		for x in arr:
			now += x
			if now > i:
				flag = True
				break
			elif now == i:
				now = 0
		if now != 0:
			flag = True
		if not flag:
			print('YES')
			exit(0)
print('NO')


n = int(input())
s = input()
S = 0
for x in s:
	S += int(x)
if S == 0:
	print('YES')
else:
	A = 'NO'
	D = 1
	while D * D <= S:
		if S % D == 0:
			for d in (D, S // D):
				if d == S:
					continue
				(k, c) = (0, 0)
				while k < n:
					c += int(s[k])
					if c > d:
						break
					if c == d:
						c = 0
					k += 1
				if c == 0:
					A = 'YES'
					break
		if A == 'YES':
			break
		D += 1
	print(A)


n = int(input())
A = list(map(int, input()))
S = [A[0]]
for i in range(1, n):
	if A[i] != 0:
		S.append(A[i] + S[len(S) - 1])
ans = 'NO'
for d in S:
	k = 2
	for i in range(len(S) - 1):
		if d * k == S[i]:
			k += 1
	if S[len(S) - 1] == d * k:
		ans = 'YES'
		break
print(ans)


n = int(input())
a = map(int, input())
s = {0}
v = 0
for i in a:
	v += i
	s.add(v)
print('NYOE S'[v == 0 or any((v % i == 0 and all((v // i * j in s for j in range(i))) for i in range(2, v + 1)))::2])


n = int(input())
s = input()
for i in range(9 * n + 1):
	c = 0
	cur = 0
	for j in s:
		cur += int(j)
		if cur == i:
			c += 1
			cur = 0
	if cur == 0 and c > 1:
		print('YES')
		break
else:
	print('NO')


n = int(input())
a = [int(i) for i in input()]
for i in range(1, n):
	s = ss = 0
	for j in range(i):
		s += a[j]
	cnt = 1
	for j in range(i, n):
		ss += a[j]
		if ss == s:
			ss = 0
			cnt += 1
		if ss > s:
			break
	else:
		if ss == 0 and cnt > 1:
			print('YES')
			raise SystemExit
print('NO')


n = int(input())
num = input().replace('0', '')
n = len(num)
l = []
su = []
d = 0
for i in num:
	l.append(int(i))
	d += int(i)
	su.append(d)
fl = True
for i in range(n):
	d = i
	for j in range(i, n):
		if su[j] - su[d] == su[i]:
			d = j
			fl = True
		else:
			fl = False
	if fl:
		print('YES')
		break
if fl and n == 0:
	print('YES')
elif not fl:
	print('NO')


n = int(input())
a = [int(c) for c in input()]
while a and a[-1] == 0:
	a.pop()
n = len(a)
acc = [0] * (n + 1)
for i in range(1, n + 1):
	acc[i] = acc[i - 1] + a[i - 1]
res = n == 0
for l in range(1, n):
	pos = l
	res2 = True
	while pos < n and res2:
		for i in range(pos + 1, n + 1):
			if acc[i] - acc[pos] == acc[l]:
				pos = i
				break
			if acc[i] - acc[pos] > acc[l] or i == n:
				res2 = False
				break
	if res2:
		res = True
		break
print('YES' if res else 'NO')


import math
n = int(input())
mas = list(map(int, list(input().replace('0', ''))))
origin_summa = sum(mas)
summa = origin_summa
found = False
if mas == [] and n > 1:
	found = True
split_count = 2
while split_count <= origin_summa and (not found):
	while split_count <= summa and summa % split_count != 0:
		split_count += 1
	while summa % split_count == 0:
		summa //= split_count
	split_sum = origin_summa // split_count
	f_ind = 0
	ind = 0
	succsess = True
	while f_ind < split_count and succsess == True:
		count = 0
		while ind < n and count < split_sum:
			count += mas[ind]
			ind += 1
		if count != split_sum:
			succsess = False
		f_ind += 1
	if origin_summa % split_count == 0 and f_ind == split_count and (succsess == True):
		found = True
	split_count += 1
if found:
	print('YES')
else:
	print('NO')


n = int(input())
st = input()
s = 0
for i in range(n):
	s += int(st[i])
a = list(st)
for i in range(n):
	a[i] = int(a[i])
u = True
i = 0
d = 0
while u and i < n - 1:
	d += a[i]
	if d == 0:
		f = 0
		u1 = False
		h = 0
		p = 0
		j = i + 1
		while j <= n - 1:
			f += a[j]
			if f == d:
				f = 0
				p += 1
				h += d
				j += 1
			elif f > d:
				u1 = True
				break
			else:
				if p == 0 and j + 1 > n - 1:
					u1 = True
				j += 1
		if u1:
			i += 1
		elif h == s - d:
			print('YES')
			u = False
	elif s % d != 0:
		i += 1
	else:
		f = 0
		u1 = False
		h = 0
		p = 0
		j = i + 1
		while j <= n - 1:
			f += a[j]
			if f == d:
				f = 0
				p += 1
				h += d
				j += 1
			elif f > d:
				u1 = True
				break
			else:
				if p == 0 and j + 1 > n - 1:
					u1 = True
				j += 1
		if u1:
			i += 1
		elif h == s - d:
			print('YES')
			u = False
if u and i == n - 1:
	print('NO')


import sys, math, bisect
from random import randint
inf = float('inf')
mod = 998244353

def lcm(a, b):
	return int(a / math.gcd(a, b) * b)

def gcd(a, b):
	return int(math.gcd(a, b))

def tobinary(n):
	return bin(n)[2:]

def binarySearch(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	else:
		return -1

def lowerBound(a, x):
	i = bisect.bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def upperBound(a, x):
	i = bisect.bisect_right(a, x)
	if i != len(a) + 1 and a[i - 1] == x:
		return i - 1
	else:
		return -1

def primesInRange(n):
	ans = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			ans.append(p)
	return ans

def primeFactors(n):
	factors = []
	while n % 2 == 0:
		factors.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.append(i)
			n = n // i
	if n > 2:
		factors.append(n)
	return factors

def isPrime(n, k=5):
	if n < 2:
		return True
	for i in range(0, k):
		a = randint(1, n - 1)
		if pow(a, n - 1, n) != 1:
			return False
	return True
from collections import deque, defaultdict, Counter
import heapq, string
n = int(input())
s = input()
s = [int(i) for i in s]
flag = False
for i in range(0, 9 * n + 1):
	count = 0
	sum = 0
	for j in s:
		sum += j
		if sum == i:
			count += 1
			sum = 0
	if count > 1 and sum == 0:
		print('YES')
		exit(0)
print('NO')


n = int(input())
a = list(input())
for i in range(len(a)):
	a[i] = int(a[i])
s = sum(a)
for i in range(2, n + 1):
	if s % i == 0:
		b = s // i
		t_sum = 0
		t_k = 0
		for k in a:
			if t_k > i:
				break
			t_sum += k
			if t_sum < b:
				continue
			elif t_sum == b:
				t_sum = 0
				t_k += 1
				continue
			else:
				break
		if t_k == i:
			print('YES')
			return
print('NO')


def is_lucky(s):
	s = ''.join(s.split('0'))
	sum = 0
	for ch in s:
		sum += int(ch)
	if sum == 0:
		return True
	found_partition = False
	subsum = 0
	while subsum < sum and (not found_partition):
		pos = 0
		accum = 0
		subsum_overflow = False
		while pos < len(s) and (not subsum_overflow):
			accum += int(s[pos])
			if accum < subsum:
				found_partition = False
				pos += 1
			elif accum == subsum:
				found_partition = True
				accum = 0
				pos += 1
			else:
				subsum_overflow = True
		if pos != len(s):
			found_partition = False
		subsum += 1
	return found_partition
n = int(input())
s = input()
if is_lucky(s):
	print('YES')
else:
	print('NO')


input()
a = input()

def dividers(n):
	d = []
	for i in range(1, n):
		if n % i == 0:
			d.append(i)
	return d
s = sum(map(int, a))
if s == 0 and len(a) > 1:
	print('YES')
	exit()
a = a.replace('0', '')
d = dividers(s)
if len(d) == 0:
	print('NO')
	exit()
for div in d:
	flag = False
	flag2 = False
	cur_s = 0
	for sym in a:
		cur_s += int(sym)
		if cur_s > div:
			cur_s = 0
			flag2 = False
			flag = False
			break
		elif cur_s == div:
			if flag:
				flag2 = True
			else:
				flag = True
			cur_s = 0
	else:
		if (cur_s == div or cur_s == 0) and flag2:
			print('YES')
			exit()
print('NO')


n = eval(input())
arr = input()
tot = 0
for i in range(n):
	tot += int(arr[i])
flag = 0
for i in range(2, n + 1):
	if tot % i == 0:
		x = 0
		mark = 0
		for j in range(n):
			x += int(arr[j])
			if x > tot / i:
				mark = -1000
			elif x == tot / i:
				mark = mark + 1
				x = 0
		if mark == i:
			flag = 1
			break
print('YES' if flag else 'NO')


def fuck(n):
	dels = [1]
	d = 2
	while d * d < n:
		if n % d == 0:
			dels.append(d)
			dels.append(n // d)
		d += 1
	if d * d == n:
		dels.append(d)
	return dels

def main(sums, summa):
	dels = fuck(summa)
	i = 0
	while i < len(dels):
		flag = True
		ceil = summa // dels[i]
		for j in range(1, ceil):
			if dels[i] * j not in sums:
				flag = False
				i += 1
				break
		if flag:
			return True
	return False
n = int(input())
line = input().replace('', ' ')
a = list(map(int, line.split()))
summa = 0
sums = set()
for i in range(n):
	summa += a[i]
	sums.add(summa)
zeros = a.count(0)
if main(sums, summa) and zeros < n - 1 or zeros == n:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(el) for el in input()]
v = 0
s = 0
d = 0
k = 0
while (s != 0 or d < 2) and k < n:
	v += a[k]
	s = 0
	d = 0
	for i in a:
		s += i
		if v == s:
			d += 1
			s = 0
	k += 1
if s == 0 and d > 1:
	print('YES')
else:
	print('NO')


import math
import sys
amount = int(input())
string = input()
sum_ = sum([int(s) for s in string])
divisors = []
if sum_ == 0:
	print('YES')
	sys.exit(0)
for i in range(1, int(math.sqrt(sum_)) + 1):
	if sum_ % i == 0:
		if i * i != sum_:
			if i != sum_:
				divisors.append(i)
			if sum_ // i != sum_:
				divisors.append(sum_ // i)
		elif i != sum_:
			divisors.append(i)
flag = False
for divisor in divisors:
	curr_sum = 0
	flag_2 = False
	i = 0
	for _ in range(sum_ // divisor):
		while curr_sum < divisor and i < len(string):
			curr_sum += int(string[i])
			i += 1
		if curr_sum != divisor:
			flag_2 = True
			break
		curr_sum = 0
	if flag_2:
		continue
	else:
		flag = True
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
inp = input()
a = [int(x) for x in inp.strip()]
s = sum(a)
if len(a) == 1:
	print('NO')
elif s == 0:
	print('YES')
else:
	for k in range(1, s):
		if s % k != 0:
			continue
		ss = 0
		for i in range(len(a)):
			ss += a[i]
			if ss > k:
				break
			elif ss == k:
				ss = 0
		else:
			print('YES')
			break
	else:
		print('NO')


n = int(input())
a = [int(i) for i in list(input())]
s = sum(a)
for i in range(1000):
	flag = True
	j = 0
	tmp = 0
	cnt = 0
	while j < n and tmp <= i:
		tmp += a[j]
		if tmp == i:
			cnt += 1
			tmp = 0
		elif tmp > i:
			flag = False
			break
		j += 1
	if flag and cnt * i == s and (cnt >= 2):
		print('YES')
		exit()
print('NO')


n = int(input())
s = list(map(int, input()))
for i in range(0, 9 * n, 1):
	count = 0
	sum = 0
	for j in s:
		sum += j
		if sum == i:
			count += 1
			sum = 0
	if count >= 2 and sum == 0:
		print('YES')
		exit(0)
print('NO')


def check(i):
	s = 0
	for x in b:
		s += x
		if s == i:
			s = 0
	if s == 0:
		return True
	return False
a = int(input())
b = [int(i) for i in list(input())]
for i in range(max(1, sum(b))):
	if check(i):
		print('YES')
		break
else:
	print('NO')


(_, num) = (int(input()), [int(i) for i in input()])

def f(x):
	s = 0
	cnt = 0
	for i in num:
		s += i
		if s > x:
			return False
		if s == x:
			s = 0
			cnt += 1
	return cnt > 1 and s == 0
for i in range(sum(num) + 1):
	if f(i):
		print('YES')
		raise SystemExit
print('NO')


n = int(input())
a = list(map(int, input()))
bb = sum(a)
so_good = False
for i in range(2, n + 1):
	if bb % i == 0:
		z = 1
		now = 0
		bad = False
		while now != n:
			if now + z >= n:
				z = n - now
			summ = sum(a[now:z + now])
			if summ == bb // i or summ == 0:
				now += z
			elif z != n - now:
				ok = False
				for dop in range(n - now - z):
					summ += a[z + now + dop]
					if summ == bb // i:
						now += z + 1 + dop
						ok = True
						break
				if ok == False:
					bad = True
					break
			else:
				bad = True
				break
		if bad == False:
			so_good = True
			break
if so_good:
	print('YES')
else:
	print('NO')