Close Enough Computations

Time limit1sMemory limit128 MB

Summary
Decide whether printed grams of fat, carbohydrate, and protein can come from true amounts whose calorie total rounds to the printed calories.
Level

Easy3 of 10

Topics
Math, Implementation, Brute force
Solved
No attempts yet

Problem

Sample nutritional food label

Nutritional food labels are everywhere; a sample label is shown above. On the label, the number of calories and the number of grams of fat, carbohydrate, and protein are all given as integers.

Reading a label carefully can reveal apparent inconsistencies. One gram of fat provides 99 calories, one gram of carbohydrate provides 44 calories, and one gram of protein provides 44 calories. For the sample label, a direct computation gives 12×9+31×4+5×4=25212 \times 9 + 31 \times 4 + 5 \times 4 = 252 calories, yet the label reports 250250 calories.

Sometimes such a difference comes from other factors (for example alcohol or soluble fiber), but here we consider only round-off error. This food actually contains 12.112.1 grams of fat (108.9108.9 calories), 30.630.6 grams of carbohydrate (122.4122.4 calories), and 4.74.7 grams of protein (18.818.8 calories), for a true total of 250.1250.1 calories — which indeed rounds to the printed 250250.

Write a program that decides whether the values on a nutritional label are consistent: that is, whether there exist true nutrient amounts that round to the printed grams and whose total calories round to the printed calorie count.

Assume standard rounding: any value below 0.50.5 rounds down, and any value of 0.50.5 or more rounds up. Because a nutrient amount cannot be negative, a printed value of 00 grams corresponds to a true amount in [0,0.5)[0, 0.5).

Input

The input contains one or more data sets, one per line. Each data set consists of 44 non-negative integers separated by one or more spaces: the number of calories, the grams of fat, the grams of carbohydrate, and the grams of protein, in that order. The number of calories is at most 1000010000, and the grams of any single component is at most 10001000.

Input ends with a line containing four zeros; that line is not processed.

Output

For each data set, print yes or no on its own line, indicating whether the printed grams of the three nutrients can yield the printed number of calories.

Examples2

  1. Example 1

    Input
    250 12 31 5
    250 13 31 5
    122 10 10 0
    0 0 0 0
    
    Expected output
    yes
    no
    no
    
  2. Example 2

    Input
    98 10 0 0
    99 10 0 0
    0 0 0 0
    
    Expected output
    yes
    no