This page is still under construction.

Parts of this page are still being built. What you see may change.

Box

Time limit3sMemory limit512 MB

Summary
Given a box with edges a, b, c and a w by h cardboard, decide whether some edge-aligned net of the box fits on the cardboard.
Level

Hard8 of 10

Topics
Geometry, Brute force, Implementation, Math
Solved
No attempts yet

Problem

Bella works in a factory that makes boxes. Every box is a rectangular parallelepiped. To make one box, a net is cut out of a flat rectangular piece of cardboard of size w×hw \times h. The net is a polygon whose sides are all parallel to the sides of the cardboard. The net is bent along several lines and joined along the edges of the resulting parallelepiped to form the box. The net is bent only along the edges of the resulting box.

The first exampleThe third example

Bella is a software developer, and her task is to check whether a box of size a×b×ca \times b \times c can be made out of a single piece of cardboard of size w×hw \times h. Bella wrote that program and the factory is already producing boxes. Write the same program.

Input

The first line contains three integers aa, bb, and cc, the edge lengths of the box.

The second line contains two integers ww and hh, the width and the height of the cardboard.

All integers are positive and do not exceed 10810^8.

Output

Print Yes if a net of the a×b×ca \times b \times c box can be cut out of the w×hw \times h cardboard. Print No otherwise.

Hint

A cube has 11 different nets, counting rotations and mirror images as the same.

Examples3

  1. Example 1

    Input
    1 2 3
    6 5
    
    Expected output
    Yes
    
  2. Example 2

    Input
    1 2 3
    5 5
    
    Expected output
    No
    
  3. Example 3

    Input
    1 1 1
    10 2
    
    Expected output
    Yes