Vasya and Golden Ticket

TimeLimit:1000MS  MemoryLimit:256MB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description

ecently Vasya found a golden ticket — a sequence which consists of n digits a1a2…an. 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 () — the number of digits in the ticket.

The second line contains n digits  () — the golden ticket. Digits are printed without spaces


Output

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

SampleInput 1
5
73452
SampleOutput 1
YES
SampleInput 2
4
1248
SampleOutput 2
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.
Submit
题目统计信息详细
总AC数18
通过人数18
尝试人数21
总提交量43
AC率41.86%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: