Under construction

Still being built. Things may change

Absolutely Flat

Time limit2sMemory limit1024 MB

Summary
Given four leg lengths and one pad length, decide whether attaching the pad to at most one leg can make all four legs equal.
Level

Easy1 of 10

Topics
Implementation, Brute force
Solved
No attempts yet

Problem

Alice owns a table with four legs, and she wants it to be flat. The table is flat if all four legs have equal lengths.

Alice measured the current leg lengths and got a_1,a_2,a_3a\_1, a\_2, a\_3, and a_4a\_4. She also has a pad of length bb. She can attach the pad to one of the legs, which increases that leg's length by bb. She can also skip the pad and leave all legs unchanged. She has only one pad, so she cannot apply it twice to the same leg or to two different legs.

Determine whether Alice can make the table flat.

Input

The input contains five positive integers a_1,a_2,a_3,a_4a\_1, a\_2, a\_3, a\_4, and bb, each on a separate line (1≤a_i,b≤1001 \le a\_i, b \le 100).

Output

Print 11 if Alice can make the table flat, and 00 otherwise.

Hints

In the first example, the table is already flat, so no pad is needed.

In the second example, Alice can attach the pad to the third leg to make the table flat.

In the third and fourth examples, Alice cannot make the table flat.

Examples4

  1. Example 1

    Input
    10
    10
    10
    10
    5
    
    Expected output
    1
    
  2. Example 2

    Input
    13
    13
    5
    13
    8
    
    Expected output
    1
    
  3. Example 3

    Input
    50
    42
    42
    50
    8
    
    Expected output
    0
    
  4. Example 4

    Input
    20
    40
    10
    30
    2
    
    Expected output
    0