817A.md (2148B)
1 Source: https://codeforces.com/problemset/problem/817/A 2 3 A. Treasure Hunt 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 Captain Bill the Hummingbird and his crew recieved an interesting challenge offer. Some stranger gave them a map, potion of teleportation and said that only this potion might help them to reach the treasure. 22 23 Bottle with potion has two values *x* and *y* written on it. These values define four moves which can be performed using the potion: 24 25 *  26 *  27 *  28 *  29 30 Map shows that the position of Captain Bill the Hummingbird is (*x*1, *y*1) and the position of the treasure is (*x*2, *y*2). 31 32 You task is to tell Captain Bill the Hummingbird whether he should accept this challenge or decline. If it is possible for Captain to reach the treasure using the potion then output "YES", otherwise "NO" (without quotes). 33 34 The potion can be used infinite amount of times. 35 36 Input 37 38 The first line contains four integer numbers *x*1, *y*1, *x*2, *y*2 ( - 105 ≤ *x*1, *y*1, *x*2, *y*2 ≤ 105) — positions of Captain Bill the Hummingbird and treasure respectively. 39 40 The second line contains two integer numbers *x*, *y* (1 ≤ *x*, *y* ≤ 105) — values on the potion bottle. 41 42 Output 43 44 Print "YES" if it is possible for Captain to reach the treasure using the potion, otherwise print "NO" (without quotes). 45 46 Examples 47 48 Input 49 50 ``` 51 0 0 0 6 52 2 3 53 ``` 54 55 Output 56 57 ``` 58 YES 59 ``` 60 61 Input 62 63 ``` 64 1 1 3 6 65 1 5 66 ``` 67 68 Output 69 70 ``` 71 NO 72 ``` 73 74 Note 75 76 In the first example there exists such sequence of moves: 77 78 1.  — the first type of move 79 2.  — the third type of move