You are given an infinite checkered field. You should get from a square (*x*<sub class="lower-index">1</sub>; *y*<sub class="lower-index">1</sub>) to a square (*x*<sub class="lower-index">2</sub>; *y*<sub class="lower-index">2</sub>). Using the shortest path is not necessary. You can move on the field squares in four directions. That is, when you are positioned in any square, you can move to any other side-neighboring one. 

A square (*x*; *y*) is considered bad, if at least one of the two conditions is fulfilled:
-  |*x* + *y*| ≡ 0 (*mod* 2*a*),-  |*x* - *y*| ≡ 0 (*mod* 2*b*).
Your task is to find the minimum number of bad cells one will have to visit on the way from (*x*<sub class="lower-index">1</sub>; *y*<sub class="lower-index">1</sub>) to (*x*<sub class="lower-index">2</sub>; *y*<sub class="lower-index">2</sub>).
The only line contains integers *a*, *b*, *x*<sub class="lower-index">1</sub>, *y*<sub class="lower-index">1</sub>, *x*<sub class="lower-index">2</sub> and *y*<sub class="lower-index">2</sub> — the parameters of the bad squares, the coordinates of the initial and the final squares correspondingly (2 ≤ *a*, *b* ≤ 10<sup class="upper-index">9</sup> and |*x*<sub class="lower-index">1</sub>|,|*y*<sub class="lower-index">1</sub>|,|*x*<sub class="lower-index">2</sub>|,|*y*<sub class="lower-index">2</sub>| ≤ 10<sup class="upper-index">9</sup>). It is guaranteed that the initial and the final square aren't bad.
2 2 1 0 0 1
1
2 2 10 11 0 1
5
2 4 3 -1 3 7
2
2 2 9 10 -10 -11
10
3 2 -11 -10 10 11
7
3 2 11 -12 -12 11
11
3 3 12 11 -12 -11
7
2 3 -12 13 13 -12
9
3 4 -8 5 6 -3
3
2 3 2 -1 -10 -1
3
4 4 3 2 10 -1
1
3 2 -8 -9 -14 -1
4
4 4 0 -3 11 -4
1
5 3 6 3 3 12
2
3 5 -4 -7 5 0
2
3 5 -20 19 21 16
7
5 6 23 -10 -20 -17
5
3 2 8 -25 0 25
15
7 7 23 28 -20 -27
7
7 7 -30 -29 32 31
9
5 8 35 -36 -34 33
9
2 9 37 34 -38 -37
36
10 8 -44 41 43 -38
11
8 9 8 -23 31 -46
3
11 10 9 -40 37 -56
2
11 5 -71 44 -18 -21
12
6 13 -37 12 3 60
8
14 9 44 45 -50 -9
6
14 16 1967781 241814 1873488 -829353
41624
8 12 -14763515 -11730382 -1343471 -4020758
1320604
18 17 -26078453 -12853708 26705417 -4593122
1695679
5 18 41299309 8851928 -40049166 -35564497
12576490
7 20 10771554 -46099323 39192337 54007626
9180553
21 24 31005425 54491054 -24732944 -61529693
4089503
24 27 -57405669 -65437426 56079726 56139299
4897128
17 22 72042304 -75756269 -70969649 64115614
6429178
31 29 73305636 76203147 -85238444 -86730133
5185118
34 19 -95432112 102651275 96089919 -106537520
10545022
26 34 -107153659 6976200 34136365 -95904822
3590751
38 5 -13548447 534376 64966608 -29272371
10832180
42 45 13921918 62207801 80023961 -85820354
2379224
15 11 -140506021 21571904 -148280972 64286933
2294999
53 50 -120558789 -138770904 4229051 102239338
3450925
29 54 16062290 129524399 -84381788 132177911
1686044
12 63 100712190 36906101 87205943 82885374
1353043
66 39 -170201625 -169447104 166170410 181151513
5204323
72 75 182000846 -19533501 -166922752 -142084479
3274129
55 22 189761193 -192020216 -153412991 188486816
16447301
86 84 -65173069 221707138 155388823 -224274366
3967520
77 101 -241379320 -196400933 220541904 214436435
5667263
70 110 221139524 -236077945 -236283510 205078897
4084454
18 116 231579605 226020224 -214399491 -217631436
24711966
133 122 -258888058 250173335 258738451 -242389122
4140119
127 88 66407013 205897916 133496817 264883406
496360
146 157 261464154 113810381 214579048 -202712885
1244549
148 163 -62225702 -294347345 -98578232 214557359
1672568
7 179 -249546082 207791883 267735483 49881404
25669363
125 204 91089644 83192699 -300075653 54365352
1679971
216 218 15106122 259371253 296596165 -45704666
1345335
207 226 -194940280 130461973 246251465 260969752
1380917
267 263 -291849914 -111930623 344642355 250706518
1871029
288 40 338359015 273791206 -341021431 56950660
5781749
321 30 46954660 -343679003 -37851471 373573736
13367648
356 10 97627462 341324361 -132835544 -334849729
22285554
380 397 -340890121 -349529418 396652406 353599055
1895619
388 113 366011910 -387447751 -403158698 353327235
6681175
465 469 376765675 358805048 -390193085 -375070460
1613801
504 116 -408147784 387006943 367365902 -415105789
6800114
509 565 14560229 -77153392 -340426524 82224911
455190
605 297 -251700323 -366763764 -445828791 325081312
1491538
689 635 344525358 -321493413 12979458 -353392841
263749
664 408 -151206136 -299481355 -385233545 310492602
1034315
783 827 -98613981 316213558 -275430891 455234090
190954
899 549 -249681750 38465319 105189786 -64009701
416527
868 969 245648369 212586392 258298826 -389155385
339339
1005 557 -451917708 -32771965 501646713 -357583032
1147554
1123 1126 438419485 487688122 -477080698 -185247601
707229
1174 901 522498777 -499217148 77740787 519316970
812037
1425 1444 516172942 520776621 -319341286 -488388923
647256
1576 15 -503228573 -531048974 531411118 557082183
1783049
1147 1627 473801348 -494462579 -514604760 486124951
605100
1811 1038 526157767 549399960 -479125660 -508887739
569733
2033 1908 -480144210 482795119 496763189 -594064604
538199
86 1341 -197343715 13981506 -529124963 208152056
800062
2455 2436 -335351804 -50788097 286734045 222304974
182317
2571 2243 474188235 -306739018 48936920 -83297677
144603
1558 2911 -239080974 -489789417 369291826 -67795521
330670
2795 3024 418200485 -575735266 101404272 -10209857
145887
3341 3479 481143880 -383576301 -584637231 166949262
232295
3868 1251 -639544998 21536679 -480078735 -457166436
255064
4260 4286 -559966975 430515446 630949753 -403746792
236255
4685 84 597126772 174658367 -667031403 657366658
10398014
5099 3763 239091250 -689089763 -331708609 690647436
259173
5431 5421 218916782 582895951 714645533 -634539842
158012
5989 6249 -605686335 -602992500 586207791 624769222
202009
4238 464 631928630 -699088687 -665579317 658247096
2860823
7368 7243 646513016 723552175 -631585348 -678824351
181900
6929 8303 -718092932 630511765 717136401 -678221530
165239
551 8823 -644698584 720097649 -746775493 -719362914
1398855
2036 9146 46737913 478540414 -603176411 -34978692
285715
10000 10002 96487781 -692179874 182133670 357089051
56746
4209 7951 232804958 -326325341 -138865076 516216059
76356
10005 10008 -234169778 -592210597 -126329886 -812018105
16370
8387 10012 -275798799 489020846 127010938 154401541
36828
10058 9799 -25054219 -611037250 172201377 486371190
64360
10088 6166 -735339950 -111273129 787180186 -439981865
150116
10311 10242 764996339 626041956 -740573838 -97126465
108076
10067 8186 -736794579 -820525762 -407728461 839527984
98794
10721 11225 -767745746 709747051 443545879 -717667636
117537
13225 984 -760662977 -854994174 786299019 825465374
122020
14699 14675 792934253 -867739654 -737526630 840318203
110341
20967 19929 821529452 892087465 -867106029 -836044344
81480
43649 46022 -793221994 750708255 871188328 -901390875
36031
25706 3236 867426580 143799455 254112907 -287546356
28116
222075 201776 -663198106 -381459887 -29690718 -65372649
2138
526654 264582 -19827600 -757880279 -903623062 -934193021
1337
34483 1001201 -483230679 -24466088 827887504 293189155
23617
840853 1638188 -425749679 502946202 -953467908 557484181
281
4237214 4640696 -612169083 -326390834 887479529 304518522
251
2959011 3049607 253816894 -342369389 610124947 440828496
192
31288011 27242802 -934902606 343371553 926119543 -195542560
44
6152051 53675778 964821583 85960172 -939564894 755134693
100
101304499 148554333 -590787464 -890180401 -117457421 997140710
12
134699726 208640218 514309071 801051734 276512437 -803859310
6
472555248 417950652 -897989583 -805741694 915661619 800897620
3
299386785 573704302 956852511 -973861202 -816995136 989470727
3
1000000000 1000000000 871940474 991768763 -914352281 -886310260
1
781751245 1000000000 -848188940 813653557 978830633 -825182414
1
999999999 1000000000 1000000000 -999999999 -1000000000 999999999
1
999999 100000 12345 54321 6789 9876
0
from sys import stdin
inp = stdin.readline

a, b, x1, y1, x2, y2 = map(int, inp().split())

m = max(x1+y1, x2+y2) % (2*a)
x = abs(x1+y1 - x2-y2)
if x >= m:
    ansA = (x - m)//(2*a) + 1
else:
    ansA = 0

m = max(x1-y1, x2-y2) % (2*b)
x = abs(x1-y1 - x2+y2)
if x >= m:
    ansB = (x - m)//(2*b) + 1
else:
    ansB = 0

print(max(ansA, ansB))
