304_D. Rectangle Puzzle II_36715
You are given a rectangle grid. That grid's size is n × m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (x, y) (0 ≤ x ≤ n, 0 ≤ y ≤ m).

Your task is to find a maximum sub-rectangle on the grid (x1, y1, x2, y2) so that it contains the given point (x, y), and its length-width ratio is exactly (a, b). In other words the following conditions must hold: 0 ≤ x1 ≤ x ≤ x2 ≤ n, 0 ≤ y1 ≤ y ≤ y2 ≤ m, <image>.

The sides of this sub-rectangle should be parallel to the axes. And values x1, y1, x2, y2 should be integers.

<image>

If there are multiple solutions, find the rectangle which is closest to (x, y). Here "closest" means the Euclid distance between (x, y) and the center of the rectangle is as small as possible. If there are still multiple solutions, find the lexicographically minimum one. Here "lexicographically minimum" means that we should consider the sub-rectangle as sequence of integers (x1, y1, x2, y2), so we can choose the lexicographically minimum one.

Input

The first line contains six integers n, m, x, y, a, b (1 ≤ n, m ≤ 109, 0 ≤ x ≤ n, 0 ≤ y ≤ m, 1 ≤ a ≤ n, 1 ≤ b ≤ m).

Output

Print four integers x1, y1, x2, y2, which represent the founded sub-rectangle whose left-bottom point is (x1, y1) and right-up point is (x2, y2).

Examples

Input

9 9 5 5 2 1


Output

1 3 9 7


Input

100 100 52 50 46 56


Output

17 8 86 92
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import sys
import fractions

DEBUG = 0

def ReadIn():
    data = [int(x) for x in sys.stdin.read().split()]
    offset = 0
    while offset < len(data):
        board = data[offset], data[offset + 1]
        offset += 2
        center = data[offset], data[offset + 1]
        offset += 2
        ratio = data[offset], data[offset + 1]
        offset += 2
        yield board, center, ratio

def Solve(board, center, ratio):
    if DEBUG:
        print locals()
    gcd = fractions.gcd(*ratio)
    if DEBUG:
        print 'gcd =', gcd
    ratio = tuple(map(lambda x: x // gcd, ratio))
    if DEBUG:
        print 'ratio =', ratio
    times = min(map(lambda x, y: x // y, board, ratio))
    if DEBUG:
        print 'times =', times
    rect = tuple(map(lambda x: x * times, ratio))
    if DEBUG:
        print 'rect =', rect
    lowerLeft = map(lambda x, y: y - (x + 1) // 2, rect, center)
    upperRight = map(lambda x, y: y + x // 2, rect, center)
    if DEBUG:
        print 'ans =', lowerLeft, upperRight
    for idx in xrange(2):
        if lowerLeft[idx] < 0:
            upperRight[idx] -= lowerLeft[idx]
            lowerLeft[idx] = 0
        if upperRight[idx] > board[idx]:
            lowerLeft[idx] -= upperRight[idx] - board[idx]
            upperRight[idx] = board[idx]
    
    if DEBUG:
        print 'mod ans =', lowerLeft + upperRight
    
    print ' '.join(['%d'] * 4) % tuple(lowerLeft + upperRight)

    

if __name__ == '__main__':
    for board, center, ratio in ReadIn():
        Solve(board, center, ratio)

100 100 52 50 46 56
 9 9 5 5 2 1
 1000000000 1000000000 500000000 500000000 500000000 500000001
 47001271 53942737 7275347 1652337 33989593 48660013
 5664399 63519726 1914884 13554302 2435218 44439020
 100 100 32 63 2 41
 69914272 30947694 58532705 25740028 30431847 27728130
 1000000000 1000000000 448240235 342677552 992352294 907572080
 97253692 35192249 21833856 26094161 41611668 32149284
 4309493 76088457 2523467 46484812 909115 53662610
 1000000000 1000000000 286536427 579261823 230782719 575570138
 36830763 28058366 30827357 20792295 11047103 20670351
 41635044 16614992 36335190 11150551 30440245 13728274
 100 100 20 53 6 22
 1000000000 1000000000 1000000000 1000000000 1000000000 1
 1000000000 500 1000 400 11 122
 85759276 82316701 8242517 1957176 10225118 547026
 87453374 60940601 74141787 32143714 78082907 33553425
 33417574 19362112 17938303 4013355 10231192 2596692
 6561833 24532010 2773123 457562 6225818 23724637
 27087649 52123970 20327636 19640608 8481031 14569965
 100 100 44 36 96 21
 64748258 21983760 9107246 2437546 11247507 8924750
 27048166 72584165 4785744 2001800 24615554 27645416
 1063740 2675928 277215 2022291 204933 298547
 61430678 95017800 11901852 27772249 25202227 87778634
 71580569 68590917 4383746 13851161 9868376 8579752
 100 100 16 60 42 75
 1000000000 1000000000 503220555 167034539 244352073 511651840
 63651025 50179036 16141802 24793214 28944209 13993078
 70 10 20 5 5 3
 19213492 76256257 10302871 19808004 19174729 55280126
 51396415 50182729 20810973 38206844 17823753 2905275
 83973381 91192149 19059738 26429459 49573749 78006738
 98540143 28776614 12080542 1456439 96484500 3125739
 1000000000 1000000000 1000000000 1000000000 1 1
 1000000000 1000000000 867388331 312356312 405405075 887925029
 99373741 10548319 82293354 9865357 58059929 5328757
 1000000000 1000000000 839898171 196274842 131921537 865789406
 100 100 56 46 1 47
 71265727 62692710 12444778 3479306 21442685 5463351
 100 100 48 73 63 16
 100 100 13 59 14 20
 11996821 42550832 8901163 19214381 3510233 20406511
 1000000000 999999999 1000 1000 1000000000 999999999
 100 100 28 22 47 50
 1000000000 1000000000 42362139 725664533 91213476 617352813
 1000000000 1000000000 623214043 753726318 970868535 929707704
 75549175 99860242 42423626 6574859 73199290 26030615
 48445042 43730155 14655564 6244917 43454856 2866363
 1000000000 1000000000 837887296 643696230 478881476 45404539
 1000000000 1000000000 84072459 754904836 124007132 824006731
 81460 7041354 53032 1297536 41496 5748697
 1000000000 1000000000 259046267 313437250 252266478 848401810
 17818532 82586436 8482338 54895799 12444902 11112345
 60300478 3471217 11842517 3192374 27980820 507119
 47001271 53942737 7996754 1652337 33989593 48660013
 5664399 63519726 601222 13554302 2435218 44439020
 100 100 22 63 2 41
 69914272 30947694 58532705 25740028 30431847 20109914
 1000000000 1000000000 448240235 35540513 992352294 907572080
 63704129 35192249 21833856 26094161 41611668 32149284
 4309493 76088457 2523467 46484812 310886 53662610
 1000000000 1000001000 286536427 579261823 230782719 575570138
 36830763 28058366 30827357 2480225 11047103 20670351
 41635044 16614992 15367724 11150551 30440245 13728274
 100 100 14 53 6 22
 1000000000 500 1000 400 20 122
 85759276 125975096 8242517 1957176 10225118 547026
 87453374 60940601 66348783 32143714 78082907 33553425
 33417574 19362112 17938303 4013355 15436336 2596692
 6561833 24532010 394979 457562 6225818 23724637
 27087649 52123970 20327636 32838643 8481031 14569965
 100 100 0 36 96 21
 64748258 21983760 9107246 2050504 11247507 8924750
 27048166 72584165 4785744 2001800 24615554 3457907
 1446507 2675928 277215 2022291 204933 298547
 26554268 95017800 11901852 27772249 25202227 87778634
 100 100 16 24 42 75
 1000000000 1000000000 503220555 167034539 244352073 651973598
 70 10 20 1 5 3
 29881747 76256257 10302871 19808004 19174729 55280126
 51396415 50182729 28505521 38206844 17823753 2905275
 83973381 91192149 33340420 26429459 49573749 78006738
 98540143 28776614 12080542 1456439 96484500 4268987
 1000010000 1000000000 867388331 312356312 405405075 887925029
 1000000000 1000000000 839898171 238877193 131921537 865789406
 100 100 24 46 1 47
 71265727 62692710 12444778 6837805 21442685 5463351
 100 100 13 59 14 6
 11996821 42550832 8901163 28547059 3510233 20406511
 1010000000 999999999 1000 1000 1000000000 999999999
 100 100 28 22 47 99
 1000000000 1010000000 42362139 725664533 91213476 617352813
 1000000000 1000000000 623214043 753726318 970868535 66232863
 75549175 99860242 43044558 6574859 73199290 26030615
 48445042 43730155 23759196 6244917 43454856 2866363
 1000000000 1000010000 837887296 643696230 478881476 45404539
 1000000000 1000000000 84072459 306719602 124007132 824006731
 81460 7041354 53032 1832243 41496 5748697
 1000000000 1000000000 30799978 313437250 252266478 848401810
 17818532 82586436 8482338 77901725 12444902 11112345
 60300478 5027669 11842517 3192374 27980820 507119
 100 100 52 50 46 2
 5664399 63519726 601222 13554302 1238619 44439020
 100 100 21 63 2 41
 4309493 76088457 2523467 46484812 199386 53662610
 1000000000 1000001000 286536427 579261823 230782719 1150170645
 41635044 16614992 15367724 11150551 30440245 12131698
 100 100 14 53 6 35
 87453374 60940601 66348783 197017 78082907 33553425
 33417574 19362112 17938303 4013355 4543381 2596692
 47001271 53942737 4507392 1652337 33989593 48660013
 1000010000 1000000000 448240235 35540513 992352294 907572080
 36830763 28058366 30827357 2425729 11047103 20670351
 85759276 125975096 9472017 1957176 10225118 547026

17 8 86 92
 1 3 9 7
 250000000 249999999 750000000 750000000
 0 0 33989593 48660013
 697275 0 3132493 44439020
 30 18 34 100
 39482425 3219564 69914272 30947694
 0 0 992352294 907572080
 0 363858 45079307 35192249
 1887086 960803 3159847 76088457
 171145067 291476754 401927786 867046892
 25303805 7388015 36350908 28058366
 11194799 2886718 41635044 16614992
 6 1 33 100
 0 999999999 1000000000 1000000000
 978 12 1022 500
 0 0 81800944 4376208
 9370467 15367001 87453374 48920426
 166200 0 33417574 8439249
 0 0 6225818 23724637
 1644556 0 27087649 43709895
 0 25 96 46
 0 0 22495014 17849500
 0 0 24615554 27645416
 0 1183193 1024665 2675928
 0 0 25202227 87778634
 0 0 71545726 62203202
 0 0 56 100
 276322201 0 730118908 950210560
 0 10800136 57888418 38786292
 12 0 27 9
 38763 0 19213492 55280126
 0 34333144 47530008 42080544
 0 0 49573749 78006738
 0 0 96484500 3125739
 0 0 1000000000 1000000000
 594594925 0 1000000000 887925029
 41313812 5219562 99373741 10548319
 773937402 0 905858939 865789406
 55 0 57 94
 0 0 64328055 16390053
 16 65 79 81
 0 0 70 100
 4976355 0 11996821 40813022
 0 0 1000000000 999999999
 0 0 94 100
 0 176862916 121617968 1000000000
 29131465 70292296 1000000000 1000000000
 2349885 0 75549175 26030615
 0 4811735 43454856 7678098
 42237048 598291691 1000000000 689100769
 22068893 175993269 146076025 1000000000
 27916 0 78148 6958949
 132913028 0 385179506 848401810
 2259887 49339626 14704789 60451971
 0 2456979 55961640 3471217
 0 0 33989593 48660013
 0 0 2435218 44439020
 20 18 24 100
 39482425 10837780 69914272 30947694
 0 0 992352294 907572080
 0 363858 45079307 35192249
 2368024 19653507 2678910 73316117
 171145067 291476754 401927786 867046892
 25303805 0 36350908 20670351
 147601 2886718 30587846 16614992
 0 1 27 100
 960 12 1040 500
 0 0 81800944 4376208
 9370467 15367001 87453374 48920426
 2501967 1416663 33374639 6610047
 0 0 6225818 23724637
 1644556 8414075 27087649 52123970
 0 25 96 46
 0 0 22495014 17849500
 0 272846 24615554 3730753
 0 586099 1434531 2675928
 0 0 25202227 87778634
 0 0 56 100
 381044518 0 625396591 651973598
 12 0 27 9
 715506 0 19890235 55280126
 3866407 34333144 51396415 42080544
 8553545 0 58127294 78006738
 0 0 96484500 4268987
 594604925 0 1000010000 887925029
 773937402 0 905858939 865789406
 23 0 25 94
 0 0 64328055 16390053
 0 38 98 80
 4976355 1737810 11996821 42550832
 0 0 1000000000 999999999
 4 0 51 99
 0 186862916 121617968 1010000000
 29131465 720609886 1000000000 786842749
 2349885 0 75549175 26030615
 2031768 4811735 45486624 7678098
 42237048 598291691 1000000000 689100769
 22068893 0 146076025 824006731
 27916 0 78148 6958949
 0 0 252266478 848401810
 2259887 71474091 14704789 82586436
 0 2685255 55961640 3699493
 6 48 98 52
 0 0 1751151 62827580
 19 18 23 100
 2423774 19653507 2623160 73316117
 209608854 195871608 363464000 962652038
 147601 4483294 30587846 16614992
 8 18 20 88
 9370467 0 87453374 33553425
 1613907 0 33417574 18176844
 0 0 33989593 48660013
 0 0 992352294 907572080
 25303805 0 36350908 20670351
 0 0 81800944 4376208
