Under construction

Still being built. Things may change

Exactly Electrical

Interview

Time limit1sMemory limit512 MB

Summary
Given start and destination grid points and a battery charge t, decide whether a walk of exactly t unit steps connects them.
Level

Easy3 of 10

Topics
Math, Implementation, Brute force
Solved
No attempts yet

Problem

Grid City is made of integer-numbered streets that run east to west (parallel to the x-axis) and integer-numbered avenues that run north to south (parallel to the y-axis). The streets and avenues have infinite length, and there is a street for every integer y-coordinate and an avenue for every integer x-coordinate. Every intersection is labelled by its integer coordinates. For example, avenue 7 and street −3-3 meet at (7,−3)(7, -3).

You drive an electric car that uses one unit of charge to move between two adjacent intersections: one unit to move north or south to the next street, and one unit to move east or west to the next avenue. While the battery still holds charge, at each intersection the car can turn left, turn right, go straight through, or make a U-turn. You may visit the same intersection several times on one trip.

You know your starting intersection, your destination intersection, and the amount of charge in the battery. Decide whether you can travel from the start to the destination so that the battery is empty exactly when you arrive.

Input

The input consists of three lines.

The first line contains two integers aa and bb, the starting coordinate (a,b)(a, b) (−1000≤a≤1000-1000 \le a \le 1000, −1000≤b≤1000-1000 \le b \le 1000).

The second line contains two integers cc and dd, the destination coordinate (c,d)(c, d) (−1000≤c≤1000-1000 \le c \le 1000, −1000≤d≤1000-1000 \le d \le 1000).

The third line contains an integer tt, the initial number of units of charge in the battery (0≤t≤100000 \le t \le 10000).

Output

Print Y if you can move from the starting coordinate to the destination coordinate using exactly tt units of charge. Otherwise print N.

Hint

Going from (3,4)(3, 4) through (4,4)(4, 4) and (4,3)(4, 3) to (3,3)(3, 3) uses 3 units of charge.

From (10,2)(10, 2) you can reach (10,4)(10, 4) with 2 units by driving north twice. You can also reach it with 4 units by passing through (10,3)(10, 3), (11,3)(11, 3), and (11,4)(11, 4). No path of length 5 reaches it.

From (10,2)(10, 2) you can reach (11,4)(11, 4) with 5 units by passing through (10,3)(10, 3), (11,3)(11, 3), (12,3)(12, 3), and (12,4)(12, 4).

Examples2

  1. Example 1

    Input
    3 4
    3 3
    3
    
    Expected output
    Y
    
  2. Example 2

    Input
    10 2
    10 4
    5
    
    Expected output
    N