D - Elections
Problem
A well-known South American
football club is about the have elections for its presidency. Since the last
elections were very disputed and generated a lot of controversy, the club is
now planning to use a weighted vote system, where each voter has a number of
votes according to the number of years he has been a member of to the club. The
clubÕs only doubt is how to divide the voters in terms of number of votes in
order to avoid possible ties between the two existing candidates.
Write a program to help the club
decide whether it is possible to have a tie giving a voters distribution.
Input
The input will consist of a sequence of
lines, each line represents a particular voters distribution problem to be
solved. Each line contains six space separated non-negative integers n1,
n2,É, n6, where ni is the number of voters
with number of votes vi (vi is 1, 2, 5, 10, 25 and 50
votes respectively, e.g., for i=3 the number votes is 5 and the number of
voters is denoted by n3). The maximum number of voters for any
number of votes is 10,000. Input is terminated by a single line with the number
-1.
Output
For each voting division problem print
either yes or no, depending on whether it is possible or not to have a tie .
Sample
Input
1 1 1 1 1
1
0 0 0 4 2
0
0 0 0 6 2
1
0 0 0 5 2
0
1 0 0 1005
1003 1001
4371 4283
9756 500 4879 1701
9999 10000
10000 10000 9997 9999
-1
Sample
Output
no
yes
yes
yes
no
yes
yes