//package round220;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class A {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int n = ni(), m = ni(), x = ni(), y = ni(), a = ni(), b = ni();
		int min = 99999999;
		min = Math.min(min, ok(x, y, 1, 1, a, b, n, m));
		min = Math.min(min, ok(x, y, 1, m, a, b, n, m));
		min = Math.min(min, ok(x, y, n, 1, a, b, n, m));
		min = Math.min(min, ok(x, y, n, m, a, b, n, m));
		if(min == 99999999){
			out.println("Poor Inna and pony!");
		}else{
			out.println(min);
		}
	}

	int ok(int x, int y, int tx, int ty, int a, int b, int n, int m)
	{
		if((tx-x) % a != 0)return 999999999;
		if((ty-y) % b != 0)return 999999999;
		int dx = Math.abs((tx-x)/a);
		int dy = Math.abs((ty-y)/b);
		if((dx+dy) % 2 == 1)return 999999999;
		if(dx == 0 && dy != 0 && !(1 <= x-a || x+a <= n)){
			return 999999999;
		}
		if(dy == 0 && dx != 0 && !(1 <= y-b || y+b <= m)){
			return 999999999;
		}
		return Math.max(dx, dy);
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new A().run(); }

	private byte[] inbuf = new byte[1024];
	private int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Aleksandr
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int m = s.nextInt();
        int i = s.nextInt() - 1;
        int j = s.nextInt() - 1;
        int a = s.nextInt();
        int b = s.nextInt();
        int result = Math.min(Math.min(findWayTo(n, m, i, j, a, b, 0, 0), findWayTo(n, m, i, j, a, b, 0, m - 1)),
                Math.min(findWayTo(n, m, i, j, a, b, n - 1, 0), findWayTo(n, m, i, j, a, b, n - 1, m - 1)));
        if (result == Integer.MAX_VALUE) {
            System.out.println("Poor Inna and pony!");
        } else {
            System.out.println(result);
        }
    }

    public static int findWayTo(int n, int m, int x, int y, int a, int b, int i, int j) {
        int toN = Math.abs(i - x);
        int toM = Math.abs(j - y);
        if (toN % a != 0 || toM % b != 0) {
            return Integer.MAX_VALUE;
        }
        int c = toN / a;
        int d = toM / b;
        if ((c == 0 && d != 0) || (c != 0 && d == 0)) {
            if ((x + a >= n && x - a < 0) || (y + b >= m && y - b < 0)) {
                return Integer.MAX_VALUE;
            }
        }
        if ((c + d) % 2 == 0) {
            return Math.max(c, d);
        } else {
            return Integer.MAX_VALUE;
        }
    }

}

import java.util.Scanner;

public class Div2_220_A {
    static int n;
    static int m;
    static int i;
    static int j;
    static int a;
    static int b;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();
        i = in.nextInt();
        j = in.nextInt();
        a = in.nextInt();
        b = in.nextInt();

        System.out.println(solve());
    }

    public static String test(String input) {
        String[] nums = input.split(" ");
        n = Integer.valueOf(nums[0]);
        m = Integer.valueOf(nums[1]);
        i = Integer.valueOf(nums[2]);
        j = Integer.valueOf(nums[3]);
        a = Integer.valueOf(nums[4]);
        b = Integer.valueOf(nums[5]);

        return solve();
    }

    private static String solve() {
        if (inCorner(i, j)) {
            return "" + 0;
        }

        int res = Math.min(Math.min(length(1, 1), length(1, m)), Math.min(length(n, 1), length(n, m)));
        if (res == Integer.MAX_VALUE) {
            return "Poor Inna and pony!";
        } else {
            return "" + res;
        }
    }

    private static boolean inCorner(int x, int y) {
        return ((x == 1 && y == 1) || (x == 1 && y == m) || (x == n && y == 1) || (x == n && y == m));
    }

    private static int length(int x, int y) {
        int dx = Math.abs(i - x);
        int dy = Math.abs(j - y);

        if (dx % a == 0 && dy % b == 0) {

            int da = dx / a;
            int db = dy / b;

            if ((da & 1) != (db & 1)) {
                return Integer.MAX_VALUE;
            }

            if (da > db) {
                int k = b * db;
                if (k == 0) {
                    k = b;
                }
                if (j + k <= m || j - k >= 1) {
                    return da;
                }
            } else {
                int k = a * da;
                if (k == 0) {
                    k = a;
                }

                if (i + k <= n || i - k >= 1) {
                    return db;
                }
            }
        }

        return Integer.MAX_VALUE;
    }
}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class A {

    static StringTokenizer st;
    static BufferedReader br;
    static PrintWriter pw;
    static int a, b, i, j, INF = (int) 1e9;
    static boolean f1, f2;
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt();
        int m = nextInt();
        i = nextInt();
        j = nextInt();
        a = nextInt();
        b = nextInt();
        int ans = INF;
        f1 = Math.max(n-i, i-1) >= a;
        f2 = Math.max(m-j, j-1) >= b;
        ans = Math.min(ans, calc(1, 1));
        ans = Math.min(ans, calc(n, 1));
        ans = Math.min(ans, calc(1, m));
        ans = Math.min(ans, calc(n, m));
        if (ans==INF)
            System.out.println("Poor Inna and pony!");
        else
            System.out.println(ans);
        pw.close();
    }
    private static int calc(int i2, int j2) {
        int dx = Math.abs(i-i2), dy = Math.abs(j-j2);
        if (dx==0 && dy==0)
            return 0;
        if (!f1 || !f2)
            return INF;
        if (dx % a==0 && dy % b==0) {
            int x = dx / a, y = dy / b;
            if (Math.abs(x-y) % 2==0) {
                return Math.max(x, y);
            }
            return INF;
        }
        return INF;
    }
    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    private static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
    private static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
    private static String next() throws IOException {
        while (st==null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }
}

import java.util.Scanner;
import java.io.*;
import java.util.*;
public class CF2{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int i = sc.nextInt();
		int j = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int min = -1;
		//points are (1,1),(n,1),(1,m),(n,m)
		//both odd or even
		//completely divisible
		int[] x = new int[]{1,n,1,n};
		int[] y = new int[]{1,1,m,m};
		for(int k = 0; k < 4; k++){
		    int p = Math.abs(x[k]-i);
		    int q = Math.abs(y[k]-j);
		    if(p%a!=0 || q%b!=0){
		        continue;
		    }
		    p = p/a;
		    q = q/b;
		    if(p%2!=q%2){
		        continue;
		    }
		    int ans = Math.max(p,q);
		    if(min==-1 || ans<min){
		        min = ans;
		    }
		}
		if(a+i>n&&i-a<=0&&min!=0||b+j>m&&j-b<=0&&min!=0){
		    System.out.println("Poor Inna and pony!");
		}
		else if(min==-1){
		    System.out.println("Poor Inna and pony!");
		}
		else{
		    System.out.println(min);
		}
	}
}

/**
 * Created by Omar on 12/25/2015.
 */

import java.util.*;
import java.io.*;

public class InnaandPinkPony {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] parts=br.readLine().split(" ");
        int n=Integer.parseInt(parts[0]);
        int m=Integer.parseInt(parts[1]);
        int i=Integer.parseInt(parts[2]);
        int j=Integer.parseInt(parts[3]);
        int a=Integer.parseInt(parts[4]);
        int b=Integer.parseInt(parts[5]);
     int answer=Integer.MAX_VALUE;
        int [] rs= {1,n};
        int [] cs= {1,m};
        for(int r : rs)
            for(int c :cs){
                int dr=Math.abs(r-i);
                int dc=Math.abs(c-j);
                if((dr%a)==0 && (dc%b)==0){
                    int current=Math.min(answer,Math.max(dr/a,dc/b));
                    if((dr/a)==(dc/b)){
                        answer=current;
                    }
                    if((dr/a)%2==(dc/b)%2 && n>a && m>b){
                        answer=current;
                    }

                }

            }

        if(answer!=Integer.MAX_VALUE)System.out.println(answer);
        else
        System.out.println("Poor Inna and pony!");
        br.close();
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created with IntelliJ IDEA.
 * User: chinh
 * Date: 12/19/13
 * Time: 12:38 AM
 * To change this template use File | Settings | File Templates.
 */
public class R220D2A {
    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int i = Integer.parseInt(st.nextToken());
        int j = Integer.parseInt(st.nextToken());
        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());
        int[] u = {1,n,n,1};
        int[] v = {m,1,m,1};
        int result = Integer.MAX_VALUE;
        for(int e=0; e<4; e++){
            int x = Math.abs(u[e]-i);
            int y = Math.abs(v[e]-j);
            if(x==0 && y==0) result=0;
            if(x%a==0 && y%b==0){
                if((x/a)%2==(y/b)%2){
                    if(a<n&&b<m) result = Math.min(result, Math.max(x/a, y/b));
                }
            }
        }
        if(result==Integer.MAX_VALUE) System.out.println("Poor Inna and pony!"); else System.out.println(result);
    }
}

import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

import static java.lang.Math.abs;
import static java.lang.Math.max;
import static java.lang.Math.min;

public class InnaAndPinkPony implements Closeable {

    private InputReader in = new InputReader(System.in);
    private PrintWriter out = new PrintWriter(System.out);

    public void solve() {
        int n = in.ni();
        int m = in.ni();
        i = in.ni(); j = in.ni();
        a = in.ni(); b = in.ni();
        int ans = min(f(1, 1), min(f(1, m), min(f(n, 1), f(n, m))));
        if (ans == INF || (ans > 0 && (n <= a || m <= b))) {
            out.println("Poor Inna and pony!");
        } else {
            out.println(ans);
        }
    }

    private int i, j, a, b;
    private final int INF = (int) 1e9;

    private int f(int x, int y) {
        if ((i - x) % a == 0 && (j - y) % b == 0 && ((i - x) / a - (j - y) / b) % 2 == 0) {
            return max(abs((i - x) / a), abs((j - y) / b));
        }
        return INF;
    }

    @Override
    public void close() throws IOException {
        in.close();
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ni() {
            return Integer.parseInt(next());
        }

        public long nl() {
            return Long.parseLong(next());
        }

        public void close() throws IOException {
            reader.close();
        }
    }

    public static void main(String[] args) throws IOException {
        try (InnaAndPinkPony instance = new InnaAndPinkPony()) {
            instance.solve();
        }
    }
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int i = sc.nextInt();
		int j = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		if((i==1&&j==m)||(i==1&&j==1)||(i==n&&j==1)||(i==n&&j==m))
		{
			System.out.println(0);
			return;
		}
		int sol = Integer.MAX_VALUE;
		//case1 1 n
		int x = 1;
		int y = m;

		if(Math.abs(x-i)%a==0 && Math.abs(y-j)%b==0 && ((i-a)>0||(i+a)<=n) && ((j-b)>0||(j+b)<m))
		{
			int kk = Math.abs(x-i)/a;
			int kk2 = Math.abs(y-j)/b;
			if((kk%2==0 && kk2%2==0 )|| (kk%2==1 && kk2%2==1))
			{
				sol = Math.min(sol,Math.max(kk,kk2));
				//System.out.println(sol+" "+x+" "+y);
			}
		}
		x = 1;
		y = 1;
		if(Math.abs(x-i)%a==0 && Math.abs(y-j)%b==0 && ((i-a)>0||(i+a)<=n) && ((j-b)>0||(j+b)<m))
		{
			int kk = Math.abs(x-i)/a;
			int kk2 = Math.abs(y-j)/b;
			if((kk%2==0 && kk2%2==0 )|| (kk%2==1 && kk2%2==1))
			{
				sol = Math.min(sol,Math.max(kk,kk2));
				//System.out.println(sol+" "+x+" "+y);
			}
		}
		x = n;
		y = 1;
		if(Math.abs(x-i)%a==0 && Math.abs(y-j)%b==0 && ((i-a)>0||(i+a)<=n) && ((j-b)>0||(j+b)<m))
		{
			int kk = Math.abs(x-i)/a;
			int kk2 = Math.abs(y-j)/b;
			if((kk%2==0 && kk2%2==0 )|| (kk%2==1 && kk2%2==1))
			{
				sol = Math.min(sol,Math.max(kk,kk2));
				//System.out.println(sol+" "+x+" "+y);
			}
		}
		x = n;
		y = m;
		if(Math.abs(x-i)%a==0 && Math.abs(y-j)%b==0 && ((i-a)>0||(i+a)<=n) && ((j-b)>0||(j+b)<m))
		{
			int kk = Math.abs(x-i)/a;
			int kk2 = Math.abs(y-j)/b;
			if((kk%2==0 && kk2%2==0 )|| (kk%2==1 && kk2%2==1))
			{
				sol = Math.min(sol,Math.max(kk,kk2));
				//System.out.println(sol+" "+x+" "+y);
			}
		}
		if(sol==Integer.MAX_VALUE)
			System.out.println("Poor Inna and pony!");
		else
		{
			System.out.println(sol);
		}
	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by noureldin on 7/24/16.
 */
public class Main {
    private static BufferedReader br;
    private static StringTokenizer st;
    private static int getNext() throws Exception{
        if(br == null) br = new BufferedReader(new InputStreamReader(System.in));
        while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return Integer.parseInt(st.nextToken());
    }
    private static int oo = Integer.MAX_VALUE;
    private static int get(int x,int y,int a,int b){
        //System.out.printf("(%d,%d) * (%d,%d)\n",x,y,a,b);
        int ret = 0;
        if(x%a!=0 || y%b != 0) ret = oo;
        else {
            a = x / a;
            b = y / b;
            if((a&1) != (b&1)) ret = oo;
            else ret = Math.max(a, b);
        }
        //System.out.printf("(%d,%d) * (%d,%d) = %d\n",x,y,a,b,ret);
        return ret;
    }
    private static Boolean good(int x,int dx,int n){
        if(x > dx) return true;
        return n - x >= dx;
    }

    public static void main(String[] args) throws Exception{
        int m = getNext(),n = getNext(),i = getNext(),j = getNext(),a = getNext(),b = getNext();
        int ans = oo;
        ans = Math.min(ans,get(i-1,j-1,a,b));
        ans = Math.min(ans,get(i-1,n-j,a,b));
        ans = Math.min(ans,get(m-i,j-1,a,b));
        ans = Math.min(ans,get(m-i,n-j,a,b));
        if((!good(i,a,m) || !good(j,b,n)) && ans != 0)ans = oo;
        if(ans == oo) System.out.println("Poor Inna and pony!");
        else System.out.println(ans);
    }

}

import java.util.*;
import static java.lang.System.*;

public class Solution {
	Scanner sc = new Scanner (System.in);
	int n = sc.nextInt() , m = sc.nextInt() , i = sc.nextInt() , j = sc.nextInt() , a = sc.nextInt() , b = sc.nextInt();
	void solve() {
		int ans = 99999999;

		ans = Math.min(ans, check(1 , 1));
		ans = Math.min(ans, check(1 , m));
		ans = Math.min(ans, check(n , 1));
		ans = Math.min(ans, check(n , m));

		if (ans == 99999999) {
			out.println("Poor Inna and pony!");
		} else {
			out.println(ans);
		}
	}

	int check (int x , int y ) {
		if (x == i && y == j) return 0;
		if (x <= a && x + a > n) return 99999999;
		if (y <= b && y + b > m) return 99999999;
		int dx = Math.abs(x - i) , dy = Math.abs(y - j);
		if (dx % a == 0 && dy % b == 0 && (dx/a - dy/b) % 2 == 0) return Math.max(dx/a, dy/b);
		return 99999999;
	}
	public static void main (String args[]) {
		Solution s = new Solution();
		s.solve();
	}
}

import java.util.*;
import static java.lang.System.*;

public class Solution {
	void solve() {
		Scanner sc = new Scanner (System.in);
		int n = sc.nextInt() , m = sc.nextInt() , i = sc.nextInt() , j = sc.nextInt() , a = sc.nextInt() , b = sc.nextInt();
		int ans = 99999999;

		ans = Math.min(ans, check(1 , 1 , i , j , a , b , n , m));
		ans = Math.min(ans, check(1 , m , i , j , a , b , n , m));
		ans = Math.min(ans, check(n , 1 , i , j , a , b , n , m));
		ans = Math.min(ans, check(n , m , i , j , a , b , n , m));

		if (ans == 99999999) {
			out.println("Poor Inna and pony!");
		} else {
			out.println(ans);
		}
	}

	int check (int x , int y , int i , int j , int a , int b , int n , int m) {
		if (x == i && y == j) return 0;
		if (x <= a && x + a > n) return 99999999;
		if (y <= b && y + b > m) return 99999999;
		int dx = Math.abs(x - i) , dy = Math.abs(y - j);
		if (dx % a == 0 && dy % b == 0 && (dx/a - dy/b) % 2 == 0) return Math.max(dx/a, dy/b);
		return 99999999;
	}
	public static void main (String args[]) {
		Solution s = new Solution();
		s.solve();
	}
}

import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class CF374A_InnaAndPinkPony extends PrintWriter {
    private static int iMax = Integer.MAX_VALUE;

    private static int get(int x, int y, int a, int b) {
        int ret;
        if (x % a != 0 || y % b != 0)
            ret = iMax;
        else {
            a = x / a;
            b = y / b;
            if ((a & 1) != (b & 1))
                ret = iMax;
            else
                ret = max(a, b);
        }

        return ret;
    }

    private static Boolean good(int x, int dx, int n) {
        if (x > dx) return true;
        return n - x >= dx;
    }

    public void solve() throws IOException {
        int m = readInt(), n = readInt(), i = readInt(), j = readInt(), a = readInt(), b = readInt();
        int ans = iMax;
        ans = min(ans, get(i - 1, j - 1, a, b));
        ans = min(ans, get(i - 1, n - j, a, b));
        ans = min(ans, get(m - i, j - 1, a, b));
        ans = min(ans, get(m - i, n - j, a, b));
        if ((!good(i, a, m) || !good(j, b, n)) && ans != 0) ans = iMax;
        if (ans == iMax)
            println("Poor Inna and pony!");
        else
            println(ans);
    }

    BufferedReader in;
    StringTokenizer stok;

    public void run() {
        try {
            solve();
            close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(abs(-1));
        }
    }

    CF374A_InnaAndPinkPony() {
        super(System.out);
        in = new BufferedReader(new InputStreamReader(System.in));
    }

    public static void main(String[] args) {
        try {
            Locale.setDefault(Locale.US);
        } catch (Exception ignored) {
        }
        new CF374A_InnaAndPinkPony().run();
    }

    String read() throws IOException {
        while (stok == null || !stok.hasMoreTokens()) {
            String s = in.readLine();
            if (s == null) {
                return null;
            }
            stok = new StringTokenizer(s);
        }
        return stok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(read());
    }

    long readLong() throws IOException {
        return Long.parseLong(read());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(read());
    }

    int[] readIntArray(int len) throws IOException {
        int[] a = new int[len];
        for (int i = 0; i < len; i++) {
            a[i] = readInt();
        }
        return a;
    }

    <T> List<T>[] createAdjacencyList(int countVertex) {
        List<T>[] res = new List[countVertex];
        for (int i = 0; i < countVertex; i++) {
            res[i] = new ArrayList<T>();
        }
        return res;
    }
}

import java.util.Scanner;

public class InnaAndPinkPony {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(), m = in.nextInt();
        int i = in.nextInt(), j = in.nextInt();
        int a = in.nextInt(), b = in.nextInt();
        int[] ci = {1, n, n, 1};
        int[] cj = {m, 1, m, 1};
        int ans = Integer.MAX_VALUE;
        for (int k = 0; k < 4; ++k) {
            int dx = Math.abs(i - ci[k]);
            int dy = Math.abs(j - cj[k]);
            if (ci[k] == i && cj[k] == j)
                ans = 0;
            if (dx % a != 0 || dy % b != 0|| (dx / a) % 2 != (dy / b) % 2 ||
                    (a + i > n && i <= a) || (b + j > m && m <= b))
                continue;
            ans = Math.min(ans, Math.max(dx / a, dy / b));
        }
        if (ans == Integer.MAX_VALUE)
            System.out.println("Poor Inna and pony!\n");
        else
            System.out.println(ans + "\n");
    }
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.StringTokenizer;

public class a {

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder q = new StringBuilder();
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));

		String y[] = in.readLine().split(" ");
		int n = Integer.parseInt(y[0]);
		int m = Integer.parseInt(y[1]);
		int i = Integer.parseInt(y[2]);
		int j = Integer.parseInt(y[3]);
		int a = Integer.parseInt(y[4]);
		int b = Integer.parseInt(y[5]);
		int x1[] = { 1, 1, n, n };
		int y1[] = { 1, m, 1, m };
		int k;
		int min = Integer.MAX_VALUE;
		for (k = 0; k < 4; k++) {
			int one = Math.abs(x1[k] - i);
			int two = Math.abs(y1[k] - j);
			if (one % a == 0 && two % b == 0
					&& ((one / a) + (two / b)) % 2 == 0) {
				int kk = (int) Math.max(one / a, two / b);
				if (kk < min)
					min = kk;

			}
		}
		if(min==0)
			System.out.println(min);

		else if (min == Integer.MAX_VALUE||(i+a>n&&i-a<1)||(j+b>m&&j-b<1))
			System.out.println("Poor Inna and pony!");
		else {

			System.out.println(min);
		}
		out.close();

	}
}

import java.util.Scanner;

public class Inna_and_Pink_Pony {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		int i = in.nextInt();
		int j = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();
		int[] cornerX = {1,n}, cornerY = {1,m};
		int minMove = -1;
		boolean canMove = false;
				if((i+a <= n || i-a >= 1) && (j+b <= m || j-b >= 1))
					canMove=true;
		for (int ii = 0; ii < cornerX.length; ii++)
		{
			for (int jj = 0; jj < cornerY.length; jj++)
			{
				int x = cornerX[ii], y = cornerY[jj];

				int dx = Math.abs(i-x), dy = Math.abs(j-y);

				if ((dx % a != 0) || (dy % b != 0)) continue;

				int nx = dx/a, ny = dy/b;

				if (nx % 2 != ny % 2) continue;

				if (!canMove && nx != ny) continue;

				int max = Math.max(nx, ny);

				if (minMove == -1 || max < minMove) minMove = max;
			}
		}
		System.out.println(minMove == -1 ? "Poor Inna and pony!" : minMove);
	}

}

import java.io.*;
import java.util.StringTokenizer;

public class Solution {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        String str = br.readLine();
        StringTokenizer st = new StringTokenizer(str, " ");
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int i = Integer.parseInt(st.nextToken());
        int j = Integer.parseInt(st.nextToken());
        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());
        int ans1 = canBeReached(i, j, 1, m, a, b, n, m);
        int ans2 = canBeReached(i, j, n, m, a, b, n, m);
        int ans3 = canBeReached(i, j, n, 1, a, b, n, m);
        int ans4 = canBeReached(i, j, 1, 1, a, b, n, m);
        int result = Math.min(ans1, Math.min(ans2, Math.min(ans3, ans4)));
        if (result == Integer.MAX_VALUE) {
            bw.write("Poor Inna and pony!");
        } else {
            bw.write(result + "\n");
        }
        bw.flush();
    }

    public static int canBeReached(int x1, int y1, int x2, int y2, int a, int b, int l, int w) {
        if ((x1 - x2) % a != 0 || (y1 - y2) % b != 0) {
            return Integer.MAX_VALUE; //cannot be reached
        }
        int a1 = (Math.abs(x1 - x2) / a) % 2;
        int a2 = (Math.abs(y1 - y2) / b) % 2;
        if (a1 != a2) {
            return Integer.MAX_VALUE;   //both should be even or both should be odd
        }
        int steps = Math.max(Math.abs(x1 - x2) / a, Math.abs(y1 - y2) / b);
        if (Math.abs(x1 - x2) / a > Math.abs(y1 - y2) / b) {  //checking boundary conditions
            if (b + 1 > w) {
                return Integer.MAX_VALUE;
            }
        }
        if (Math.abs(x1 - x2) / a < Math.abs(y1 - y2) / b) {  //checking boundary conditions
            if (a + 1 > l) {
                return Integer.MAX_VALUE;
            }
        }
        return steps;
    }
}

import java.io.*;
import java.util.StringTokenizer;

public class Solution {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        String str = br.readLine();
        StringTokenizer st = new StringTokenizer(str, " ");
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int i = Integer.parseInt(st.nextToken());
        int j = Integer.parseInt(st.nextToken());
        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());
        int ans1 = canBeReached(i, j, 1, m, a, b, n, m);
        int ans2 = canBeReached(i, j, n, m, a, b, n, m);
        int ans3 = canBeReached(i, j, n, 1, a, b, n, m);
        int ans4 = canBeReached(i, j, 1, 1, a, b, n, m);
        int result = Math.min(ans1, Math.min(ans2, Math.min(ans3, ans4)));
        if (result == Integer.MAX_VALUE) {
            bw.write("Poor Inna and pony!");
        } else {
            bw.write(result + "\n");
        }
        bw.flush();
    }

    public static int canBeReached(int x1, int y1, int x2, int y2, int a, int b, int l, int w) {
        if ((x1 - x2) % a != 0 || (y1 - y2) % b != 0) {
            return Integer.MAX_VALUE; //cannot be reached
        }
        int a1 = (Math.abs(x1 - x2) / a) % 2;
        int a2 = (Math.abs(y1 - y2) / b) % 2;
        if (a1 != a2) {
            return Integer.MAX_VALUE;   //both should be even or both should be odd
        }
        int steps = Math.max(Math.abs(x1 - x2) / a, Math.abs(y1 - y2) / b);
        if (Math.abs(x1 - x2) / a > Math.abs(y1 - y2) / b) {
            if (b + 1 > w) {
                return Integer.MAX_VALUE;
            }
        }
        if (Math.abs(x1 - x2) / a < Math.abs(y1 - y2) / b) {
            if (a + 1 > l) {
                return Integer.MAX_VALUE;
            }
        }
        return steps;
    }
}

import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.io.*;

public class Main {

    public static void main(String[] args) throws IOException {
        try {
            if (new File("input.txt").exists())
                System.setIn(new FileInputStream("input.txt"));
        } catch (SecurityException e) {
        }
        new Main().run();
    }

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    final int INF = Integer.MAX_VALUE / 2;

    private void solve() throws IOException {
        int n = nextInt(), m = nextInt(), i = nextInt(), j = nextInt(), a = nextInt(), b = nextInt();
        int ans1 = INF, ans2 = INF, ans3 = INF, ans4 = INF;
        if ((i == 1 && j == 1) || (i == n && j == 1) || (i == n && j == m) || (i == 1 && j == m))
            ans1 = 0;
        else if (a < n && b < m) {

            if ((m - j) % b == 0 && (n - i) % a == 0 && (m - j) / b == (n - i) / a && j != m && i != n)
                ans1 = (m - j) / b;
            if ((m - j) % b == 0 && (i - 1) % a == 0 && (m - j) / b == (i - 1) / a && j != m && i != 1)
                ans2 = (m - j) / b;
            if ((j - 1) % b == 0 && (i - 1) % a == 0 && (j - 1) / b == (i - 1) / a && j != 1 && i != 1)
                ans3 = (j - 1) / b;
            if ((j - 1) % b == 0 && (n - i) % a == 0 && (j - 1) / b == (n - i) / a && j != 1 && i != n)
                ans4 = (j - 1) / b;

            if ((m - j) % b == 0 && (n - i) % a == 0 && ((m - j) / b) % 2 == ((n - i) / a) % 2 && j != m
                    && i != n)
                ans1 = min(ans1, max((m - j) / b, (n - i) / a));
            if ((m - j) % b == 0 && (i - 1) % a == 0 && ((m - j) / b) % 2 == ((i - 1) / a) % 2 && j != m
                    && i != 1)
                ans2 = min(ans2, max((m - j) / b, (i - 1) / a));
            if ((j - 1) % b == 0 && (i - 1) % a == 0 && ((j - 1) / b) % 2 == ((i - 1) / a) % 2 && j != 1
                    && i != 1)
                ans3 = min(ans3, max((j - 1) / b, (i - 1) / a));
            if ((j - 1) % b == 0 && (n - i) % a == 0 && ((j - 1) / b) % 2 == ((n - i) / a) % 2 && j != 1
                    && i != n)
                ans4 = min(ans4, max((j - 1) / b, (n - i) / a));

            if (i == 1 || i == n) {
                if ((m - j) % b == 0 && ((m - j) / b) % 2 == 0)
                    ans1 = min(ans1, (m - j) / b);
                if ((j - 1) % b == 0 && ((j - 1) / b) % 2 == 0)
                    ans1 = min(ans1, (j - 1) / b);
            } else if (j == 1 || j == m) {
                if ((n - i) % a == 0 && ((n - i) / a) % 2 == 0)
                    ans1 = min(ans1, (n - i) / a);
                if ((i - 1) % a == 0 && ((i - 1) / a) % 2 == 0)
                    ans1 = min(ans1, (i - 1) / a);
            }
        }
        int ans = min(ans1, min(ans2, min(ans3, ans4)));
        if (ans == INF)
            out.println("Poor Inna and pony!");
        else
            out.println(ans);
    }

    int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    void arrayToString(int[] m) {
        Arrays.toString(m);
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextLine() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }
    boolean EOF() throws IOException {
        while (!st.hasMoreTokens()) {
            String s = in.readLine();
            if (s == null)
                return true;
            st = new StringTokenizer(s);
        }
        return false;
    }
}

// author: Ahmed A.M
import java.util.*;
import java.io.*;

public class Main {

    public static void main(String[] args) throws FileNotFoundException {
        //Scanner input = new Scanner(System.in);
        //S1 p1 = new S1();   p1.solve();
        //S2 p2 = new S2();   p2.solve();
        //S3 p3 = new S3();   p3.solve();
        //S4 p4 = new S4();   p4.solve();
        //S5 p5 = new S5();   p5.solve();
        //S6 p6 = new S6();   p6.solve();
        //S7 p7 = new S7();   p7.solve();
        //S8 p8 = new S8();   p8.solve();
        //S9 p9 = new S9();   p9.solve();
        //S10 p10 = new S10();    p10.solve();
        //S11 p11 = new S11();    p11.solve();
        //S12 p12 = new S12();    p12.solve();
        //S13 p13 = new S13();    p13.solve(); *  confusing
        //S14 p14 = new S14();    p14.solve();
        //S15 p15 = new S15();    p15.solve();
        //S16 p16 = new S16();    p16.solve();
        //S17 p17 = new S17();    p17.solve();
        //S18 p18 = new S18();    p18.solve(); * without help?
        //S19 p19 = new S19();    p19.solve(); * without set ?
        //S20 p20 = new S20();    p20.solve(); * confusing * Data Types
        //S21 p21 = new S21();    p21.solve(); * confusing and fuzzy thinking
        //S22 p22 = new S22();    p22.solve();
        //S23 p23 = new S23();    p23.solve(); * very annoying problem in very annoying moments
        //S24 p24 = new S24();    p24.solve();
        //S25 p25 = new S25();    p25.solve();
        //S26 p26 = new S26();    p26.solve();
        //S27 p27 = new S27();    p27.solve();
        //S28 p28 = new S28();    p28.solve();
        //S29 p29 = new S29();    p29.solve();
        //S30 p30 = new S30();    p30.solve();
        //S31 p31 = new S31();    p31.solve();
        //S32 p32 = new S32();    p32.solve();
        //S33 p33 = new S33();    p33.solve();
        //S34 p34 = new S34();    p34.solve();
        //S35 p35 = new S35();    p35.solve();
        //S36 p36 = new S36();    p36.solve(); * Repeated mistakes
        //S37 p37 = new S37();    p37.solve();
        //S38 p38 = new S38();    p38.solve();
        //S39 p39 = new S39();    p39.solve(); * Not good
        //S40 p40 = new S40();    p40.solve();
        //S41 p41 = new S41();    p41.solve(); * Observations
        //S42 p42 = new S42();    p42.solve();
        //S43 p43 = new S43();    p43.solve(); * don't understand it
        //S45 p45 = new S45();    p45.solve(); * 2
        //S46 p46 = new S46();    p46.solve(); * 1
        //S47 p47 = new S47();    p47.solve(); * 1
        //S48 p48 = new S48();    p48.solve(); * 1
        //S49 p49 = new S49();    p49.solve(); * 4 * Cascading of mistakes
        //S50 p50 = new S50();    p50.solve(); * 2 I've to eat now
        //S51 p51 = new S51();    p51.solve(); * 1
        //S52  p52 = new S52();  p52.solve();  * 2
        //S53 p53 = new S53();    p53.solve(); * 3
        //S54 p54 = new S54();    p54.solve(); * 1
        //S55 p55 = new S55();    p55.solve(); * 1
        //S56 p56 = new S56();    p56.solve(); * 1
        //S57 p57 = new S57();    p57.solve(); * 1
        //S58 p58 = new S58();    p58.solve(); * 3
        //S59 p59 = new S59();    p59.solve(); * 1
        //S60 p60 = new S60();    p60.solve(); * 1
        //S61 p61 = new S61();    p61.solve(); * 1
        //S62 p62 = new S62();    p62.solve(); * 1
        //S63 p63 = new S63();    p63.solve(); * 1
        //S64 p64 = new S64();    p64.solve(); *
        // -----
        //S67 p67 = new S67();    p67.solve(); * 2
        //S68 p68 = new S68();    p68.solve(); * 1
        //S69 p69 = new S69();    p69.solve();
        //S70 p70 = new S70();    p70.solve(); * 1
        //S71 p71 = new S71();    p71.solve();
        //S72 p72 = new S72();    p72.solve();
        //S73 p73 = new S73();    p73.solve();
        //S74 p74 = new S74();    p74.solve(); * 2
        //S78 p78 = new S78();    p78.solve(); * 1
        //S79 p79 = new S79();    p79.solve(); * 1
        //S80 p80 = new S80();    p80.solve(); * 1
        //S81 p81 = new S81();    p81.solve(); * inf
        //S82 p82 = new S82();    p82.solve(); * 2
        //S83 p83 = new S83();    p83.solve(); * 1
        //S84 p84 = new S84();    p84.solve(); * 1
        //S85 p85 = new S85();    p85.solve(); * 2
        //S86 p86 = new S86();    p86.solve(); * 1
        //S87 p87 = new S87();    p87.solve(); * ??
        //S88 p88 = new S88();    p88.solve(); * 1
        //S89 p89 = new S89();    p89.solve(); * 1
        //S90 p90 = new S90();    p90.solve(); * 1
        //S91 p91 = new S91();    p91.solve(); * 1
        //S92 p92 = new S92();    p92.solve(); * 1
        //S93 p93 = new S93();    p93.solve(); * 1
        //S94 p94 = new S94();    p94.solve(); * 1
        //S95 p95 = new S95();    p95.solve(); * 1
        //S96 p96 = new S96();    p96.solve(); * 1
        //S97 p97 = new S97();    p97.solve(); * 2
        //S98 p98 = new S98();    S98.solve(); * 1
        //S99 p99 = new S99();    S99.solve(); * 1 h
        //S100 p100 = new S100();   S100.solve();
        S101 p101 = new S101();     p101.solve();

    }
}

class S101 {
    Scanner input = new Scanner(System.in);
    int n = input.nextInt();
    int m = input.nextInt();
    int i = input.nextInt();
    int j = input.nextInt();
    int a = input.nextInt();
    int b = input.nextInt();

    public  void solve(){
        int ans = 10000000;
        ans = Math.min(ans, calc_d(1,1));
        ans = Math.min(ans, calc_d(1,m));
        ans = Math.min(ans, calc_d(n,1));
        ans = Math.min(ans, calc_d(n,m));
        if (ans > 1000000)
            System.out.println("Poor Inna and pony!");
        else
            System.out.println(ans);
    }

    int calc_d (int x , int y ) {
            if (x == i && y == j) return 0;
            if (x <= a && x + a > n) return 99999999;
            if (y <= b && y + b > m) return 99999999;
            int dx = Math.abs(x - i) , dy = Math.abs(y - j);
            if (dx % a == 0 && dy % b == 0 && (dx/a - dy/b) % 2 == 0) return Math.max(dx/a, dy/b);
            return 99999999;
    }

}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author ocozalp
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        int i = in.nextInt();
        int j = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();

        int result = getCount(i, j, 1, 1, a, b, n, m);
        result = Math.min(result, getCount(i, j, 1, m, a, b, n, m));
        result = Math.min(result, getCount(i, j, n, 1, a, b, n, m));
        result = Math.min(result, getCount(i, j, n, m, a, b, n, m));

        if(result == Integer.MAX_VALUE) out.println("Poor Inna and pony!");
        else out.println(result);
    }

    private int getCount(int i, int j, int x, int y, int a, int b, int n, int m) {
        int rowCount = Math.abs(i-x);
        int colCount = Math.abs(j-y);

        if(rowCount % a == 0 && colCount % b == 0) {
            int max = Math.max(rowCount/a, colCount/b);
            int min = Math.min(rowCount/a, colCount/b);

            if((max - min) % 2 == 0) {
                if(max == min) return max;

                if((rowCount / a == max && j <= b && j + b > m) || (colCount / b == max && i <= a && i + a > n)) {
                    return Integer.MAX_VALUE;
                }

                return max;
            }
        }

        return Integer.MAX_VALUE;
    }
}

import java.io.*;
import java.util.*;
public class Main
{
	public static void main(String[] args)throws Exception
	{
	    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	    String s=br.readLine();
	    String str[]=s.split(" ");
	    int n=Integer.parseInt(str[0]);
	    int m=Integer.parseInt(str[1]);
	    int i=Integer.parseInt(str[2]);
	    int j=Integer.parseInt(str[3]);
	    int a=Integer.parseInt(str[4]);
	    int b=Integer.parseInt(str[5]);
	    int ar1[]={1,n,n,1};
	    int ar2[]={m,1,m,1};
	    int min=-1;
	    for(int l=0;l<4;l++)
	    {
	        int temp1=Math.abs(ar1[l]-i);
	        int temp2=Math.abs(ar2[l]-j);
	        if(temp1%a!=0||temp2%b!=0)
	        continue;
	        temp1/=a;
	        temp2/=b;
	        if(temp1%2!=temp2%2)
	        continue;
	        int d=Math.max(temp1,temp2);
	        if(min==-1||d<min)
	        min=d;
	    }
	    if(a+i>n&&i-a<=0&&min!=0||b+j>m&&j-b<=0&&min!=0)
	    System.out.println("Poor Inna and pony!");
	    else if(min==-1)
		System.out.println("Poor Inna and pony!");
		else
		System.out.println(min);
	}
}

import java.io.*;
import java.util.*;

public class InnaAndPinkPony
{

 static StringTokenizer st;
 static BufferedReader in;
 static PrintWriter out;
 long min=Integer.MAX_VALUE;

 private static int nextInt() throws IOException
 {
        return Integer.parseInt(next());
 }

  private static long nextLong() throws IOException
  {
        return Long.parseLong(next());
  }
  private static byte nextByte() throws IOException
  {
        return Byte.parseByte(next());
  }

   private static String next() throws IOException
 {
        while(st == null || ! st.hasMoreTokens())
        {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
 }

//   (x - a, y - b);
//move the candy from position (x, y) on the board to position (x + a, y - b);
//move the candy from position (x, y) on the board to position (x - a, y + b);
//move the candy from position (x, y) on the board to position (x + a, y + b).

    public static void  main(String[] args) throws IOException
    {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        int n=nextInt();
        int m=nextInt();
        int i=nextInt();
        int j=nextInt();
        int a=nextInt();
        int b=nextInt();

      int r1 = Integer.MAX_VALUE, r2 = Integer.MAX_VALUE, r3 = Integer.MAX_VALUE, r4 = Integer.MAX_VALUE;

        if((i == 1 && j == 1) || (i == 1 && j == m) || (i == n && j == 1) || (i == n && j == m)){
            System.out.println(0);
            System.exit(0);
        }

        if ((1 + a <= n && 1 + b <= m) && ((i - 1) % a == 0 && (j - 1) % b == 0)) {
            int c1 = (i - 1) / a, c2 = (j - 1) / b;
            if (c1 % 2 == c2 % 2)
                r1 = Math.max(c1, c2);
        }

        if ((1 + a <= n && m - b >= 1) && ((i - 1) % a == 0 && (m - j) % b == 0)) {
            int c1 = (i - 1) / a, c2 = (m - j) / b;
            if (c1 % 2 == c2 % 2)
                r2 = Math.max(c1, c2);
        }

        if ((n - a >= 1 && 1 + b <= m) && ((n - i) % a == 0 && (j - 1) % b == 0)) {
            int c1 = (n - i) / a, c2 = (j - 1) / b;
            if (c1 % 2 == c2 % 2)
                r3 = Math.max(c1, c2);
        }

        if ((n - a >= 1 && m - b >= 1) && ((n - i) % a == 0 && (m - j) % b == 0)) {
            int c1 = (n - i) / a, c2 = (m - j) / b;
            if (c1 % 2 == c2 % 2)
                r4 = Math.max(c1, c2);
        }

        int res = Math.min(r1, Math.min(r2, Math.min(r3, r4)));
        if (res == Integer.MAX_VALUE)
            System.out.println("Poor Inna and pony!");
        else
            System.out.println(res);

    }
}

import java.util.Scanner;

public class Main {

    public static class point {
        long i,j;
        public point (long f,long l)
        {
            i=f;
            j=l;
        }
    }

public static void main (String []args) {

    Scanner s=new Scanner(System.in);
    long n=s.nextLong(),m=s.nextLong();
    point E[] = new point[4];
    E[0] = new point (1,1);
    E[1] = new point (1,m);
    E[2] = new point (n,1);
    E[3] = new point (n,m);
    long i=s.nextLong(),j=s.nextLong();
    long a=s.nextLong(),b=s.nextLong();

    long ans = Long.MAX_VALUE;
    for (int k=0;k<4;k++)
    {
        int val1 = (int) Math.abs(E[k].i-i);
        int val2 =(int) Math.abs(E[k].j-j);
         if (val1%a!=0 || val2%b!=0 || (val1/a)%2 != (val2/b)%2)
         {
             continue;
         }
         ans=Math.min(ans, Math.max(val1/a, val2/b));

    }
    if (ans!=0 &&  (a>=n || b>=m))
    {
        System.out.println("Poor Inna and pony!");
        return;
    }
    if (ans==Long.MAX_VALUE)
    {
        System.out.println("Poor Inna and pony!");
    } else {
        System.out.println(ans);
    }

}

}

import java.util.*;

/**
 * TODO: Insert description here. (generated by aste)
 */
public class A {
    private static final String NO_WAY = "Poor Inna and pony!";
    private static final int [] X = {1, -1,  1, -1};
    private static final int [] Y = {1, -1, -1,  1};
    public static void main(String [] args){
      final Scanner s = new Scanner(System.in);
      final int n = s.nextInt();
      final int m = s.nextInt();
      final int i = s.nextInt();
      final int j = s.nextInt();
      final int a = s.nextInt();
      final int b = s.nextInt();
      final int [] x = {1, 1, n, n};
      final int [] y = {1, m, 1, m};
      int min = -1;
      for (int l = 0; l < x.length; ++l){
        if (i == x[l] && j == y[l]){
          min = 0;
          break;
        }
        final int dx = Math.abs(i - x[l]);
        final int dy = Math.abs(j - y[l]);
        if ((dx % a) != 0 || (dy % b) != 0){
          continue;
        }
        final int rx = dx/a;
        final int ry = dy/b;
        if ((rx-ry) % 2 != 0){
          continue;
        }
        boolean canMakeMove = false;
        for (int k = 0; k < X.length; ++k){
          final int ni = i + a*X[k];
          final int nj = j + b*Y[k];
          if (ni >= 1 && ni <= n && nj >= 1 && nj <= m){
             canMakeMove = true;
             break;
          }
        }
        if (!canMakeMove){
          continue;
        }
        if (min == -1 || min > Math.max(rx, ry)){
          min = Math.max(rx, ry);
        }
      }
      if (min == -1){
        System.out.println(NO_WAY);
      }else{
        System.out.println(min);
      }
      s.close();
    }
}

import java.util.*;
import java.io.*;
public class ponyrosado{
public static void main(String args[]) throws IOException{
BufferedReader lector = new BufferedReader(new InputStreamReader(System.in));
String tmp[] = lector.readLine().split(" ");
int min = Integer.MAX_VALUE;
int x = Integer.parseInt(tmp[0])-1;
int y = Integer.parseInt(tmp[1])-1;
int p = Integer.parseInt(tmp[2])-1;
int q = Integer.parseInt(tmp[3])-1;
int a = Integer.parseInt(tmp[4]);
int b = Integer.parseInt(tmp[5]);
int esq[][] = {{0,0},{0,y},{x,0},{x,y}};
for(int n = 0;n<4;n++){
if((esq[n][0]-p)%a!=0 || (esq[n][1]-q)%b!=0)continue;
int r1 =Math.abs((esq[n][0]-p)/a);
int r2 = Math.abs((esq[n][1]-q)/b);
int r11 =Math.min(r1,r2);
int r22 =Math.max(r1,r2);
int d = r22-r11;
if(d%2==1 || (d>0 && ((r1<r2 && x<a)||(r1>r2 && y<b) )))continue;
min = Math.min(min,r22);
}
if(min == Integer.MAX_VALUE)
System.out.println("Poor Inna and pony!");
else
System.out.println(min);
}
}

import java.util.Scanner;

public class innaandPinky {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int i = sc.nextInt();
		int j = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans = Integer.MAX_VALUE;
		ans = Math.min(ans, sol(1, 1, i, j, a, b));
		ans = Math.min(ans, sol(1, m, i, j, a, b));
		ans = Math.min(ans, sol(n, 1, i, j, a, b));
		ans = Math.min(ans, sol(n, m, i, j, a, b));

		if (ans == Integer.MAX_VALUE || ((i - a < 1 && i + a > n )|| (j - b < 1 && j + b > m)) && ans != 0) {
			System.out.println("Poor Inna and pony!");
		} else {
			System.out.println(ans);
		}
	}

	private static int sol(int n, int m, int i, int j, int a, int b) {
		if (i == n && m == j)
			return 0;
		int x = Math.abs(n - i);
		int y = Math.abs(m - j);

		if (x % a == 0 && y % b == 0) {
			if ((x / a) % 2 == (y/b) % 2) {
				x = x / a;
				y = y / b;
				return Math.max(x, y);
			}
		}
		return Integer.MAX_VALUE;
	}
}

import java.util.Scanner;

public class CodeForces220AConst {

	public static boolean inRect(int i, int j, int ulx, int uly, int lrx, int lry) {
		return i >= ulx && i <= lrx && j >= uly && j <= lry;
	}

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);

		int n = input.nextInt();
		int m = input.nextInt();

		int iOrig = input.nextInt();
		int jOrig = input.nextInt();

		int a = input.nextInt();
		int b = input.nextInt();

		boolean hasSoln = false;
		int bestNumMoves = Integer.MAX_VALUE;

		int [][] corners = {{1, 1}, {1, m}, {n, m}, {n, 1}};
		int [] pmA = {1, -1};
		int [] pmB = {1, -1};

		for (int k = 0; k < 4; k++) {
			int i = iOrig;
			int j = jOrig;

			int d1 = Math.abs(corners[k][0] - i);
			int d2 = Math.abs(corners[k][1] - j);

			if (d1 % a != 0 || d2 % b != 0) continue; // this corner does not lie on the lattice

			if ((d1 / a + d2 / b) % 2 != 0) continue; // this corner does not lie on the lattice

			int u1 = (corners[k][0] - i) / a;
			int u2 = (corners[k][1] - j) / b;

			// the vectors (-a, b) and (-a, -b) spans a new coordinate system
			int xPrime = Math.abs((u2 - u1) / 2); // the x component of the difference vector between src and dest in the new system
			int yPrime = Math.abs(-(u1 + u2) / 2);

			boolean canMove = (xPrime == 0 && yPrime == 0); // if already at destination, we're guaranteed a solution

			for (int mx : pmA) {
				for (int my : pmB) {
					canMove |= inRect(i + mx * a, j + my * b, 1, 1, n, m);
				}
			}

			if (canMove) {
				hasSoln = true;
				bestNumMoves = Math.min(bestNumMoves, xPrime + yPrime);
			}
		}

		if (hasSoln)
			System.out.println(bestNumMoves);
		else
			System.out.println("Poor Inna and pony!");

		input.close();
	}

}

import java.io.BufferedInputStream;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

/**
 * Created by jizhe on 2015/12/21.
 */
public class InnaAndPinkPony {
    private static class Node implements Comparable<Node>
    {
        int row, col, count;

        public Node(int row, int col, int count)
        {
            this.row = row;
            this.col = col;
            this.count = count;
        }

        public int compareTo(Node another)
        {
            if( this.count < another.count )
            {
                return -1;
            }
            if( this.count == another.count )
            {
                return 0;
            }
            return 1;
        }
    }

    //not gonna work, when n,m very large
    private static void run1()
    {
        Scanner in = new Scanner(new BufferedInputStream(System.in));

        int N = in.nextInt();
        int M = in.nextInt();
        int startRow = in.nextInt();
        int startCol = in.nextInt();
        int dRow = in.nextInt();
        int dCol = in.nextInt();

        PriorityQueue<Node> queue = new PriorityQueue<Node>();
        queue.add(new Node(startRow, startCol, 0));
        int[] rowAdj = {-1, 1, -1, 1};
        int[] colAdj = {-1, -1, 1, 1};
        int[] cornerRow = {1, N, N, 1};
        int[] cornerCol = {M, 1, M, 1};
        int min = Integer.MAX_VALUE;
        int limit = Math.min(N/dRow, M/dCol);

        while( !queue.isEmpty() )
        {
            Node current = queue.poll();
            //System.out.printf("current, row: %d, col: %d, count: %d, min: %d\n", current.row, current.col, current.count, min);
            int j;
            for( j = 0; j < 4; j++ )
            {
                if( current.row == cornerRow[j] && current.col == cornerCol[j] )
                {
                    if( current.count < min )
                    {
                        min = current.count;
                    }
                    break;
                }
            }
            if( j == 4 ) {
                for (int i = 0; i < 4; i++) {
                    int nextRow = current.row + dRow * rowAdj[i];
                    int nextCol = current.col + dCol * colAdj[i];
                    int nextCount = current.count + 1;
                    if (nextRow >= 1 && nextRow <= N && nextCol >= 1 && nextCol <= M && nextCount <= Math.min(min, limit)) {
                        queue.add(new Node(nextRow, nextCol, nextCount));
                    }
                }
            }
        }

        if( min == Integer.MAX_VALUE ) {
            System.out.printf("Poor Inna and pony!");
        }
        else
        {
            System.out.printf("%d\n", min);
        }
    }

    private static int check(int cornerRow, int cornerCol, int N, int M, int startRow, int startCol, int dRow, int dCol)
    {
        if( startRow == cornerRow && startCol == cornerCol )
        {
            //System.out.printf("Already at corner\n");
            return 0;
        }

        if( (startRow - dRow < 1 && startRow + dRow > N) || (startCol - dCol < 1 && startCol + dCol > M) )
        {
            //System.out.printf("Poor Inna and pony!\n");
            return Integer.MAX_VALUE;
        }

        int lenRow = Math.abs(cornerRow - startRow);
        int lenCol = Math.abs(cornerCol - startCol);
        if( lenRow%dRow != 0 || lenCol%dCol != 0 )
        {
            return Integer.MAX_VALUE;
        }

        int stepRow = lenRow/dRow;
        int stepCol = lenCol/dCol;
        //System.out.printf("Row steps: %d, col steps: %d\n", stepRow, stepCol);
        if( (stepRow+stepCol)%2 == 1 )
        {
            //System.out.printf("Not both odd nor even\n");
            return Integer.MAX_VALUE;
        }

        return Math.max(stepRow, stepCol);
    }

    private static void run2()
    {
        Scanner in = new Scanner(new BufferedInputStream(System.in));

        int N = in.nextInt();
        int M = in.nextInt();
        int startRow = in.nextInt();
        int startCol = in.nextInt();
        int dRow = in.nextInt();
        int dCol = in.nextInt();

        int count = check(1, 1, N, M, startRow, startCol, dRow, dCol);
        count = Math.min(count, check(1, M, N, M, startRow, startCol, dRow, dCol));
        count = Math.min(count, check(N, 1, N, M, startRow, startCol, dRow, dCol));
        count = Math.min(count, check(N, M, N, M, startRow, startCol, dRow, dCol));

        if( count == Integer.MAX_VALUE )
        {
            System.out.printf("Poor Inna and pony!\n");
        }
        else
        {
            System.out.printf("%d\n", count);
        }
    }

    public static void main(String[] args) {
        run2();
    }
}

import java.util.Scanner;

public class CodeForces220A {

	public static boolean inRect(int i, int j, int ulx, int uly, int lrx, int lry) {
		return i >= ulx && i <= lrx && j >= uly && j <= lry;
	}

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);

		int n = input.nextInt();
		int m = input.nextInt();

		int iOrig = input.nextInt();
		int jOrig = input.nextInt();

		int a = input.nextInt();
		int b = input.nextInt();

		boolean hasSoln = false;
		int bestNumMoves = Integer.MAX_VALUE;

		int [][] corners = {{1, 1}, {1, m}, {n, m}, {n, 1}};

		for (int k = 0; k < 4; k++) {
			int i = iOrig;
			int j = jOrig;

			int d1 = Math.abs(corners[k][0] - i);
			int d2 = Math.abs(corners[k][1] - j);

			if (d1 % a != 0 || d2 % b != 0) continue; // this corner does not lie on the lattice

			if ((d1 / a + d2 / b) % 2 != 0) continue; // this corner does not lie on the lattice

			int moves = 0;

			int u1 = (corners[k][0] - i) / a;
			int u2 = (corners[k][1] - j) / b;

			int xPrime = (u2 - u1) / 2;
			int yPrime = -(u1 + u2) / 2;

			while (xPrime != 0 || yPrime != 0) {
				moves += 1;
				if (xPrime > 0 && inRect(i - a, j + b, 1, 1, n, m)) {
					i -= a;
					j += b;
					xPrime -= 1;
				} else if (xPrime < 0 && inRect(i + a, j - b, 1, 1, n, m)) {
					i += a;
					j -= b;
					xPrime += 1;
				} else if (yPrime > 0 && inRect(i - a, j - b, 1, 1, n, m)) {
					i -= a;
					j -= b;
					yPrime -= 1;
				} else if (yPrime < 0 && inRect(i + a, j + b, 1, 1, n, m)) {
					i += a;
					j += b;
					yPrime += 1;
				} else {
					moves -= 1; // since we added one at the beginning of this iteration
					break;
				}
			}

			if (xPrime == 0 && yPrime == 0) {
				hasSoln = true;
				bestNumMoves = Math.min(bestNumMoves, moves);
			}
		}

		if (hasSoln)
			System.out.println(bestNumMoves);
		else
			System.out.println("Poor Inna and pony!");

		input.close();
	}

}

import java.util.Scanner;

public class A220Div2
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(), m = in.nextInt(), i = in.nextInt(), j = in.nextInt(), a = in.nextInt(), b = in.nextInt();
		int[] xcorners = {1,n}, ycorners = {1,m};
		int bestTime = -1;
		boolean canMove = ((i+a <= n || i-a >= 1) && (j+b <= m || j-b >= 1));
		for (int xc = 0; xc < xcorners.length; ++xc)
		{
			for (int yc = 0; yc < ycorners.length; ++yc)
			{
				int x = xcorners[xc], y = ycorners[yc];
				int dx = Math.abs(i-x), dy = Math.abs(j-y);
				if ((dx % a != 0) || (dy % b != 0)) continue;
				int nx = dx/a, ny = dy/b;
				if (nx % 2 != ny % 2) continue;
				if (!canMove && nx != ny) continue;
				int time = Math.max(nx, ny);
				if (bestTime == -1 || time < bestTime) bestTime = time;
			}
		}
		System.out.println(bestTime == -1 ? "Poor Inna and pony!" : bestTime);
	}
}

import java.util.*;

public class Main {

	static int n,m,i,j,a,b;
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

        n = sc.nextInt();
        m = sc.nextInt();
        i = sc.nextInt();
        j = sc.nextInt();
        a = sc.nextInt();
        b = sc.nextInt();

        int min = Integer.MAX_VALUE;

        min = Math.min(min, method(1,1));
        min = Math.min(min, method(n,1));
        min = Math.min(min, method(1,m));
        min = Math.min(min, method(n,m));

        System.out.println(min == Integer.MAX_VALUE ? "Poor Inna and pony!" : min);

	}

	static int method(int x,int y){
		int dx = Math.abs(x-i), dy = Math.abs(y-j);

		if(dx%a!=0 || dy%b !=0)
			return Integer.MAX_VALUE;
		else if(dx/a %2 != dy/b %2)
			return Integer.MAX_VALUE;
		if((i+a > n && i-a<1) || (j+b>m && j-b<1))
			return Math.max(dx/a,dy/b) == 0 ? 0 : Integer.MAX_VALUE;
		return Math.max(dx/a,dy/b);
	}
}

import java.util.Scanner;

public class EsA {

	static int n,m,a,b;
	static int si,sj;
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		n=scan.nextInt();
		m=scan.nextInt();
		si=scan.nextInt();
		sj=scan.nextInt();
		a=scan.nextInt();
		b=scan.nextInt();

		int c1=Integer.MAX_VALUE;
		int c2=Integer.MAX_VALUE;
		int c3=Integer.MAX_VALUE;
		int c4=Integer.MAX_VALUE;

		int xc1=1, yc1=1;
		int xc2=1, yc2=m;
		int xc3=n, yc3=1;
		int xc4=n, yc4=m;

		int distI, distJ;

		//vert1
		distI = Math.abs(xc1-si);
		distJ = Math.abs(yc1-sj);

		if(distI%a!=0 || distJ%b!=0){

		}else{
			int numI=distI/a, numJ=distJ/b;
			if(numI==numJ){
				c1 = numI;
			}else if(numI%2==numJ%2){
				if(numI<numJ){
					if(xc1+a<=n){
						c1 = Math.max(numI, numJ);
					}
				}else{
					if(yc1+b<=m){
						c1 = Math.max(numI, numJ);
					}
				}

			}
		}

		//vert2
				distI = Math.abs(xc2-si);
				distJ = Math.abs(yc2-sj);

				if(distI%a!=0 || distJ%b!=0){

				}else{
					int numI=distI/a, numJ=distJ/b;
					if(numI==numJ){
						c2 = numI;
					}else if(numI%2==numJ%2){
						if(numI<numJ){
							if(xc2+a<=n){
								c2 = Math.max(numI, numJ);
							}
						}else{
							if(yc2-b>=1){
								c2 = Math.max(numI, numJ);
							}
						}

					}
				}

				//vert3
				distI = Math.abs(xc3-si);
				distJ = Math.abs(yc3-sj);

				if(distI%a!=0 || distJ%b!=0){

				}else{
					int numI=distI/a, numJ=distJ/b;
					if(numI==numJ){
						c3 = numI;
					}else if(numI%2==numJ%2){
						if(numI<numJ){
							if(xc3-a>=1){
								c3 = Math.max(numI, numJ);
							}
						}else{
							if(yc3+b<=m){
								c3 = Math.max(numI, numJ);
							}
						}
					}
				}

				//vert4
				distI = Math.abs(xc4-si);
				distJ = Math.abs(yc4-sj);

				if(distI%a!=0 || distJ%b!=0){

				}else{
					int numI=distI/a, numJ=distJ/b;
					if(numI==numJ){
						c4 = numI;
					}else if(numI%2==numJ%2){
						if(numI<numJ){
							if(xc4-a>=1){
								c4 = Math.max(numI, numJ);
							}
						}else{
							if(yc4-b>=1){
								c4 = Math.max(numI, numJ);
							}
						}
					}
				}
				//System.out.println(c1+" "+c2+" "+c3+" "+c4);

				int ris = Math.min(c1, Math.min(c2, Math.min(c3, c4)));
				if(ris<Integer.MAX_VALUE)
					System.out.println(ris);
				else
					System.out.println("Poor Inna and pony!");

	}

}

import java.util.*;
public class a {
public static void main(String[] args)
{
    Scanner input = new Scanner(System.in);
    int n = input.nextInt(), m = input.nextInt(), i = input.nextInt()-1, j = input.nextInt()-1, a = input.nextInt(), b = input.nextInt();
    int[] rs = new int[]{0, n-1, n-1, 0};
    int[] cs = new int[]{m-1, 0, m-1, 0};
    int res = 987654321;
    for(int k = 0; k<4; k++)
    {
        int dr = Math.abs(rs[k] - i);
        int dc = Math.abs(cs[k] - j);
        if(dr%a != 0 || dc%b != 0) continue;
        dr /= a;
        dc /= b;
        if(Math.abs(dr-dc)%2 != 0) continue;
        int sum = dr+dc, diff = Math.abs(dr-dc);
        //System.out.println(dr+" "+dc);
        res = Math.min(res, sum/2+diff/2);
    }
    if((i+a >= n && i-a<0 && res != 0) || (res != 0 && j+b >= m && j-b < 0)) res = 987654321;
    System.out.println(res == 987654321 ? "Poor Inna and pony!" : res);
}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class InnaandPinkPony {
    static int n,m,i,j,a,b,res;
    static final int INF  = 100000000;
    static int dfs(int x, int y){
        if(x==i&&y==j)
            return 0;
        int newX = Math.abs(x-i);
        int newY = Math.abs(y-j);
        if((newX%a)!=0||(newY%b)!=0||a+1>n||b+1>m)
            return INF;
        newX/=a;
        newY/=b;
        if((newX%2)!=(newY%2))
            return INF;
        return Math.max(newX, newY) ;
    }
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        StringTokenizer st = new StringTokenizer(in.readLine());
        n = Integer.parseInt(st.nextToken());
        m = Integer.parseInt(st.nextToken());
        i = Integer.parseInt(st.nextToken());
        j = Integer.parseInt(st.nextToken());
        a = Integer.parseInt(st.nextToken());
        b = Integer.parseInt(st.nextToken());
        res = INF;
        res = Math.min(Math.min(dfs(1, m), dfs(n, 1)), Math.min(dfs(n, m), dfs(1, 1)));
        if(res == INF)
            out.println("Poor Inna and pony!");
        else
            out.println(res);
        in.close();
        out.close();
    }
}

import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt(); // Rows
        int M = sc.nextInt(); // Columns

        int i = sc.nextInt(); // row
        int j = sc.nextInt(); // column

        int a = sc.nextInt();
        int b = sc.nextInt();

        LinkedList<int[]> queue = new LinkedList<>();
        queue.add(new int[] {i, j});

        if (isCorner(i, j, N, M)) {
            System.out.println(0);
            return;
        }

        List<int[]> corners = new ArrayList<>();

        if (isReachable(i, j, 1, 1, a, b)) {
            corners.add(new int[] {1, 1});
        }
        if (isReachable(i, j, 1, M, a, b)) {
            corners.add(new int[] {1, M});
        }
        if (isReachable(i, j, N, 1, a, b)) {
            corners.add(new int[] {N, 1});
        }
        if (isReachable(i, j, N, M, a, b)) {
            corners.add(new int[] {N, M});
        }

        int min = Integer.MAX_VALUE;
        for (int[] corner : corners) {
            // We have no room to move up or down.
            if ((i - a) < 1 && (i + a) > N) continue;
            // We have no room to move left or right.
            if ((j - b) < 1 && (j + b) > M) continue;

            int d_x = (int)Math.abs(corner[0] - i);
            int d_y = (int)Math.abs(corner[1] - j);

            int stepsX = d_x / a;
            int stepsY = d_y / b;

            // Both steps must be even or odd.
            if ((stepsX % 2) != (stepsY % 2)) {
                continue;
            }

            int stepsNeeded = Math.max(stepsX, stepsY);
            // Within stepsNeeded steps can we reach the point?

            min = Math.min(min, stepsNeeded);
        }

        if (min == Integer.MAX_VALUE) {
            System.out.println("Poor Inna and pony!");
        }
        else {
            System.out.println(min);
        }
    }

    public static boolean isReachable(int row, int col, int tX, int tY, int a, int b) {
        int diffX = (int) Math.abs(row - tX);
        int diffY = (int) Math.abs(col - tY);

        return ((diffX % a == 0) && (diffY % b == 0));
    }

    public static boolean isCorner(int row, int col, int N, int M) {
        return  (row == 1 && col == 1) ||
                (row == 1 && col == M) ||
                (row == N && col == 1) ||
                (row == N && col == M);
    }
}

import java.util.Scanner;

public class a {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		long n = in.nextInt() - 1;
		long m = in.nextInt() - 1;
		long i = in.nextInt() - 1;
		long j = in.nextInt() - 1;
		long a = in.nextInt();
		long b = in.nextInt();
		long down = m - j;
		long right = n - i;
		long min = Long.MAX_VALUE;

		//TOP LEFT i j
		do {
			if (i % a != 0 || j % b != 0)
				break;
			if ((i / a) % 2 != (j / b) % 2)
				break;
			if (i != 0 && i < a)
				break;
			if (j != 0 && j < b)
				break;
			if (j != 0 && n < a)
				break;
			if (i != 0 && m < b)
				break;
			min = Math.min(min, Math.max(i / a, j / b));
		} while (false);

		//TOP RIGHT right j
		do {
			if (right % a != 0 || j % b != 0)
				break;
			if ((right / a) % 2 != (j / b) % 2)
				break;
			if (right != 0 && right < a)
				break;
			if (j != 0 && j < b)
				break;
			if (j != 0 && n < a)
				break;
			if (right != 0 && m < b)
				break;
			min = Math.min(min, Math.max(right / a, j / b));
		} while (false);

		//BOTTOM RIGHT right down
		do {
			if (right % a != 0 || down % b != 0)
				break;
			if ((right / a) % 2 != (down / b) % 2)
				break;
			if (right != 0 && right < a)
				break;
			if (down != 0 && down < b)
				break;
			if (down != 0 && n < a)
				break;
			if (right != 0 && m < b)
				break;
			min = Math.min(min, Math.max(right / a, down / b));
		} while (false);

		//BOTTOM LEFT i down
		do {
			if (i % a != 0 || down % b != 0)
				break;
			if ((i / a) % 2 != (down / b) % 2)
				break;
			if (i != 0 && i < a)
				break;
			if (down != 0 && down < b)
				break;
			if (down != 0 && n < a)
				break;
			if (i != 0 && m < b)
				break;
			min = Math.min(min, Math.max(i / a, down / b));
		} while (false);

		System.out.println(min == Long.MAX_VALUE ? "Poor Inna and pony!" : min);
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Don Li
 */
public class InnaPinkPony {

    int INF = (int) 1e9;

    void solve() {
        int n = in.nextInt(), m = in.nextInt();
        int i = in.nextInt() - 1, j = in.nextInt() - 1, a = in.nextInt(), b = in.nextInt();

        int ans = INF;
        int[] x = new int[]{0, 0, n - 1, n - 1};
        int[] y = new int[]{0, m - 1, 0, m - 1};
        for (int c = 0; c < 4; c++) {
            int dx = Math.abs(x[c] - i), dy = Math.abs(y[c] - j);
            if (dx % a != 0 || dy % b != 0) continue;
            int u = dx / a, v = dy / b;
            int delta = Math.abs(u - v);
            if (delta % 2 != 0) continue;
            if (u > 0 && v == 0 && j + b >= m && j - b < 0) continue;
            if (u == 0 && v > 0 && i + a >= n && i - a < 0) continue;
            ans = Math.min(ans, Math.max(u, v));
        }
        if (ans < INF) out.println(ans);
        else out.println("Poor Inna and pony!");
    }

    public static void main(String[] args) {
        in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(System.out);
        new InnaPinkPony().solve();
        out.close();
    }

    static FastScanner in;
    static PrintWriter out;

    static class FastScanner {
        BufferedReader in;
        StringTokenizer st;

        public FastScanner(BufferedReader in) {
            this.in = in;
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}

import java.io.*;
import java.util.*;

import static java.lang.Double.parseDouble;
import static java.lang.Integer.MAX_VALUE;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;

public class Solver {
    static BufferedReader in;
    static StringTokenizer tok;

    static int n, m, a, b, x, y;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));

        n = nextInt();
        m = nextInt();
        x = nextInt();
        y = nextInt();
        a = nextInt();
        b = nextInt();

        int ans = Integer.MAX_VALUE;

        ans = Math.min(ans, go(1, 1));
        ans = Math.min(ans, go(1, m));
        ans = Math.min(ans, go(n, 1));
        ans = Math.min(ans, go(n, m));

        if (ans == Integer.MAX_VALUE) {
            System.out.println("Poor Inna and pony!");
        } else {
            System.out.println(ans);
        }

    }
    // from (x, y) to (i, j)
    static int go(int i, int j) {
        int dx = Math.abs(x - i);
        int dy = Math.abs(y - j);
        if (dx % a != 0 || dy % b != 0) {
            return Integer.MAX_VALUE;
        }
        int cx = dx / a;
        int cy = dy / b;
        if (cx % 2 != cy % 2) {
            return Integer.MAX_VALUE;
        }
        if (cx == 0 && cy == 0) {
            return 0;
        }
        if (cx == 0 && (x <= a && x + a > n)) {
            return Integer.MAX_VALUE;
        }
        if (cy == 0 && (y <= b && y + b > m)) {
            return Integer.MAX_VALUE;
        }
        return Math.max(cx, cy);
    }

    static String next() throws IOException {
        if (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static int nextInt() throws IOException {
        return parseInt(next());
    }

    static long nextLong() throws IOException {
        return parseLong(next());
    }

    static double nextDouble() throws IOException {
        return parseDouble(next());
    }
}

import java.util.*;
import static java.lang.System.*;

public class Solution {
	Scanner sc = new Scanner (System.in);
	int n = sc.nextInt() , m = sc.nextInt() , i = sc.nextInt() , j = sc.nextInt() , a = sc.nextInt() , b = sc.nextInt();
	void solve() {
		int ans = 99999999;

		ans = Math.min(ans, check(1 , 1));
		ans = Math.min(ans, check(1 , m));
		ans = Math.min(ans, check(n , 1));
		ans = Math.min(ans, check(n , m));

		if (ans == 99999999) {
			out.println("Poor Inna and pony!");
		} else {
			out.println(ans);
		}
	}

	int check (int x , int y ) {
		if (x == i && y == j) return 0;
		if (x <= a && x + a > n) return 99999999;
		if (y <= b && y + b > m) return 99999999;
		int dx = Math.abs(x - i) , dy = Math.abs(y - j);
		if (dx % a == 0 && dy % b == 0 && (dx/a - dy/b) % 2 == 0) return Math.max(dx/a, dy/b);
		return 99999999;
	}
	public static void main (String args[]) {
		Solution s = new Solution();
		s.solve();
	}
}

import java.util.*;
import java.io.*;

public class Temp {
    public static void main(String[] args) throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(System.out);
        st = new StringTokenizer(rd.readLine());
        n = Long.parseLong(st.nextToken()); m = Long.parseLong(st.nextToken()); i = Long.parseLong(st.nextToken());
        j = Long.parseLong(st.nextToken()); a = Long.parseLong(st.nextToken()); b = Long.parseLong(st.nextToken());
        i--; j--;
        if((i==0  || i==n-1) && (j==0 || j==m-1)){
            System.out.println(0);
            return;
        }
        if(out(i-a, j+b) && out(i-a, j-b) && out(i+a, j-b) && out(i+a, j+b)){
            System.out.println("Poor Inna and pony!");
            return;
        }
        tryFor(0, 0);
        tryFor(0, m-1);
        tryFor(n-1, 0);
        tryFor(n-1, m-1);
        if(best<Integer.MAX_VALUE) System.out.println(best);
        else System.out.println("Poor Inna and pony!");
    }

    static void tryFor(long x, long y){
        forPair(x, y);
        forPair(x, -y);
        forPair(-x, y);
        forPair(-x, -y);
    }

    static void forPair(long x, long y){
        long s = (-i+x)/a, t = (-j+y)/b;
        if(a*s==-i+x && b*t==-j+y){
    //      System.out.println(s+" "+t);
            s = Math.abs(s);
            t = Math.abs(t);
            if((s+t)%2==0) upd(Math.max(s, t));
        }
    }

    static void upd(long val){
        best = Math.min(best, val);
    }

    static long best = Integer.MAX_VALUE;

    static boolean out(long x, long y){
        return x<0 || x>=n || y<0 || y>=m;
    }

    static long n, m, i, j, a, b;

    static BufferedReader rd;
    static PrintWriter pw;
    static StringTokenizer st;

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class A {

	//IO
	static BufferedReader f;
	static PrintWriter out;
	static StringTokenizer st;

	final public static void main( String[] args ) throws IOException {
		f = new BufferedReader( new InputStreamReader( System.in ) );
		out = new PrintWriter( System.out );
		solve();
		f.close();
		out.close();
		System.exit( 0 );
	}

	static int n;
	static int m;
	static int i;
	static int j;
	static int a;
	static int b;
	final public static void solve() throws IOException {
		n = nextInt();
		m = nextInt();
		i = nextInt();
		j = nextInt();
		a = nextInt();
		b = nextInt();

		int[] cornerX = { 1 , 1 , n , n };
		int[] cornerY = { 1 , m , 1 , m };
		int best = Integer.MAX_VALUE;
		for ( int idx = 0 ; idx < 4 ; idx++ ) {
			best = Math.min( best , numMoves( cornerX[ idx ], cornerY[ idx ] ) );
		}
		if ( best == Integer.MAX_VALUE ) {
			out.println( "Poor Inna and pony!" );
		} else {
			out.println( best );
		}
	}

	static int numMoves( int endX , int endY ) {
		int rtn = 0;

		//answer is 0 if we are already there
		if ( i == endX && j == endY ) {
			return 0;
		}

		//determine number of steps to reach endX and endY
		int dX = Math.abs( endX - i );
		int dY = Math.abs( endY - j );

		//answer is infinity if dX or dY is not a multiple of step size
		if ( dX % a != 0 || dY % b != 0 ) {
			return Integer.MAX_VALUE;
		}

		int xSteps = dX / a;
		int ySteps = dY / b;

		//go to whichever coordinate, endX or endY, that takes
		//fewer steps
		if ( xSteps < ySteps ) {

			//then go xSteps diagonally
			rtn += xSteps;
			ySteps -= xSteps;
			xSteps = 0;

			//we are now at the x we want
			//make sure we don't go out of bounds
			if ( endX+a <= n || endX-a >=1 ) {

				//we need an even number of ySteps to go diagonally
				//in one direction then diagonally in the other direction
				if ( ySteps % 2 == 0 ) {

					//now go ySteps diagonally right and left consecutively
					rtn += ySteps;
				} else {
					return Integer.MAX_VALUE;
				}
			} else {
				return Integer.MAX_VALUE;
			}
		} else {

			//then go ySteps diagonally
			rtn += ySteps;
			xSteps -= ySteps;
			ySteps = 0;

			//we are now at the y we want
			//make sure we don't go out of bounds
			if ( endY+b <= m || endY-b >= 1 ) {

				//we need an evern number of xSteps to go diagonally
				//up and then diagonally down
				if ( xSteps % 2 == 0 ) {

					//now go y steps diagonally up and down
					rtn += xSteps;
				} else {
					return Integer.MAX_VALUE;
				}
			} else {
				return Integer.MAX_VALUE;
			}
		}
		return rtn;
	}

	final public static String nextToken() throws IOException {
		while ( st == null || !st.hasMoreTokens() ) {
			st = new StringTokenizer( f.readLine() );
		}
		return st.nextToken();
	}

	final public static int nextInt() throws IOException {
		return Integer.parseInt( nextToken() );
	}

	final public static long nextLong() throws IOException {
		return Long.parseLong( nextToken() );
	}

	final public static double nextDouble() throws IOException {
		return Double.parseDouble( nextToken() );
	}

	final public static boolean nextBoolean() throws IOException {
		return Boolean.parseBoolean( nextToken() );
	}
}

/**
 * Created with IntelliJ IDEA.
 * User: igar
 * Date: 14.12.13
 * Time: 16:15
 * To change this template use File | Settings | File Templates.
 */
import sun.nio.cs.ext.MacHebrew;

import java.math.BigInteger;
import java.util.Scanner;

public class CF220_A {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int i = scanner.nextInt();
        int j = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();

        // solve
        int x0 = (i - 1);
        int y0 = (j - 1);
        int x1 = (n - i);
        int y1 = (m - j);

        if (x0 == 0 && y0 == 0 || x0 == 0 && y1 == 0 || x1 == 0 && y0 == 0 || x1 == 0 && y1 == 0) {
            System.out.println(0);
            return;
        } else if (x0 < a && x1 < a || y0 < b && y1 < b){
            System.out.println("Poor Inna and pony!");
            return;
        }
        int min = -1;
        if (canMove(x0, y0, a, b))
            min = Math.max(x0/a, y0/b);
        if (canMove(x0, y1, a, b))
            min = min > 0 ? Math.min(Math.max(x0/a, y1/b), min) : Math.max(x0/a, y1/b);
        if (canMove(x1, y0, a, b))
            min = min > 0 ? Math.min(Math.max(x1/a, y0/b), min) : Math.max(x1/a, y0/b);
        if (canMove(x1, y1, a, b))
            min = min > 0 ? Math.min(Math.max(x1/a, y1/b), min) : Math.max(x1/a, y1/b);

        if (min > 0)
            System.out.println(min);
        else
            System.out.println("Poor Inna and pony!");

    }

    static boolean canMove(int x, int y, int a, int b) {
//        if (x < a || y < b)
//            return false;
        return x % a == 0 && y % b == 0 && (x/a + y/b)%2 == 0;
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {

	public void solve(InputReader in, PrintWriter out) {
		int n=in.nextInt();
		int m=in.nextInt();
		int i=in.nextInt();
		int j=in.nextInt();
		int a=in.nextInt();
		int b=in.nextInt();

		int[][] pos=new int[][]{{1,m},{n,1},{n,m},{1,1}};

		int res=Integer.MAX_VALUE;
		for(int k=0;k<4;k++){
			int ta=pos[k][0]-i>0?pos[k][0]-i:i-pos[k][0];
			int tb=pos[k][1]-j>0?pos[k][1]-j:j-pos[k][1];

			if(ta%a!=0 || tb%b!=0)
				continue;

			ta/=a;
			tb/=b;

			if((ta-tb)%2!=0)
				continue;

			if(ta==0 && tb==0){
				res=0;
				break;
			}

			if(ta==0){
				if(j+b>m && j-b<1)
					continue;
				if(i+a>n && i-a<1)
					continue;
			}

			if(tb==0){
				if(i+a>n && i-a<1)
					continue;
				if(j+b>m && j-b<1)
					continue;
			}

			int t=ta>tb?ta:tb;
			if(res>t)
				res=t;
		}

		if(res==Integer.MAX_VALUE)
			out.println("Poor Inna and pony!");
		else
			out.println(res);
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

}

//package codeforces;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;

public class A {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter writer = new PrintWriter(System.out);
    StringTokenizer stringTokenizer;

    String next() throws IOException {
        while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            stringTokenizer = new StringTokenizer(reader.readLine());
        }
        return stringTokenizer.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    void solve() throws IOException {
        int n = nextInt();
        int m = nextInt();
        int i = nextInt();
        int j = nextInt();
        int a = nextInt();
        int b = nextInt();
        if((i == 1 || i == n) && (j == 1 || j == m)) {
            writer.println(0);
            writer.close();
            return;
        }
        if(i - a <= 0 && i + a > n || j - b <= 0 && j + b > m) {
            writer.println("Poor Inna and pony!");
            writer.close();
            return;
        }
        int ans = Integer.MAX_VALUE;
        int[] x1 = {1, n};
        int[] x2 = {1, m};
        for(int x: x1) {
            for(int y: x2) {
                int dx = i - x;
                int dy = j - y;
                dx = Math.abs(dx);
                dy = Math.abs(dy);
                if(dx / a % 2 != dy / b % 2) continue;
                if(dx % a == 0 && dy % b == 0) ans = Math.min(ans, Math.max(dx / a, dy / b));
            }
        }
        writer.println(ans == Integer.MAX_VALUE ? "Poor Inna and pony!" : ans);
        writer.close();
    }

    public static void main(String[] args) throws IOException {
        new A().solve();
    }
}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C220P1 {

    private static BufferedReader in;
    private static PrintWriter out;
    private static StringTokenizer input;

    public static void main(String[] args) throws IOException {
        // -------------------------------------------------------------------------
        // Initializing...
        new C220P1();
        // -------------------------------------------------------------------------
        // put your code here... :)
        int n = nextInt();
        int m = nextInt();

        int i = nextInt();
        int j = nextInt();

        int a = nextInt();
        int b = nextInt();

        int ret = 1 << 30;

        boolean cantmove = false;

        if ( i-a < 1 && n - a < i ) cantmove = true;
        if ( j-b < 1 && m - b < j ) cantmove = true;

        // first corner. (1,1)
        int lefta = i - 1;
        int leftb = j - 1;
        if (lefta % a == 0 && leftb % b == 0
                && Math.abs(lefta/a - leftb/b) % 2 == 0)
            ret = Math.min(ret, Math.max(lefta / a, leftb / b));

        // first corner. (n,1)
        lefta = n - i;
        leftb = j - 1;
        if (lefta % a == 0 && leftb % b == 0
                && Math.abs(lefta/a - leftb/b) % 2 == 0)
            ret = Math.min(ret, Math.max(lefta / a, leftb / b));

        // first corner. (1,m)
        lefta = i - 1;
        leftb = m - j;
        if (lefta % a == 0 && leftb % b == 0
                && Math.abs(lefta/a - leftb/b) % 2 == 0)
            ret = Math.min(ret, Math.max(lefta / a, leftb / b));

        // first corner. (n,m)
        lefta = n - i;
        leftb = m - j;
        if (lefta % a == 0 && leftb % b == 0
                && Math.abs(lefta/a - leftb/b) % 2 == 0)
            ret = Math.min(ret, Math.max(lefta / a, leftb / b));

        writeln((ret == (1<<30)|| (ret !=0 &&cantmove)?"Poor Inna and pony!":""+ret));
        // -------------------------------------------------------------------------
        // closing up
        end();
        // --------------------------------------------------------------------------

    }

    public C220P1() throws IOException {
        // Input Output for Console to be used for trying the test samples of
        // the problem
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        // -------------------------------------------------------------------------
        // Initalize Stringtokenizer input
        input = new StringTokenizer(in.readLine());
    }

    private static int nextInt() throws IOException {
        if (!input.hasMoreTokens())
            input = new StringTokenizer(in.readLine());
        return Integer.parseInt(input.nextToken());
    }

    private static long nextLong() throws IOException {
        if (!input.hasMoreTokens())
            input = new StringTokenizer(in.readLine());
        return Long.parseLong(input.nextToken());
    }

    private static double nextDouble() throws IOException {
        if (!input.hasMoreTokens())
            input = new StringTokenizer(in.readLine());
        return Double.parseDouble(input.nextToken());
    }

    private static String nextString() throws IOException {
        if (!input.hasMoreTokens())
            input = new StringTokenizer(in.readLine());
        return input.nextToken();
    }

    private static void write(String output) {
        out.write(output);
        out.flush();
    }

    private static void writeln(String output) {
        out.write(output + "\n");
        out.flush();
    }

    private static void end() throws IOException {
        in.close();
        out.close();
        System.exit(0);
    }

}

import java.util.Scanner;

public class A {

    static int n;
    static int m;
    static int i;
    static int j;
    static int a;
    static int b;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
         m = in.nextInt();
         i = in.nextInt();
         j = in.nextInt();
         a = in.nextInt();
         b = in.nextInt();
        if((i == 1 || i == n)&&(j==1 || j == m)){
            System.out.println(0);
            return;
        }
        if((Math.abs(i-n) < a && Math.abs(i-1) < a) || (Math.abs(j-m) < b && Math.abs(j-1) < b)){
            System.out.println("Poor Inna and pony!");
            return;
        }
        int best = Integer.MAX_VALUE;
        best = Math.min(best, dist(1,1));
        best = Math.min(best, dist(1,m));
        best = Math.min(best, dist(n,1));
        best = Math.min(best, dist(n,m));
        if(best < Integer.MAX_VALUE) System.out.println(best);
        else System.out.println("Poor Inna and pony!");
    }

    static int dist(int x, int y){
        if(Math.abs(i-x)%a == 0 && Math.abs(j-y)%b == 0 && (Math.abs(i-x)/a)%2 == (Math.abs(j-y)/b)%2){
            return Math.max(Math.abs(i-x)/a, Math.abs(j-y)/b);
        }
        return Integer.MAX_VALUE;
    }

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;

public class InnaAndPinkPony {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int N = sc.nextInt();
        int M = sc.nextInt();
        int I = sc.nextInt();
        int J = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();

        if ((I == 1 && J == 1) || (I == N && J == 1) || (I == 1 && J == M) || (I == N && J == M)) {
        	System.out.println(0);
        	return;
        }

        if ((N - I < A && I - 1 < A) || (M - J < B && J - 1 < B)) {
        	System.out.println("Poor Inna and pony!");
        	return;
        }

        int dist = Integer.MAX_VALUE;
        dist = Math.min(dist, MovesTo(I, J, 1, 1, A, B));
        dist = Math.min(dist, MovesTo(I, J, N, 1, A, B));
        dist = Math.min(dist, MovesTo(I, J, 1, M, A, B));
        dist = Math.min(dist, MovesTo(I, J, N, M, A, B));

        if (dist == Integer.MAX_VALUE) {
        	System.out.println("Poor Inna and pony!");
        } else {
        	System.out.println(dist);
        }
    }

    public static int MovesTo(int I, int J, int R, int C, int A, int B) {
    	int di = Math.abs(R - I);
    	int dj = Math.abs(C - J);
    	if (di % A != 0 || dj % B != 0) {
    		return Integer.MAX_VALUE;
    	}
    	int mi = di / A;
    	int mj = dj / B;
    	if (mi % 2 == mj % 2) {
    		return Math.max(mi, mj);
    	} else {
    		return Integer.MAX_VALUE;
    	}
    }

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String str = "";
            try { str = br.readLine(); }
            catch (IOException e) { e.printStackTrace(); }
            return str;
        }
    }
}

import java.util.Collection;
import java.util.Scanner;

public class A
{

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int i = sc.nextInt();
        int j = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        int[] steps = new int[4];
        steps[0] = countSteps(1, 1, i, j, a, b, n, m);
        steps[1] = countSteps(1, m, i, j, a, b, n, m);
        steps[2] = countSteps(n, 1, i, j, a, b, n, m);
        steps[3] = countSteps(n, m, i, j, a, b, n, m);

        int res = -1;
        for(int c = 0; c < 4; c++)
        {
            if(steps[c] == -1) continue;
            if(res == - 1) res = steps[c];
            res = res > steps[c] ? steps[c] : res;
        }

        if(res == -1) System.out.print("Poor Inna and pony!");
        else System.out.print(res);

    }

    public static int countSteps(int x, int y, int i, int j, int a, int b, int n, int m)
    {
        int dx = Math.abs(x - i);
        int dy = Math.abs(y - j);

        if(dx % a != 0 || dy % b != 0) return -1;

        int kx = dx / a;
        int ky = dy / b;

        if(kx % 2 != ky % 2) return -1;

        int totalMoves  = Math.max(kx, ky);
        if(totalMoves > 0)
        {
            if(i - a < 1 && i + a > n)
                return -1;
            if(j - b < 1 && j + b > m)
                return -1;
        }
        return Math.max(kx, ky);
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class A374 {
    public static void main(String[] args)throws Exception{
        // TODO Auto-generated method stub
        new A374().run();
    }

    int n,m,i,j,a,b;

    int getMin(int toX, int toY){
        if((i<=a && n-i<a) ||(j<=b && m-j<b))
            return Integer.MAX_VALUE;

        int diffX=Math.abs(toX-i);
        int diffY=Math.abs(toY-j);
        if( diffX%a==0 && diffY%b==0){
            int x=diffX/a;
            int y=diffY/b;
            if((x&1)!=(y&1)) return Integer.MAX_VALUE;
            //System.out.println(toX+";"+toY+" res: "+x+":"+y);
            return Math.max(x, y);
        }
        else return Integer.MAX_VALUE;
    }

    void run() throws Exception{
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

        String s=reader.readLine();

        String[] ss=s.split(" ");
        n=Integer.parseInt(ss[0]);
        m=Integer.parseInt(ss[1]);
        i=Integer.parseInt(ss[2]);
        j=Integer.parseInt(ss[3]);
        a=Integer.parseInt(ss[4]);
        b=Integer.parseInt(ss[5]);

        if((i==1 && j==1) || (i==n && j==m) || (i==1 && j==m) || (i==n && j==1))
            System.out.println(0);
        else{
            int res=Math.min(Math.min(getMin(1,1), getMin(1,m)), Math.min(getMin(n,1), getMin(n,m)));

            if(res==Integer.MAX_VALUE || (n==1 || m==1))
                System.out.println("Poor Inna and pony!");
            else
                System.out.println(res);
        }
        System.out.flush();
        reader.close();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class A {
	BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

    int INF = Integer.MAX_VALUE/2;
    int STOP = 2000000;

    int N;
    int M;
    int I;
    int J;
    int A;
    int B;
	public void solve() throws IOException {
		N = nextInt();
		M = nextInt();
		I = nextInt();
		J = nextInt();
		A = nextInt();
		B = nextInt();

		int ans = INF;
		ans = Math.min(ans, go(1, 1));
		ans = Math.min(ans, go(1, M));
		ans = Math.min(ans, go(N, 1));
		ans = Math.min(ans, go(N, M));

		if (ans == INF) {
			out.println("Poor Inna and pony!");
		} else {
			out.println(ans);
		}
	}

	public int go(int targetX, int targetY) {
		int curX = I;
		int curY = J;
		int ans = 0;
		while (true) {
			if (curX == targetX && curY == targetY) {
				return ans;
			}

			if (curX + A > N && curX - A < 1) {
				return INF;
			}
			if (curY + B > M && curY - B < 1) {
				return INF;
			}

			if (curX + A > N) {
				curX -= A;
			} else if(curX - A < 1) {
				curX += A;
			} else {
				if (curX <= targetX) {
					curX += A;
				} else {
					curX -= A;
				}
			}

			if (curY + B > M) {
				curY -= B;
			} else if(curY - B < 1) {
				curY += B;
			} else {
				if (curY <= targetY) {
					curY += B;
				} else {
					curY -= B;
				}
			}

			ans++;
			if (ans == STOP) {
				return INF;
			}
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new A().run();
	}

	public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            out = new PrintWriter(System.out);
            solve();
            reader.close();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

}

import java.util.*;
public class a {
public static void main(String[] args)
{
    Scanner input = new Scanner(System.in);
    int n = input.nextInt(), m = input.nextInt(), i = input.nextInt()-1, j = input.nextInt()-1, a = input.nextInt(), b = input.nextInt();
    int[] rs = new int[]{0, n-1, n-1, 0};
    int[] cs = new int[]{m-1, 0, m-1, 0};
    int res = 987654321;
    for(int k = 0; k<4; k++)
    {
        int dr = Math.abs(rs[k] - i);
        int dc = Math.abs(cs[k] - j);
        if(dr%a != 0 || dc%b != 0) continue;
        dr /= a;
        dc /= b;
        if(Math.abs(dr-dc)%2 != 0) continue;
        int sum = dr+dc, diff = Math.abs(dr-dc);
        //System.out.println(dr+" "+dc);
        res = Math.min(res, sum/2+diff/2);
    }
    if((i+a >= n && i-a<0 && res != 0) || (res != 0 && j+b >= m && j-b < 0)) res = 987654321;
    System.out.println(res == 987654321 ? "Poor Inna and pony!" : res);
}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        Solve s = new Solve();
    }

}

class Solve {
   StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

    public Solve() throws IOException {
        solve();
    }

    void solve() throws IOException {
        int n, m, i, j, a, b;

        n = NI() - 1;
        m = NI() - 1;
        i = NI() - 1;
        j = NI() - 1;
        b  = NI();
        a = NI();

        int step = -1;

        if (i % b == 0 && j % a == 0 && (i / b + j / a) % 2 == 0)
            step = max(i / b, j / a);

        if (i % b == 0 && (m - j) % a == 0 && (i / b + (m - j) / a) % 2 == 0)
            step = step > -1 ? min(step, max(i / b, (m - j) / a)) : max(i / b, (m - j) / a);

        if ((n - i) % b == 0 && j % a == 0 && ((n - i) / b + j / a) % 2 == 0)
            step = step > -1 ? min(step, max((n - i) / b, j / a)) : max((n - i) / b, j / a);

        if ((n - i) % b == 0 && (m - j) % a == 0 && ((n - i) / b + (m - j) / a) % 2 == 0)
            step = step > -1 ? min(step, max((n - i) / b, (m - j) / a)) : max((n - i) / b, (m - j) / a);

        if (step == -1 || step > 0 && (b > 0 && i < b && (n - i) < b || a > 0 && j < a && (m - j) < a))
            System.out.println("Poor Inna and pony!");
        else
            System.out.println(step);

    }

    int min(int i1, int i2) {
        return i1 < i2 ? i1 : i2;
    }

    int max(int i1, int i2) {
        return i1 > i2 ? i1 : i2;
    }

    int NI() throws IOException {
        in.nextToken();
        return (int)in.nval;
    }

    int abs(int x) {
        return x < 0 ? -x : x;
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{

	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		int x = in.nextInt();
		int y = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();

		int[] dx = new int[4];
		int[] dy = new int[4];
		dx[0] = x-1; dy[0] = y-1;
		dx[1] = n-x; dy[1] = y-1;
		dx[2] = x-1; dy[2] = m-y;
		dx[3] = n-x; dy[3] = m-y;

		int min = Integer.MAX_VALUE;
		int cnt1, cnt2;
		for (int i = 0; i < 4; i++)
		{
			if ((dx[i] % a > 0) || (dy[i] % b > 0)) continue;
			cnt1 = dx[i] / a;
			cnt2 = dy[i] / b;
			if (cnt1 == cnt2)
				min = Math.min(min, cnt1);
			else if (cnt1 > cnt2)
			{
				if (cnt1 % 2 == 1) dy[i] -= b;
				if (dy[i] % (2*b) == 0 && m>b) min = Math.min(min, cnt1);
			}
			else //cnt2 > cnt1
			{
				if (cnt2 % 2 == 1) dx[i] -= a;
				if (dx[i] % (2*a) == 0 && n>a) min = Math.min(min, cnt2);
			}
		}
		if (min == Integer.MAX_VALUE)
			System.out.println("Poor Inna and pony!");
		else
			System.out.println(min);
	}
}

import java.util.Scanner;

public class InnaAndPinkPony {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int i = sc.nextInt();
		int j = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		int x1 = (i-1)/a;
		int xx1 = (i-1)%a;
		int x2 = (n-i)/a;
		int xx2 = (n-i)%a;

		int y1 = (j-1)/b;
		int yy1 = (j-1)%b;
		int y2 = (m-j)/b;
		int yy2 = (m-j)%b;

		int ans = Integer.MAX_VALUE;

		if ((i == 1 && j == 1) || (i == 1 && j == m) || (i == n && j == 1) || (i == n && j == m)) {
			System.out.println(0);
			return;
		}
		if((x1==0 && x2==0) || (y1==0 && y2==0)){
			System.out.println("Poor Inna and pony!");
			return;
		}

		//System.out.println(x1 + " " + x2 + " " + y1 + " " + y2);

		if(x1%2==0 && y1%2==0 && xx1==0 && yy1==0){
			if(Math.max(x1, y1)<ans){
				ans = Math.max(x1, y1);
			}
		}
		if(x1%2==0 && y2%2==0 && xx1==0 && yy2==0){
			if(Math.max(x1, y2)<ans){
				ans = Math.max(x1, y2);
			}
		}
		if(x2%2==0 && y1%2==0 && xx2==0 && yy1==0){
			if(Math.max(x2, y1)<ans){
				ans = Math.max(x2, y1);
			}
		}
		if(x2%2==0 && y2%2==0 && xx2==0 && yy2==0){
			if(Math.max(x2, y2)<ans){
				ans = Math.max(x2, y2);
			}
		}

		if(x1%2==1 && y1%2==1 && xx1==0 && yy1==0){
			if(Math.max(x1, y1)<ans){
				ans = Math.max(x1, y1);
			}
		}
		if(x1%2==1 && y2%2==1 && xx1==0 && yy2==0){
			if(Math.max(x1, y2)<ans){
				ans = Math.max(x1, y2);
			}
		}
		if(x2%2==1 && y1%2==1 && xx2==0 && yy1==0){
			if(Math.max(x2, y1)<ans){
				ans = Math.max(x2, y1);
			}
		}
		if(x2%2==1 && y2%2==1 && xx2==0 && yy2==0){
			if(Math.max(x2, y2)<ans){
				ans = Math.max(x2, y2);
			}
		}
		if(ans<Integer.MAX_VALUE)
			System.out.println(ans);
		else
			System.out.println("Poor Inna and pony!");
	}
}

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;

public class InnaAndPinkPony {

	private static final boolean DEBUG = false;

	public static void main(String[] args) {

		try {

			final InputReader in;
			final OutputWriter out;

			if (DEBUG) {

				final String fileIn = InnaAndPinkPony.class.getSimpleName().toLowerCase() + ".in";
				final String fileOut = InnaAndPinkPony.class.getSimpleName().toLowerCase() + ".out";

				in = new InputReader(new FileInputStream(fileIn));
				out = new OutputWriter(new FileWriter(fileOut));
			} else {

				in = new InputReader(System.in);
				out = new OutputWriter(new OutputStreamWriter(System.out));
			}

			new InnaAndPinkPony().solve(in, out);

			out.close();

		} catch (Exception ex) {

			ex.printStackTrace();
		}
	}

	private final void solve(final InputReader in, final OutputWriter out) throws Exception {

		final int n = in.nextInt();
		final int m = in.nextInt();
		final int i = in.nextInt() - 1;
		final int j = in.nextInt() - 1;
		final int a = in.nextInt();
		final int b = in.nextInt();

		final int result = Math.min(find(n, m, i, j, a, b),
				Math.min(find(n, m, n - i - 1, j, a, b), Math.min(find(n, m, i, m - j - 1, a, b), find(n, m, n - i - 1, m - j - 1, a, b))));

		if (result == Integer.MAX_VALUE) {
			out.writeln("Poor Inna and pony!");
		} else {
			out.writeln(result);
		}
	}

	private final int find(int n, int m, int i, int j, int a, int b) {

		if (i % a != 0 || j % b != 0) {
			return Integer.MAX_VALUE;
		}

		int cnt0 = Math.min(i / a, j / b);

		i -= cnt0 * a;
		j -= cnt0 * b;

		if (i != 0) {
			int t;

			t = i;
			i = j;
			j = t;

			t = a;
			a = b;
			b = t;

			t = n;
			n = m;
			m = t;
		}

		if (j > 0) {
			if (a >= n || ((j / b) & 1) == 1) {
				return Integer.MAX_VALUE;
			}
			cnt0 += (j / b);
		}

		return cnt0;
	}

	private static final class InputReader {

		private static final byte ZERO = '0';
		private static final byte NINE = '9';

		private static final int BUFFER_SIZE = 1 << 17;

		private final BufferedInputStream in;

		private byte[] buffer = new byte[BUFFER_SIZE + 1];
		private int offset = buffer.length;

		private InputReader(final InputStream in) {

			this.in = (in instanceof BufferedInputStream) ? ((BufferedInputStream) in) : (new BufferedInputStream(in));
		}

		public int nextInt() throws Exception {

			int result = 0;

			int position = this.offset;

			while (position < BUFFER_SIZE && (buffer[position] < ZERO || buffer[position] > NINE)) {

				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return nextInt();
			}

			offset = position;

			while (position < BUFFER_SIZE && buffer[position] >= ZERO && buffer[position] <= NINE) {

				result = result * 10 + buffer[position] - ZERO;
				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return nextInt();
			}

			offset = position;

			return result;
		}

		public long nextLong() throws Exception {

			long result = 0;

			int position = this.offset;

			while (position < BUFFER_SIZE && (buffer[position] < ZERO || buffer[position] > NINE)) {

				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return nextLong();
			}

			offset = position;

			while (position < BUFFER_SIZE && buffer[position] >= ZERO && buffer[position] <= NINE) {

				result *= 10;
				result += buffer[position] - ZERO;
				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return nextLong();
			}

			offset = position;

			return result;
		}

		public String next() throws Exception {

			int position = this.offset;

			while (position < BUFFER_SIZE && Character.isWhitespace(buffer[position])) {

				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return next();
			}

			offset = position;

			while (position < BUFFER_SIZE && !Character.isWhitespace(buffer[position])) {
				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return next();
			}

			final String result = new String(buffer, offset, position - offset);
			offset = position;

			return result;
		}

	}

	private static final class OutputWriter {

		private static final String NEW_LINE = String.format("%n");

		private final Writer output;
		private final StringBuilder buffer = new StringBuilder(1 << 17);

		public OutputWriter(final Writer output) {

			this.output = output;
		}

		public void write(final int i) {

			buffer.append(i);
		}

		public void write(final String s) {

			buffer.append(s);
		}

		public void writeln(final String s) {

			buffer.append(s);
			buffer.append(NEW_LINE);
		}

		public void writeln(final long l) {

			buffer.append(l);
			buffer.append(NEW_LINE);
		}

		public void writeln(final int i) {

			buffer.append(i);
			buffer.append(NEW_LINE);
		}

		public void close() throws Exception {

			output.write(buffer.toString());
			output.flush();
			output.close();
		}
	}
}

import java.util.Scanner;

public class a374 {

    static int m, n, i, j, a, b;

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner s = new Scanner(System.in);
        n = s.nextInt();
        m = s.nextInt();
        i = s.nextInt();
        j = s.nextInt();
        a = s.nextInt();
        b = s.nextInt();

        int min = Integer.MAX_VALUE;

        int x[] = { i - 1, i - 1, n - i, n - i };
        int y[] = { j - 1, m - j, j - 1, m - j };

        if ((i == 1 && j == 1) || (i == 1 && j == m) || (i == n && j == 1)
                || (i == n && j == m)) {
            System.out.println(0);
        } else if (a >= n || b >= m) {
            System.out.println("Poor Inna and pony!");
        } else {
            for (int k = 0; k < 4; k++) {
                if (x[k] % a == 0 && y[k] % b == 0
                        && (x[k] / a - y[k] / b) % 2 == 0) {
                    min= Math.min(min, Math.max(x[k]/a, y[k]/b));
                }
            }
            if(min==Integer.MAX_VALUE)
                System.out.println("Poor Inna and pony!");
            else
                System.out.println(min);
        }

    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class InnaPinkPony {

    private static int INF = 1000000;

    public static void main(String[] args) {
        int n, m, i, j, a, b;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line = br.readLine();
            String[] params = line.split(" ");
            n = Integer.parseInt(params[0]);
            m = Integer.parseInt(params[1]);
            i = Integer.parseInt(params[2]);
            j = Integer.parseInt(params[3]);
            a = Integer.parseInt(params[4]);
            b = Integer.parseInt(params[5]);

            int[][] corners = new int[][] { { 1, m }, { n, 1 }, { n, m },
                    { 1, 1 } };

            int min = INF;
            for (int[] cor : corners) {
                int xdiff = cor[0] - i;
                int ydiff = cor[1] - j;

                if (xdiff % a != 0 || ydiff % b != 0) {
                    continue;
                }
                int xmoves = Math.abs(xdiff) / a;
                int ymoves = Math.abs(ydiff) / b;
                if (xmoves % 2 == ymoves % 2) {
                    min = Math.min(min, Math.max(xmoves, ymoves));
                }
            }
            if (min != 0
                    && ((i - a < 1 && i + a > n) || (j - b < 1 && j + b > m))) {
                min = INF;
            }
            if (min == INF) {
                System.out.print("Poor Inna and pony!");
            } else {
                System.out.print(min);
            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
}

import java.io.*;
import java.util.*;

public class InnaAndPinkPony {

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);

        int R = in.nextInt();
        int C = in.nextInt();
        int r = in.nextInt();
        int c = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();

        int diffr1 = Math.abs(r - 1);
        int diffr2 = Math.abs(R - r);
        int diffc1 = Math.abs(c - 1);
        int diffc2 = Math.abs(C - c);

        int ans = Integer.MAX_VALUE;
        if ((r == 1 || r == R) && (c == 1 || c == C)) ans = 0;
        else {
            if (diffr1 % a == 0 && diffc1 % b == 0 && (diffr1 / a) % 2 == (diffc1 / b) % 2)
                ans = Math.min(ans, Math.max(diffr1 / a, diffc1 / b));
            if (diffr1 % a == 0 && diffc2 % b == 0 && (diffr1 / a) % 2 == (diffc2 / b) % 2)
                ans = Math.min(ans, Math.max(diffr1 / a, diffc2 / b));
            if (diffr2 % a == 0 && diffc1 % b == 0 && (diffr2 / a) % 2 == (diffc1 / b) % 2)
                ans = Math.min(ans, Math.max(diffr2 / a, diffc1 / b));
            if (diffr2 % a == 0 && diffc2 % b == 0 && (diffr2 / a) % 2 == (diffc2 / b) % 2)
                ans = Math.min(ans, Math.max(diffr2 / a, diffc2 / b));

            if (a >= R || b >= C) ans = Integer.MAX_VALUE;
        }
        System.out.println(ans == Integer.MAX_VALUE ? "Poor Inna and pony!" : ans);
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = new StringTokenizer("");
        }

        public String next() {
            try {
                while (!tokenizer.hasMoreTokens())
                    tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

            return tokenizer.nextToken();
        }

        public String nextLine() {
            String line = null;
            try {
                tokenizer = new StringTokenizer("");
                line =  reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        boolean hasNext() {
            while (!tokenizer.hasMoreTokens()) {
                String line = nextLine();
                if (line == null) return false;
                tokenizer = new StringTokenizer(line);
            }
            return true;
        }
    }
}

/**
 * User: Panyav1n
 * Date: 18.12.13
 * Time: 19:19
 */
import java.util.Scanner;
import java.io.*;

public class A {
    Scanner sc;
    int n, m, i, j, a, b;
    int ans = -1, cnti1, cnti2, cntj1, cntj2;
    boolean ci1, ci2, cj1, cj2;
    boolean g1 = false, g2 = false;

    public static void main(String[] args) throws Exception {
        A cl = new A();
        cl.input();
        cl.solve();
        cl.output();
    }
    public void input() throws Exception {
        sc = new Scanner(System.in);
//        sc = new Scanner(new File("input.txt"));
        n = sc.nextInt();
        m = sc.nextInt();
        i = sc.nextInt();
        j = sc.nextInt();
        a = sc.nextInt();
        b = sc.nextInt();
    }
    public void solve() throws Exception {
        cnti1 = (n - i) / a;
        cnti2 = (i - 1) / a;
        cntj1 = (m - j) / b;
        cntj2 = (j - 1) / b;

        ci1 = false;
        ci2 = false;
        cj1 = false;
        cj2 = false;

        if (cnti1 * a + i == n) ci1 = true;
        if (i - cnti2 * a == 1) ci2 = true;
        if (cntj1 * b + j == m) cj1 = true;
        if (j - cntj2 * b == 1) cj2 = true;

        if (j - b >= 1 || j + b <= m) g1 = true;
        if (i - a >= 1 || i + a <= n) g2 = true;

        if ((i == 1 || i == n) && (j == 1 || j == m)) {
            g1 = true;
            g2 = true;
        }

        if (g1 && g2 && ci1 && cj1 && (Math.abs(cnti1 - cntj1) % 2 == 0))
            if (ans == -1 || ans > Math.max(cnti1, cntj1))
                        ans = Math.max(cnti1, cntj1);
        if (g1 && g2 && ci1 && cj2 && (Math.abs(cnti1 - cntj2) % 2 == 0))
            if (ans == -1 || ans > Math.max(cnti1, cntj2))
                        ans = Math.max(cnti1, cntj2);
        if (g1 && g2 && ci2 && cj1 && (Math.abs(cnti2 - cntj1) % 2 == 0))
            if (ans == -1 || ans > Math.max(cnti2, cntj1))
                        ans = Math.max(cnti2, cntj1);
        if (g1 && g2 && ci2 && cj2 && (Math.abs(cnti2 - cntj2) % 2 == 0))
            if (ans == -1 || ans > Math.max(cnti2, cntj2))
                        ans = Math.max(cnti2, cntj2);
    }
    public void output() throws Exception {
        if (ans != -1)
            System.out.println(ans);
        else
            System.out.println("Poor Inna and pony!");
    }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}
}

class Task {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        int x = in.nextInt() ;
        int y = in.nextInt() ;
        int ai = in.nextInt();
        int bi = in.nextInt();
        int min = Integer.MAX_VALUE;
        if((x-1) % ai == 0 && (y-1) % bi == 0){
            if(((x-1)/ai)%2 == ((y-1)/bi)%2 && ai < n && bi < m )
                min = Math.min(Math.max((x-1)/ai,(y-1)/bi),min);
            if(((x-1)/ai) == ((y-1)/bi))
                min = Math.min(Math.max((x-1)/ai,(y-1)/bi),min);

        }
        if((n-x) % ai == 0 && (y-1) % bi == 0 ){
            if(((n-x)/ai)%2 == ((y-1)/bi)%2 && ai < n && bi < m)
                min = Math.min(Math.max((n-x)/ai,(y-1)/bi),min);
            if(((n-x)/ai) == ((y-1)/bi))
                min = Math.min(Math.max((n-x)/ai,(y-1)/bi),min);

        }
        if((x-1) % ai == 0 && (m-y) % bi == 0){
            if(((x-1)/ai) % 2 == ((m-y)/bi) % 2 && ai < n && bi < m)
                min = Math.min(Math.max((x-1)/ai,(m-y)/bi), min);
            if(((x-1)/ai) == ((m-y)/bi) )
                min = Math.min(Math.max((x-1)/ai,(m-y)/bi), min);
        }
        if((n-x) % ai == 0 && (m-y) % bi == 0){
            if(((n-x)/ai) % 2 == ((m-y)/bi) % 2 && ai < n && bi < m)
                min = Math.min(Math.max((n-x)/ai,(m-y)/bi), min);
            if(((n-x)/ai) == ((m-y)/bi)  )
                min = Math.min(Math.max((n-x)/ai,(m-y)/bi), min);

        }
        String ans = min == Integer.MAX_VALUE?"Poor Inna and pony!":min+"";
        out.println(ans);
    }
}

class InputReader {
    private BufferedReader br;
    private StringTokenizer st;
    public InputReader(InputStream in) {
        br=new BufferedReader(new InputStreamReader(in));
        try {
            st=new StringTokenizer(br.readLine());
        } catch (IOException ignored) {

        }
    }

    public int nextInt(){
        return Integer.parseInt(st.nextToken());
    }

}

import java.util.*;
import java.io.*;
public class Main {
    static BufferedReader reader
		= new BufferedReader(new InputStreamReader(System.in));
    static StringBuilder out = new StringBuilder();
    static int a, b, n, m;

    public static void main(String[] args){
        int[] inp = nextIntArray();
        int i, j;
        n = inp[0]; m = inp[1]; i = inp[2]; j = inp[3]; a = inp[4]; b = inp[5];
        int min = (int) 1e7;
        int[] rs = {1, n};
        int[] cs = {1, m};
        for (int r : rs)
            for (int c : cs)
                min = Math.min(min, move(Math.abs(r - i), Math.abs(c - j)));

        if (min > (int) 1e6){
            out.append("Poor Inna and pony!");
        } else {
            out.append(min);
        }
        System.out.println(out);
    }
    static int move(int r, int c){
        if (r == 0 && c == 0){
            return 0;
        }
        if (n > a && m > b && r % a == 0 && c % b == 0){
            r /= a;
            c /= b;
            if (r % 2 == c % 2){
                return Math.max(r, c);
            }
        }
        return (int) 1e7;
    }

    // the followings are methods to take care of inputs.
    static int nextInt(){
        return Integer.parseInt(nextLine());
    }
    static long nextLong(){
        return Long.parseLong(nextLine());
    }
    static int[] nextIntArray(){
        String[] inp = nextLine().split("\\s+");
        int[] ary = new int[inp.length]; for (int i = 0; i < ary.length; i++){
            ary[i] = Integer.parseInt(inp[i]);
        }
        return ary;
    }
    static int[] nextIntArrayFrom1(){
        String[] inp = nextLine().split("\\s+");
        int[] ary = new int[inp.length + 1];
        for (int i = 0; i < inp.length; i++){
            ary[i+1] = Integer.parseInt(inp[i]);
        }
        return ary;
    }
    static long[] nextLongArray(){
        String[] inp = nextLine().split("\\s+");
        long[] ary = new long[inp.length];
        for (int i = 0; i < inp.length; i++){
            ary[i] = Long.parseLong(inp[i]);
        }
        return ary;
    }
    static long[] nextLongArrayFrom1(){
        String[] inp = nextLine().split("\\s+");
        long[] ary = new long[inp.length + 1];
        for (int i = 0; i < inp.length; i++){
            ary[i+1] = Long.parseLong(inp[i]);
        }
        return ary;
    }
	static String nextLine(){
		try {
			return reader.readLine().trim();
		} catch (Exception e){}
		return null;
	}
}

import static java.lang.Math.*;

public class A {

	private final static boolean autoflush = false;

	public A () {
		long N = sc.nextInt();
		long M = sc.nextInt();
		long i = sc.nextInt();
		long j = sc.nextInt();
		long a = sc.nextInt();
		long b = sc.nextInt();

		--i; --j;
		String NO = "Poor Inna and pony!";

		long res = solve(N, M, i, j, a, b);
		res = min(res, solve(N, M, N-1-i, j, a, b));
		res = min(res, solve(N, M, i, M-1-j, a, b));
		res = min(res, solve(N, M, N-1-i, M-1-j, a, b));

		if (res != INF)
			exit(res);
		else
			exit(NO);
	}

	long solve(long N, long M, long i, long j, long a, long b) {
		if (i == 0 && j == 0)
			return 0;

		if (i == 0)
			if (a < N && j % (2*b) == 0) return j/b;
			else return INF;

		if (j == 0)
			if (b < M && i % (2*a) == 0) return i/a;
			else return INF;

		if (i%a != 0 || j%b != 0)
			return INF;

		long p = i/a, q = j/b;
		if ((p-q)%2 != 0)
			return INF;

		return max(p, q);
	}

	private static final int INF = (int) 1e9;
	////////////////////////////////////////////////////////////////////////////////////
	private final static MyScanner sc = new MyScanner();
	private static class MyScanner {
		public String next() { newLine(); return line[index++]; }
		public int nextInt() { return Integer.parseInt(next()); }
		//////////////////////////////////////////////
		private boolean eol() { return index == line.length; }
		private String readLine() {
			try {
				return r.readLine();
			} catch (Exception e) {
				throw new Error (e);
			}
		}
		private final java.io.BufferedReader r;
		private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
		private MyScanner (java.io.BufferedReader r) {
			try {
				this.r = r;
				while (!r.ready())
					Thread.sleep(1);
				start();
			} catch (Exception e) {
				throw new Error(e);
			}
		}
		private String [] line;
		private int index;
		private void newLine() {
			if (line == null || eol()) {
				line = readLine().split(" ");
				index = 0;
			}
		}
	}
	private static void print (Object o, Object... a) { printDelim(" ", o, a); }
	private static void printDelim (String delim, Object o, Object... a) { pw.println(build(delim, o, a)); }
	private static void exit (Object o, Object... a) { print(o, a); exit(); }
	private static void exit() {
		pw.close();
		System.out.flush();
		System.err.println("------------------");
		System.err.println("Time: " + ((millis() - t) / 1000.0));
		System.exit(0);
	}
	////////////////////////////////////////////////////////////////////////////////////
	private static String build (String delim, Object o, Object... a) {
		StringBuilder b = new StringBuilder();
		append(b, o, delim);
		for (Object p : a)
			append(b, p, delim);
		return b.substring(delim.length());
	}
	private static void append(StringBuilder b, Object o, String delim) {
		if (o.getClass().isArray()) {
			int L = java.lang.reflect.Array.getLength(o);
			for (int i = 0; i < L; ++i)
				append(b, java.lang.reflect.Array.get(o, i), delim);
		} else if (o instanceof Iterable<?>)
			for (Object p : (Iterable<?>)o)
				append(b, p, delim);
		else
			b.append(delim).append(o);
	}
	////////////////////////////////////////////////////////////////////////////////////
	private static void start() { t = millis(); }
	private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out, autoflush);
	private static long t;
	private static long millis() { return System.currentTimeMillis(); }
	public static void main (String[] args) { new A(); exit(); }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Algorithm {

	public static void main(String args[]) throws Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Solution s = new Solution();
		s.solve(in, out);
		out.close();
	}
}

class Solution {

	public void solve(InputReader in, PrintWriter out) {
		int n = in.nextInt();
		int m = in.nextInt();
		int i = in.nextInt();
		int j = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();

		int min = Math.max(m,n);
		if (((i - 1) / a) % 2 == ((j - 1) / b) % 2 ) {
			if ((i - 1) % a == 0 && (j - 1) % b == 0)
			min = Math.min(min, Math.max((i - 1) / a, (j - 1) / b));
		}
		if (((i - 1) / a) % 2 == ((m - j) / b) % 2) {
			if ((i - 1) % a == 0 && (m - j) % b == 0)
			min = Math.min(min, Math.max((i - 1) / a,  (m - j) / b));
		}
		if (((n - i) / a) % 2 == ((j - 1) / b) % 2 ) {
			if ((n - i) % a == 0 && (j - 1) % b == 0)
			min = Math.min(min, Math.max((n - i) / a, (j - 1) / b));
		}
		if (((n - i) / a) % 2 == ((m - j) / b) % 2) {
			if ((n - i) % a == 0 && (m - j) % b == 0)
			min = Math.min(min, Math.max((n - i) / a,  (m - j) / b));
		}
		if (min < Math.max(m,n)){
			if (min > 0 && ((a + i > n && i - a <1) || ((b + j > m && j - b <1)))){
				out.print("Poor Inna and pony!");
			}else{
			out.print(min);
			}
		}else{
			out.print("Poor Inna and pony!");
		}
	}
}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

}

//package com.prituladima.codeforce.a2oj.div2A;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

import static java.lang.Integer.max;
import static java.lang.Integer.min;
import static java.lang.Math.abs;
import static java.util.stream.IntStream.range;

public class Pro96 {

    int n, m, i, j, a, b;
    int INF = Integer.MAX_VALUE;

    private void solve() {

        n = nextInt();
        m = nextInt();
        i = nextInt();
        j = nextInt();
        a = nextInt();
        b = nextInt();
        int ans = INF;

        ans = min(check(1, m), check(n, 1));
        ans = min(ans, check(n, m));
        ans = min(ans, check(1, 1));

        sout(ans == Integer.MAX_VALUE ? "Poor Inna and pony!" : ans);

    }

    int check(int x, int y) {
        if (x == i && y == j) {
            return 0;
        }
        if (i - a < 1 && i + a > n) return INF;
        if (j - b < 1 && j + b > m) return INF;
        if (abs(x - i) % a != 0) return INF;
        if (abs(y - j) % b != 0) return INF;

        int cost = 0;
        cost = max(abs(x - i) / a, abs(y - j) / b);
        int tmp = abs(x - i) / a + abs(y - j) / b;
        if ((tmp & 1) != 0) return INF;
        return cost;
    }

    public static void main(String[] args) {
        new Pro96().run();
    }

    private BufferedReader reader;
    private StringTokenizer tokenizer;
    private PrintWriter writer;

    private void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    private int nextInt() {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() {
        return Double.parseDouble(nextToken());
    }

    private int[] nextArr(int size) {
        return Arrays.stream(new int[size]).map(c -> nextInt()).toArray();
    }

    private long[] nextArrL(int size) {
        return Arrays.stream(new long[size]).map(c -> nextLong()).toArray();
    }

    private double[] nextArrD(int size) {
        return Arrays.stream(new double[size]).map(c -> nextDouble()).toArray();
    }

    private char[][] nextCharMatrix(int n) {
        return range(0, n).mapToObj(i -> nextToken().toCharArray()).toArray(char[][]::new);
    }

    private int[][] nextIntMatrix(int n, int m) {
        return range(0, n).mapToObj(i -> nextArr(m)).toArray(int[][]::new);
    }

    private double[][] nextDoubleMatrix(int n, int m) {
        return range(0, n).mapToObj(i -> nextArr(m)).toArray(double[][]::new);
    }

    private String nextToken() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    private void soutn() {
        writer.println();
    }

    private void soutn(Object o) {
        writer.println(o);
    }

    private void sout(Object o) {
        writer.print(o);
    }

    private void souf(String format, Object... args) {
        writer.printf(format, args);
    }

    private <Param> void sout(Param[] arr) {
        writer.println(Arrays.toString(arr));
    }

}

import java.io.InputStreamReader;
import java.util.Scanner;

import static java.lang.Math.abs;
import static java.lang.Math.max;
import static java.lang.Math.min;

public class Main {

    public static final String POOR_INNA_AND_PONY = "Poor Inna and pony!";

    public static void main(String[] args) {
        Scanner sc = new Scanner( new InputStreamReader(System.in));
        String line = sc.nextLine();
        sc.close();
        sc = new Scanner(line);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int i = sc.nextInt();
        int j = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();
        if ((i == 1 || i == n) && (j == 1 || j == m)) {
            System.out.println("0");
            return;
        }

        if (((i-1) < a) && (n-i) < a) {
            System.out.println(POOR_INNA_AND_PONY);
            return;
        }

        if (((j-1) < b) && (m-j) < b) {
            System.out.println(POOR_INNA_AND_PONY);
            return;
        }

        int iDiff = 1-i;
        int jDiff = 1-j;
        int steps = -1;
        if ((iDiff % a == 0)&&(jDiff % b == 0)) {
            int iQuant = abs(iDiff / a);
            int jQuant = abs(jDiff / b);
            if ((iQuant % 2) == (jQuant % 2)) {
                int max = max(iQuant, jQuant);
                if (steps == -1) {
                    steps = max;
                }
            }
        }

        iDiff = n-i;
        jDiff = 1-j;
        if ((iDiff % a == 0)&&(jDiff % b == 0)) {
            int iQuant = abs(iDiff / a);
            int jQuant = abs(jDiff / b);
            if ((iQuant % 2) == (jQuant % 2)) {
                int max = max(iQuant, jQuant);
                if (steps == -1) {
                    steps = max;
                }
                steps = min(max, steps);
            }
        }

        iDiff = 1-i;
        jDiff = m-j;
        if ((iDiff % a == 0)&&(jDiff % b == 0)) {
            int iQuant = abs(iDiff / a);
            int jQuant = abs(jDiff / b);
            if ((iQuant % 2) == (jQuant % 2)) {
                int max = max(iQuant, jQuant);
                if (steps == -1) {
                    steps = max;
                }
                steps = min(max, steps);
            }
        }

        iDiff = n-i;
        jDiff = m-j;
        if ((iDiff % a == 0)&&(jDiff % b == 0)) {
            int iQuant = abs(iDiff / a);
            int jQuant = abs(jDiff / b);
            if ((iQuant % 2) == (jQuant % 2)) {
                int max = max(iQuant, jQuant);
                if (steps == -1) {
                    steps = max;
                }
                steps = min(max, steps);
            }
        }

        if (steps!=-1) {
            System.out.println(steps);
        } else {
            System.out.println(POOR_INNA_AND_PONY);
        }

    }
}

import java.util.Scanner;

/**
 * Created by tdph5945 on 2016-07-07.
 */
public class InnandPinkPony {
    private static int n, m, a, b;

    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        m = scanner.nextInt();

        int i = scanner.nextInt(), j = scanner.nextInt();

        a = scanner.nextInt();
        b = scanner.nextInt();

        int[] a1 = {1, 1, n, n};
        int[] b1 = {1, m, 1, m};

        int min = Integer.MAX_VALUE;

        for (int ii = 0; ii < a1.length; ii++) {
            int x = a1[ii];
            int y = b1[ii];

            int xx = Math.abs(x - i);
            int yy = Math.abs(y - j);

            if (xx % a == 0 && yy % b == 0) {
                if ((xx / a) % 2 == (yy / b) % 2)
                    min = Math.min(min, Math.max(xx / a, yy / b));
            }
        }

        if (min == Integer.MAX_VALUE || (min > 0 && (n <= a || m <= b))) {
            System.out.println("Poor Inna and pony!");
        } else {
            System.out.println(min);
        }

    }

}

import java.io.*;
import java.util.*;

public class cf374a {
  static FastIO in = new FastIO(), out = in;

  static int oo = (int)1e9;
  public static void main(String[] args) {
    int n = in.nextInt();
    int m = in.nextInt();
    int i = in.nextInt()-1;
    int j = in.nextInt()-1;
    int a = in.nextInt();
    int b = in.nextInt();

    int ans = solve(n,m,i,j,a,b);
    ans = Math.min(ans,solve(n,m,n-i-1,j,a,b));
    ans = Math.min(ans,solve(n,m,n-i-1,m-j-1,a,b));
    ans = Math.min(ans,solve(n,m,i,m-j-1,a,b));

    if(ans == oo)
      out.println("Poor Inna and pony!");
    else
      out.println(ans);

    out.close();
  }

  static int solve(int n, int m, int i, int j, int a, int b) {
    if(i == 0 && j == 0) return 0;
    if(i+a >= n && i-a < 0) return oo;
    if(j+b >= m && j-b < 0) return oo;
    if(i%a != 0) return oo;
    i /= a;
    if(j%b != 0) return oo;
    j /= b;
    if(i%2 != j%2) return oo;
    return Math.max(i,j);
  }

  static class FastIO extends PrintWriter {
    BufferedReader br;
    StringTokenizer st;

    public FastIO() {
      this(System.in, System.out);
    }

    public FastIO(InputStream in, OutputStream out) {
      super(new BufferedWriter(new OutputStreamWriter(out)));
      br = new BufferedReader(new InputStreamReader(in));
      scanLine();
    }

    public void scanLine() {
      try {
        st = new StringTokenizer(br.readLine().trim());
      } catch (Exception e) {
        throw new RuntimeException(e.getMessage());
      }
    }

    public int numTokens() {
      if (!st.hasMoreTokens()) {
        scanLine();
        return numTokens();
      }
      return st.countTokens();
    }

    public String next() {
      if (!st.hasMoreTokens()) {
        scanLine();
        return next();
      }
      return st.nextToken();
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }
  }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Nipuna Samarasekara
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		FastPrinter out = new FastPrinter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, FastScanner in, FastPrinter out) {
        int n=in.nextInt(),m=in.nextInt(),i=in.nextInt(),j=in.nextInt(),a=in.nextInt(),b=in.nextInt();
          int[] D= new int[2];
        int[] P= new int[2];
      int i1=0,i2=0,ans=100000000,v1=0,v2=0;
        v1=Math.max((i-1)/a,(n-i)/a);
        v2=Math.max((j-1)/b,(m-j)/b);
        if((i-1)%a==0){D[i1]=(i-1)/a; i1++;}
        if((n-i)%a==0){D[i1]=(n-i)/a; i1++;}
        if((j-1)%b==0){P[i2]=(j-1)/b; i2++;}
        if((m-j)%b==0){P[i2]=(m-j)/b; i2++;}
        for (int k = 0; k < i1; k++) {
            for (int l = 0; l < i2; l++) {
                if((D[k]-P[l])%2==0){
                    if(D[k]==P[l])
                    ans= Math.min(ans,Math.max(D[k],P[l]));
                    else if(D[k]>P[l]&&v2>0)  ans= Math.min(ans,Math.max(D[k],P[l]));
                    else if(D[k]<P[l]&&v1>0) ans= Math.min(ans,Math.max(D[k],P[l]));

                }
            }
        }

      if(ans>99999999) out.println("Poor Inna and pony!");
       else out.println(ans);

    }
}

class FastScanner extends BufferedReader {

    public FastScanner(InputStream is) {
        super(new InputStreamReader(is));
    }

    public int read() {
        try {
            int ret = super.read();
//            if (isEOF && ret < 0) {
//                throw new InputMismatchException();
//            }
//            isEOF = ret == -1;
            return ret;
        } catch (IOException e) {
            throw new InputMismatchException();
        }
    }

    static boolean isWhiteSpace(int c) {
        return c >= 0 && c <= 32;
    }

    public int nextInt() {
        int c = read();
        while (isWhiteSpace(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int ret = 0;
        while (c >= 0 && !isWhiteSpace(c)) {
            if (c < '0' || c > '9') {
                throw new NumberFormatException("digit expected " + (char) c
                        + " found");
            }
            ret = ret * 10 + c - '0';
            c = read();
        }
        return ret * sgn;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }

    }

class FastPrinter extends PrintWriter {

    public FastPrinter(OutputStream out) {
        super(out);
    }

    public FastPrinter(Writer out) {
        super(out);
    }

}

import java.util.*;
import java.io.*;
public class CF374A {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    void solve() throws IOException {
        int n = nextInt();
        int m = nextInt();
        int I = nextInt();
        int J = nextInt();
        int a = nextInt();
        int b = nextInt();
        int[] x = {1, n, 1, n};
        int[] y = {1, 1, m, m};
        String fail = "Poor Inna and pony!";
        int res = Integer.MAX_VALUE;
        for(int i = 0; i < x.length; i++) {
            int tp = getNum(x[i], y[i], I, J, a, b);
            res = Math.min(res, tp);
        }

        if(res == Integer.MAX_VALUE) {
            out(fail);
            return;
        }
        out(res);

    }
    public int getNum(int n, int m, int i, int j, int a, int b) {
        int diff1 = Math.abs(n - i);
        int diff2 = Math.abs(m - j);
        if(diff1 % a != 0)
            return Integer.MAX_VALUE;
        if(diff2 % b != 0)
            return Integer.MAX_VALUE;
        int v1 = diff1 / a;
        int v2 = diff2 / b;
        if(v1 % 2 != v2 % 2)
            return Integer.MAX_VALUE;
        if(v1 == 0 && v2 == 0)
            return 0;
        if(v1 == 0 || v2 == 0)
            return Integer.MAX_VALUE;
        return Math.max(v1, v2);
    }

    private void outln(Object o) {
        System.out.println(o);
    }
    private void out(Object o) {
        System.out.print(o);
    }
    public CF374A() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new CF374A();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}

import java.io.*;
import java.util.*;

import static java.lang.Double.parseDouble;
import static java.lang.Integer.MAX_VALUE;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;

public class Solver {
    static BufferedReader in;
    static StringTokenizer tok;

    static int n, m, a, b, x, y;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));

        n = nextInt();
        m = nextInt();
        x = nextInt();
        y = nextInt();
        a = nextInt();
        b = nextInt();

        int ans = Integer.MAX_VALUE;

        ans = Math.min(ans, go(1, 1));
        ans = Math.min(ans, go(1, m));
        ans = Math.min(ans, go(n, 1));
        ans = Math.min(ans, go(n, m));

        if (ans == Integer.MAX_VALUE) {
            System.out.println("Poor Inna and pony!");
        } else {
            System.out.println(ans);
        }

    }
    // from (x, y) to (i, j)
    static int go(int i, int j) {
        int dx = Math.abs(x - i);
        int dy = Math.abs(y - j);
        if (dx % a != 0 || dy % b != 0) {
            return Integer.MAX_VALUE;
        }
        int cx = dx / a;
        int cy = dy / b;
        if (cx % 2 != cy % 2) {
            return Integer.MAX_VALUE;
        }
        if (cx == 0 && cy == 0) {
            return 0;
        }
        if (cx == 0 && (x < a && x + a >= n)) {
            return Integer.MAX_VALUE;
        }
        if (cy == 0 && (y < b && y + b >= m)) {
            return Integer.MAX_VALUE;
        }
        return Math.max(cx, cy);
    }

    static String next() throws IOException {
        if (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static int nextInt() throws IOException {
        return parseInt(next());
    }

    static long nextLong() throws IOException {
        return parseLong(next());
    }

    static double nextDouble() throws IOException {
        return parseDouble(next());
    }
}

import java.util.*;
import java.io.*;
public class Main {
    static BufferedReader reader
		= new BufferedReader(new InputStreamReader(System.in));
    static StringBuilder out = new StringBuilder();
    static int a, b, n, m;

    public static void main(String[] args){
        int[] inp = nextIntArray();
        int i, j;
        n = inp[0]; m = inp[1]; i = inp[2]; j = inp[3]; a = inp[4]; b = inp[5];
        int min = (int) 1e7;
        int[] rs = {1, n};
        int[] cs = {1, m};
        for (int r : rs)
            for (int c : cs)
                min = Math.min(min, move(Math.abs(r - i), Math.abs(c - j)));

        if (min > (int) 1e6){
            out.append("Poor Inna and pony!");
        } else {
            out.append(min);
        }
        System.out.println(out);
    }
    static int move(int r, int c){
        if (r == 0 && c == 0){
            return 0;
        }
        if (n > b && m > a && r % b == 0 && c % a == 0){
            r /= b;
            c /= a;
            if (r % 2 == c % 2){
                return Math.max(r, c);
            }
        }
        return (int) 1e7;
    }

    // the followings are methods to take care of inputs.
    static int nextInt(){
        return Integer.parseInt(nextLine());
    }
    static long nextLong(){
        return Long.parseLong(nextLine());
    }
    static int[] nextIntArray(){
        String[] inp = nextLine().split("\\s+");
        int[] ary = new int[inp.length]; for (int i = 0; i < ary.length; i++){
            ary[i] = Integer.parseInt(inp[i]);
        }
        return ary;
    }
    static int[] nextIntArrayFrom1(){
        String[] inp = nextLine().split("\\s+");
        int[] ary = new int[inp.length + 1];
        for (int i = 0; i < inp.length; i++){
            ary[i+1] = Integer.parseInt(inp[i]);
        }
        return ary;
    }
    static long[] nextLongArray(){
        String[] inp = nextLine().split("\\s+");
        long[] ary = new long[inp.length];
        for (int i = 0; i < inp.length; i++){
            ary[i] = Long.parseLong(inp[i]);
        }
        return ary;
    }
    static long[] nextLongArrayFrom1(){
        String[] inp = nextLine().split("\\s+");
        long[] ary = new long[inp.length + 1];
        for (int i = 0; i < inp.length; i++){
            ary[i+1] = Long.parseLong(inp[i]);
        }
        return ary;
    }
	static String nextLine(){
		try {
			return reader.readLine().trim();
		} catch (Exception e){}
		return null;
	}
}

import java.util.Scanner;
import java.util.Stack;

/*
 * http://codeforces.com/problemset/problem/374/A
 */
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		int i = in.nextInt();
		int j = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();

		//initializing: 'd' for deadend, 's' for in stack, 'e' for empty
//		char[][] board = new char[n+1][m+1];
//		Stack<Cell> stack = new Stack<Cell>();
//
//		stack.push(new Cell(i,j));

		//p = possibility

		int[] cornrow = {1,1,m,m};
		int[] corncol = {1,n,1,n};
		int[] moves = new int[4];

		for (int k=0; k<4; k++){
			int row = cornrow[k];
			int col = corncol[k];
			//special case: piece already on corner
			if (row == i && col == j){
				moves[k] = 0;
				continue;
			}
			int distr = i - row;
			int distc = j - col;
			int quotr = distr / a; //quotients
			int quotc = distc / b;
			int remr = distr % a; //remainders
			int remc = distc % b;
			if (Math.abs(distr) < a || Math.abs(distc) < b
					|| (remr != 0) || (remc != 0)
					|| (quotr-quotc) % 2 != 0){
				moves[k] = -1;
			} else {
				moves[k] = (Math.abs(quotc) + Math.abs(quotr)) / 2;
			}
		}

		int min = Integer.MAX_VALUE;
		for (int k=0; k<4; k++){
			if (moves[k] == -1){
				continue;
			} else {
				if (moves[k] < min){
					min = moves[k];
				}
			}
		}

		if (min != Integer.MAX_VALUE){
			System.out.println(min);
		} else {
			System.out.println("Poor Inna and pony!");
		}

	}

	/**
	 *
	 * A cell in the board
	 *
	 */
	private static class Cell{
		public int x;
		public int y;

		/**
		 * Constructor
		 * @param x
		 * @param y
		 */
		public Cell(int x, int y){
			this.x = x;
			this.y = y;
		}

	}

}

import java.util.Scanner;

public class InnaAndPinkPony {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int i = sc.nextInt();
		int j = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		int x1 = (i-1)/a;
		int xx1 = (i-1)%a;
		int x2 = (n-i)/a;
		int xx2 = (n-i)%a;

		int y1 = (j-1)/b;
		int yy1 = (j-1)%b;
		int y2 = (m-j)/b;
		int yy2 = (m-j)%b;

		//System.out.println(x1 + " " + x2 + " " + y1 + " " + y2);

		int ans = Integer.MAX_VALUE;

		if(x1%2==0 && y1%2==0 && xx1==0 && yy1==0){
			if(Math.max(x1, y1)<ans){
				ans = Math.max(x1, y1);
			}
		}
		else if(x1%2==0 && y2%2==0 && xx1==0 && yy2==0){
				if(Math.max(x1, y2)<ans){
					ans = Math.max(x1, y2);
				}
		}
		else if(x2%2==0 && y1%2==0 && xx2==0 && yy1==0){
			if(Math.max(x2, y1)<ans){
				ans = Math.max(x2, y1);
			}
		}
		else if(x2%2==0 && y2%2==0 && xx2==0 && yy2==0){
			if(Math.max(x2, y2)<ans){
				ans = Math.max(x2, y2);
			}
		}

		else if(x1%2==1 && y1%2==1 && xx1==0 && yy1==0){
			if(Math.max(x1, y1)<ans){
				ans = Math.max(x1, y1);
			}
		}
		else if(x1%2==1 && y2%2==1 && xx1==0 && yy2==0){
				if(Math.max(x1, y2)<ans){
					ans = Math.max(x1, y2);
				}
		}
		else if(x2%2==1 && y1%2==1 && xx2==0 && yy1==0){
			if(Math.max(x2, y1)<ans){
				ans = Math.max(x2, y1);
			}
		}
		else if(x2%2==1 && y2%2==1 && xx2==0 && yy2==0){
			if(Math.max(x2, y2)<ans){
				ans = Math.max(x2, y2);
			}
		}
		if(ans<Integer.MAX_VALUE)
			System.out.println(ans);
		else
			System.out.println("Poor Inna and pony!");
		sc.close();
	}
}

import java.util.Scanner;
import java.io.*;
import java.util.*;
public class CF2{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int i = sc.nextInt();
		int j = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int min = Integer.MAX_VALUE;
		//points are (1,1),(n,1),(1,m),(n,m)
		//both odd or even
		//completely divisible
		int[] x = new int[]{1,n,1,n};
		int[] y = new int[]{1,1,m,m};
		for(int k = 0; k < 4; k++){
		    int p = Math.abs(x[i]-i);
		    int q = Math.abs(y[i]-j);
		    if((p%a==0 && q%b==0)&&((p/a)%2==(q/b)%2)){
		        int ans = Math.max(p/a,q/b);
		        if(ans<min ||min == Integer.MAX_VALUE){
		            ans = min;
		        }
		    }
		}
		if(min==-1){
		    System.out.println("Poor Inna and pony!");
		}
		else{
		    System.out.println(min);
		}
	}
}

import java.util.*;
import java.io.*;
public class ninapony
{
public static void main(String args[])throws IOException
{
int n,m,a,b,i,j;
InputStreamReader input=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(input);
String str[];
str=(br.readLine()).split(" ");
n=Integer.parseInt(str[0]);
m=Integer.parseInt(str[1]);
i=Integer.parseInt(str[2]);
j=Integer.parseInt(str[3]);
a=Integer.parseInt(str[4]);
b=Integer.parseInt(str[5]);
int w=n-i;
int x=i-1;
int y=m-j;
int z=j-1;
int min1,min2;
int cx=0,cy=0;
if(((w%a)==0 || (x%a)==0)&&((y%b)==0 || (z%b)==0))
{
if((w%a)==0 && (x%a)==0)
{cx=2;
min1= (Math.min(w,x))/a;
}
else if((w%a)==0)
{cx=1;
min1=w/a;
}
else
{cx=1;
min1=x/a;
}
if((y%b)==0 && (z%b)==0)
{
cy=2;
min2= (Math.min(y,z))/b;
}
else if((y%b)==0)
{
cy=1;
min2=y/b;
}
else
{cy=1;
min2=z/b;
}
if((min1-min2)%2==0)
System.out.println(Math.max(min1,min2));
else
{
if(cy==2 && cx==1)
{min2=(Math.max(y,z))/b;
if((min1-min2)%2==0)
{
    System.out.println(Math.max(min1,min2));
}
else
{
    System.out.println("Poor Inna and pony!");
}
}
else if(cx==2 && cy==1)
{
min1=(Math.max(w,x))/a;
if((min1-min2)%2==0)
System.out.println(Math.max(min1,min2));
else
System.out.println("Poor Inna and pony!");
}
else if(cx==2 && cy==2)
{int max1=(Math.max(w,x))/a;
int max2=(Math.max(y,z))/b;
ArrayList<Integer> x1 = new ArrayList<Integer>();
if((max1-min2)%2==0 && (max1-min2)!=0)
{
x1.add(max1-min2);
}
if((max2-min1)%2==0 && (max2-min1)!=0)
{x1.add(max2-min1);

}
if((max1-max2)%2==0 && (max1-max2)!=0)
{
x1.add(max1-max2);

}
if(x1.size()==0)
System.out.println("Poor Inna and pony!");
else{
Collections.sort(x1);
System.out.println(x1.get(0));
}
}
}}

else
System.out.println("Poor Inna and pony!");
}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class InnaPinkPony {

    private static int INF = 1000000;

    public static void main(String[] args) {
        int n, m, i, j, a, b;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line = br.readLine();
            String[] params = line.split(" ");
            n = Integer.parseInt(params[0]);
            m = Integer.parseInt(params[1]);
            i = Integer.parseInt(params[2]);
            j = Integer.parseInt(params[3]);
            a = Integer.parseInt(params[4]);
            b = Integer.parseInt(params[5]);

            int[][] corners = new int[][] { { 1, m }, { n, 1 }, { n, m },
                    { 1, 1 } };

            int min = INF;
            for (int[] cor : corners) {
                int xdiff = cor[0] - i;
                int ydiff = cor[1] - j;

                if (xdiff % a != 0 || ydiff % b != 0) {
                    continue;
                }
                int xmoves = Math.abs(xdiff) / a;
                int ymoves = Math.abs(ydiff) / b;
                if (xmoves % 2 == ymoves % 2) {
                    min = Math.min(min, Math.max(xmoves, ymoves));
                }
            }
            if ((i - a < 1 && i + a > n) || (j - b < 1 && j + b > m)) {
                min = INF;
            }
            if (min == INF) {
                System.out.print("Poor Inna and pony!");
            } else {
                System.out.print(min);
            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
}

import java.util.Scanner;

/**
 * Created by fox on 24/07/2016.
 */
public class AInnaAndPinkPony {
    static int di[] = {1,0,1,0};
    static int dj[] = {1,0,0,1};

    public static void main(String []args) {
        Scanner input = new Scanner(System.in);
        int n, m , i, j , a , b;
        n = input.nextInt();
        m = input.nextInt();
        i = input.nextInt();
        j = input.nextInt();
        a = input.nextInt();
        b = input.nextInt();

        int ans = 2000000000;
        int X , Y;
        int xn , yn;

        for(int k = 0 ; k < 4 ; k++) {
            X = (n - 1) * di[k] + 1;
            Y = (m - 1) * dj[k] + 1;
            xn = Math.abs(X - i);
            yn = Math.abs(Y - j);
            if(xn % a == 0 && yn % b == 0){
                if((xn / a) % 2 == (yn / b) % 2){
                    ans = Math.min(ans , Math.max((xn / a) ,  (yn / b)));
                }
            }
        }

        if(ans != 2000000000){
            System.out.println(ans);
        }else{
            System.out.println("Poor Inna and pony!");
        }

    }
}

import java.util.Scanner;
import java.util.Stack;

/*
 * http://codeforces.com/problemset/problem/374/A
 */
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		int i = in.nextInt();
		int j = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();

		//initializing: 'd' for deadend, 's' for in stack, 'e' for empty
//		char[][] board = new char[n+1][m+1];
//		Stack<Cell> stack = new Stack<Cell>();
//
//		stack.push(new Cell(i,j));

		//p = possibility

		int[] cornrow = {1,1,n,n};
		int[] corncol = {1,m,1,m};
		int[] moves = new int[4];

		for (int k=0; k<4; k++){
			int row = cornrow[k];
			int col = corncol[k];
			//special case: piece already on corner
			if (row == i && col == j){
				moves[k] = 0;
				continue;
			}
			int distr = i - row;
			int distc = j - col;
			int quotr = distr / a; //quotients
			int quotc = distc / b;
			int remr = distr % a; //remainders
			int remc = distc % b;
			if ((i - a < 1 && i + a > m)
					|| (j - b < 1 && j + b > n)
					|| (remr != 0) || (remc != 0)
					|| (quotr-quotc) % 2 != 0){
				//System.out.println(row + " " + col + " " + i + " " + j + " bad");
				moves[k] = -1;
			} else {
				//System.out.println(row + " " + col + " " + i + " " + j);
				moves[k] = Math.max(Math.abs(quotc),Math.abs(quotr));
			}
		}

		int min = Integer.MAX_VALUE;
		for (int k=0; k<4; k++){
			if (moves[k] == -1){
				continue;
			} else {
				if (moves[k] < min){
					min = moves[k];
				}
			}
		}

		if (min != Integer.MAX_VALUE){
			System.out.println(min);
		} else {
			System.out.println("Poor Inna and pony!");
		}

		in.close();

	}

}

import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt(); // Rows
        int M = sc.nextInt(); // Columns

        int i = sc.nextInt(); // row
        int j = sc.nextInt(); // column

        int a = sc.nextInt();
        int b = sc.nextInt();

        LinkedList<int[]> queue = new LinkedList<>();
        queue.add(new int[] {i, j});

        if (isCorner(i, j, N, M)) {
            System.out.println(0);
            return;
        }

        List<int[]> corners = new ArrayList<>();

        if (isReachable(i, j, 1, 1, a, b)) {
            corners.add(new int[] {1, 1});
        }
        if (isReachable(i, j, 1, M, a, b)) {
            corners.add(new int[] {1, M});
        }
        if (isReachable(i, j, N, 1, a, b)) {
            corners.add(new int[] {N, 1});
        }
        if (isReachable(i, j, N, M, a, b)) {
            corners.add(new int[] {N, M});
        }

        int min = Integer.MAX_VALUE;
        for (int[] corner : corners) {
            int d_x = (int)Math.abs(corner[0] - i);
            int d_y = (int)Math.abs(corner[1] - j);

            int stepsX = d_x / a;
            int stepsY = d_y / b;

            // Both steps must be even or odd.
            if ((stepsX % 2) != (stepsY % 2)) {
                continue;
            }

            int stepsNeeded = Math.max(stepsX, stepsY);
            // Within stepsNeeded steps can we reach the point?

            min = Math.min(min, stepsNeeded);
        }

        if (min == Integer.MAX_VALUE) {
            System.out.println("Poor Inna and pony!");
        }
        else {
            System.out.println(min);
        }
    }

    public static boolean isReachable(int row, int col, int tX, int tY, int a, int b) {
        int diffX = (int) Math.abs(row - tX);
        int diffY = (int) Math.abs(col - tY);

        return ((diffX % a == 0) && (diffY % b == 0));
    }

    public static boolean isCorner(int row, int col, int N, int M) {
        return  (row == 1 && col == 1) ||
                (row == 1 && col == M) ||
                (row == N && col == 1) ||
                (row == N && col == M);
    }
}

import java.util.*;
import java.io.*;

public class A220 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int i = sc.nextInt();
        int j = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();

        int cnt1 = Integer.MAX_VALUE, cnt2 = Integer.MAX_VALUE, cnt3 = Integer.MAX_VALUE, cnt4 = Integer.MAX_VALUE;

        if(i+a>n || i-a<0){
            out.println("Poor Inna and pony!");
            out.flush();
            return;
        }
        if(j+b>m || j-b<0){
            out.println("Poor Inna and pony!");
            out.flush();
            return;
        }

        int deltay = Math.abs(i - 1);
        int deltax = Math.abs(j - 1);
        if (deltax % b == 0 && deltay % a == 0) {
            int stepa = deltax / b;
            int stepb = deltay / a;
            if (Math.abs(stepa - stepb) % 2 == 0) {
                cnt1 = Math.max(stepa, stepb);
            }
        }

        deltax = Math.abs(m - j);
        deltay = Math.abs(n - i);
        if (deltax % b == 0 && deltay % a == 0) {
            int stepa = deltax / b;
            int stepb = deltay / a;
            if (Math.abs(stepa - stepb) % 2 == 0) {
                cnt2 = Math.max(stepa, stepb);
            }
        }

        deltax = Math.abs(j - 1);
        deltay = Math.abs(n - i);
        if (deltax % b == 0 && deltay % a == 0) {
            int stepa = deltax / b;
            int stepb = deltay / a;
            if (Math.abs(stepa - stepb) % 2 == 0) {
                cnt3 = Math.max(stepa, stepb);
            }
        }

        deltax = Math.abs(m - j);
        deltay = Math.abs(i - 1);
        if (deltax % b == 0 && deltay % a == 0) {
            int stepa = deltax / b;
            int stepb = deltay / a;
            if (Math.abs(stepa - stepb) % 2 == 0) {
                cnt4 = Math.max(stepa, stepb);
            }
        }

        int res = Math.min(cnt1, cnt2);
        res = Math.min(res, cnt3);
        res = Math.min(res, cnt4);

        if (res == Integer.MAX_VALUE) {
            out.println("Poor Inna and pony!");
            out.flush();
            return;
        }

        out.println(res);
        out.flush();
    }
}

import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt(), y = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt();
        int[] tx = {1, n, n, 1}, ty = {m, 1, m, 1};
        int ans = -1;
        for (int i = 0; i < 4; i++) {
            int dx = Math.abs(tx[i] - x), dy = Math.abs(ty[i] - y);
            if (dx % a != 0 || dy % b != 0) continue;
            dx /= a;
            dy /= b;
            int diff = Math.abs(dx - dy);
            if (diff % 2 != 0 || (dx + dy != 0 && (n == 1 || m == 1))) continue;
            int cand = Math.max(dx, dy);
            if (diff % 2 == 0 && (ans == -1 || cand < ans)) ans = cand;
        }
        out.println(ans == -1 ? "Poor Inna and pony!" : ans);
        out.flush();
        out.close();

    }

    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }
}

import java.util.Scanner;

/**
 * Created by fox on 24/07/2016.
 */
public class AInnaAndPinkPony {

    static int di[] = {1,0,1,0};
    static int dj[] = {1,0,0,1};

    public static void main(String []args) {
        Scanner input = new Scanner(System.in);
        int n, m , i, j , a , b;
        n = input.nextInt();
        m = input.nextInt();
        i = input.nextInt();
        j = input.nextInt();
        a = input.nextInt();
        b = input.nextInt();

        int ans = 2000000000;
        int X , Y;
        int xn , yn;

        for(int k = 0 ; k < 4 ; k++) {
            X = (n - 1) * di[k] + 1;
            Y = (m - 1) * dj[k] + 1;
            xn = Math.abs(X - i);
            yn = Math.abs(Y - j);
            if(xn % a == 0 && yn % b == 0){
                if((xn / a) % 2 == (yn / b) % 2){
                    if((xn / a) > (yn / b) && m > 1){
                        ans = Math.min(ans , (xn / a));
                    }else if((xn / a) < (yn / b) && n > 1){
                        ans = Math.min(ans , (yn / b));
                    }else if((xn / a) == (yn / b)){
                        ans = Math.min(ans , (xn / a));
                    }

                }
            }
        }

        if(ans != 2000000000){
            System.out.println(ans);
        }else{
            System.out.println("Poor Inna and pony!");
        }

    }
}

import java.io.*;
import java.util.*;

/**
 *
 * @author Altynbek.Nurgaziyev
 */
public class R220_D2_A {

        public int count(int x, int y, int i, int j, int a, int b) {
                if (Math.abs(x - i) % a == 0 && Math.abs(y - j) % b == 0) {
                        if ((Math.abs(x - i) / a) % 2 == (Math.abs(y - j) % b) % 2) {
                                return Math.max(Math.abs(x - i) / a, Math.abs(y - j) % b);
                        }
                }
                return -1;
        }

        public void solution() throws Exception {
                int n = in.nextInt();
                int m = in.nextInt();
                int i = in.nextInt();
                int j = in.nextInt();
                int a = in.nextInt();
                int b = in.nextInt();

                int min = Integer.MAX_VALUE;
                boolean bool = false;
                if (count(n, m, i, j, a, b) != -1) {
                        min = Math.min(count(n, m, i, j, a, b), min);
                        bool = true;
                }
                if (count(1, 1, i, j, a, b) != -1) {
                        min = Math.min(count(n, m, i, j, a, b), min);
                        bool = true;
                }
                if (count(1, m, i, j, a, b) != -1) {
                        min = Math.min(count(n, m, i, j, a, b), min);
                        bool = true;
                }
                if (count(n, 1, i, j, a, b) != -1) {
                        min = Math.min(count(n, m, i, j, a, b), min);
                        bool = true;
                }
                if (!bool) {
                        out.println("Poor Inna and pony!");
                } else {
                        out.println(min);
                }
        }

        Scanner in;
        PrintWriter out;
        String input, output;

        public void run() throws Exception {
                if (input != null) {
                        in = new Scanner(new FileReader(input));
                } else {
                        in = new Scanner(System.in);
                }

                if (output != null) {
                        out = new PrintWriter(new File(output));
                } else {
                        out = new PrintWriter(System.out);
                }

                solution();

                out.close();
        }

        public static void main(String[] args) throws Exception {
                new R220_D2_A().run();
        }

        public class Scanner {

                private BufferedReader br;
                private StringTokenizer st;

                public Scanner(InputStream is) {
                        br = new BufferedReader(new InputStreamReader(is));
                }

                public Scanner(FileReader fr) {
                        br = new BufferedReader(fr);
                }

                public String next() throws Exception {
                        while (st == null || !st.hasMoreTokens()) {
                                st = new StringTokenizer(br.readLine());
                        }
                        return st.nextToken();
                }

                public Integer nextInt() throws Exception {
                        return Integer.parseInt(next());
                }

                public Long nextLong() throws Exception {
                        return Long.parseLong(next());
                }

                public Double nextDouble() throws Exception {
                        return Double.parseDouble(next());
                }
        }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Algorithm {

	public static void main(String args[]) throws Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Solution s = new Solution();
		s.solve(in, out);
		out.close();
	}
}

class Solution {

	public void solve(InputReader in, PrintWriter out) {
		int n = in.nextInt();
		int m = in.nextInt();
		int i = in.nextInt();
		int j = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();

		int min = Math.max(m,n);
		if (((i - 1) / a) % 2 == ((j - 1) / b) % 2 ) {
			if ((i - 1) % a == 0 && (j - 1) % b == 0)
			min = Math.min(min, Math.max((i - 1) / a, (j - 1) / b));
		}
		if (((i - 1) / a) % 2 == ((m - j) / b) % 2) {
			if ((i - 1) % a == 0 && (m - j) % b == 0)
			min = Math.min(min, Math.max((i - 1) / a,  (m - j) / b));
		}
		if (((n - i) / a) % 2 == ((j - 1) / b) % 2 ) {
			if ((n - i) % a == 0 && (j - 1) % b == 0)
			min = Math.min(min, Math.max((n - i) / a, (j - 1) / b));
		}
		if (((n - i) / a) % 2 == ((m - j) / b) % 2) {
			if ((n - i) % a == 0 && (m - j) % b == 0)
			min = Math.min(min, Math.max((n - i) / a,  (m - j) / b));
		}
		if (min < Math.max(m,n) + 1){
			if (min > 0 && ((a + i > n && i - a <1) || ((b + j > m && j - b <1)))){
				out.print("Poor Inna and pony!");
			}else{
			out.print(min);
			}
		}else{
			out.print("Poor Inna and pony!");
		}
	}
}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

}

import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt(), y = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt();
        int[] tx = {1, n, n, 1}, ty = {m, 1, m, 1};
        int ans = -1;
        boolean cannot = (x - a <= 0 && x + a > n) || (y - a <= 0 && y + a > m);
        for (int i = 0; i < 4; i++) {
            int dx = Math.abs(tx[i] - x), dy = Math.abs(ty[i] - y);
            if (dx % a != 0 || dy % b != 0) continue;
            dx /= a;
            dy /= b;
            if (dx == dy || dx + dy == 0) {
                int cand = Math.max(dx, dy);
                if (ans == -1 || cand < ans) ans = cand;
                continue;
            }
            int diff = Math.abs(dx - dy);
            if (diff % 2 != 0 || cannot) continue;
            int cand = Math.max(dx, dy);
            if (ans == -1 || cand < ans) ans = cand;
        }
        out.println(ans == -1 ? "Poor Inna and pony!" : ans);
        out.flush();
        out.close();

    }

    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class A {

	static class Scanner{
		BufferedReader br=null;
		StringTokenizer tk=null;
		public Scanner(){
			br=new BufferedReader(new InputStreamReader(System.in));
		}
		public String next() throws IOException{
			while(tk==null || !tk.hasMoreTokens())
				tk=new StringTokenizer(br.readLine());
			return tk.nextToken();
		}
		public int nextInt() throws NumberFormatException, IOException{
			return Integer.valueOf(next());
		}
		public double nextDouble() throws NumberFormatException, IOException{
			return Double.valueOf(next());
		}
	}

	static int N,M,I,J,A, B;

	public static void main(String args[]) throws NumberFormatException, IOException{
		Scanner sc = new Scanner();
		N = sc.nextInt();
		M = sc.nextInt();
		I = sc.nextInt();
		J = sc.nextInt();
		A = sc.nextInt();
		B = sc.nextInt();
		int[] a1 = {1, 1, N, N};
		int[] a2 = {1, M, 1, M};
		int ans = Integer.MAX_VALUE;
		for(int i = 0; i < 4; i++){
			int ox = a1[i];
			int oy = a2[i];
			int tx = ox - I;
			int ty = oy - J;
			if (tx % A != 0 || ty % B != 0)
				continue;
			int c1 = tx / A;
			int c2 = ty / B;
			if (Math.abs(c1) != Math.abs(c2))
				continue;
			ans = Math.min(ans, Math.abs(c1));
		}
		if (ans == Integer.MAX_VALUE)
			System.out.println("Poor Inna and pony!");
		else
			System.out.println(ans);
	}

}

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForce18a {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int i = scan.nextInt();
        int j = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();

        int min = Integer.MAX_VALUE;

        int currr = i, currc = j;
        int moves = 0;
        while (currr > 1 & currc > 1) {
            currr = currr - a;
            currc = currc - b;
            moves++;
        }

        if (currr == 1 && currc == 1) {
           min= Math.min(min,moves);
        }

        currr = i;
        currc = j;
        moves = 0;
        while (currr < n & currc < m) {
            currr = currr + a;
            currc = currc + b;
            moves++;
        }

        if (currr == n && currc == m) {
           min= Math.min(min,moves);
        }

        currr = i;
        currc = j;
        moves = 0;
        while (currr >1  & currc < m) {
            currr = currr - a;
            currc = currc + b;
            moves++;
        }

        if (currr == 1 && currc == m) {
           min= Math.min(min,moves);
        }

        currr = i;
        currc = j;
        moves = 0;
        while (currr >n  & currc < 1) {
            currr = currr + a;
            currc = currc - b;
            moves++;
        }

        if (currr == n && currc == 1) {
           min= Math.min(min,moves);
        }

        if (min != Integer.MAX_VALUE) {
            System.out.println(min);
        } else {
            System.out.println("Poor Inna and pony!");
        }

    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created with IntelliJ IDEA.
 * User: chinh
 * Date: 12/19/13
 * Time: 12:38 AM
 * To change this template use File | Settings | File Templates.
 */
public class R220D2A {
    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int i = Integer.parseInt(st.nextToken());
        int j = Integer.parseInt(st.nextToken());
        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());
        int[] u = {1,n,n,1};
        int[] v = {m,1,m,1};
        int result = Integer.MAX_VALUE;
        for(int e=0; e<4; e++){
            if((u[e]-i)%a==0 && (v[e]-j)%b==0){
                if(((u[e]-i)/2 - (v[e]-j)/b)%2==0){
                    result = Math.min(result, Math.max(Math.abs(u[e]-i)/a, Math.abs(v[e]-j)/a));
                }
            }
        }
        if(result==Integer.MAX_VALUE) System.out.println("Poor Inna and pony!"); else System.out.println(result);
    }
}

import java.util.Scanner;

public class InnaAndPinkPony {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int i = sc.nextInt();
		int j = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		int x1 = (i-1)/a;
		int x2 = (n-i)/a;

		int y1 = (j-1)/b;
		int y2 = (m-j)/b;

		int ans = Integer.MAX_VALUE;

		if(x1%2==0 && y1%2==0){
			if(Math.max(x1, y1)<ans){
				ans = Math.max(x1, y1);
			}
		}
		else if(x1%2==0 && y2%2==0){
				if(Math.max(x1, y2)<ans){
					ans = Math.max(x1, y2);
				}
		}
		else if(x2%2==0 && y1%2==0){
			if(Math.max(x2, y1)<ans){
				ans = Math.max(x2, y1);
			}
		}
		else if(x2%2==0 && y2%2==0){
			if(Math.max(x2, y2)<ans){
				ans = Math.max(x2, y2);
			}
		}

		else if(x1%2==1 && y1%2==1){
			if(Math.max(x1, y1)<ans){
				ans = Math.max(x1, y1);
			}
		}
		else if(x1%2==1 && y2%2==1){
				if(Math.max(x1, y2)<ans){
					ans = Math.max(x1, y2);
				}
		}
		else if(x2%2==1 && y1%2==1){
			if(Math.max(x2, y1)<ans){
				ans = Math.max(x2, y1);
			}
		}
		else if(x2%2==1 && y2%2==1){
			if(Math.max(x2, y2)<ans){
				ans = Math.max(x2, y2);
			}
		}
		if(ans<Integer.MAX_VALUE)
			System.out.println(ans);
		else
			System.out.println("Poor Inna and pony!");
		sc.close();
	}
}

import java.io.*;
import java.util.*;

/**
 *
 * @author Altynbek.Nurgaziyev
 */
public class R220_D2_A {

        public int count(int x, int y, int i, int j, int a, int b) {
                if (Math.abs(x - i) % a == 0 && Math.abs(y - j) % b == 0) {
                        if ((Math.abs(x - i) / a) % 2 == (Math.abs(y - j) / b) % 2) {
                                return Math.max(Math.abs(x - i) / a, Math.abs(y - j) / b);
                        }
                }
                return -1;
        }

        public void solution() throws Exception {
                int n = in.nextInt();
                int m = in.nextInt();
                int i = in.nextInt();
                int j = in.nextInt();
                int a = in.nextInt();
                int b = in.nextInt();
                if (0 > i - a || n < i + a || 0 > j - b || m < j + b) {
                        out.println("Poor Inna and pony!");
                }
                int min = Integer.MAX_VALUE;
                boolean bool = false;
                if (count(n, m, i, j, a, b) != -1) {
                        min = Math.min(count(n, m, i, j, a, b), min);
                        bool = true;
                }
                if (count(1, 1, i, j, a, b) != -1) {
                        min = Math.min(count(1, 1, i, j, a, b), min);
                        bool = true;
                }
                if (count(1, m, i, j, a, b) != -1) {
                        min = Math.min(count(1, m, i, j, a, b), min);
                        bool = true;
                }
                if (count(n, 1, i, j, a, b) != -1) {
                        min = Math.min(count(n, 1, i, j, a, b), min);
                        bool = true;
                }
                if (!bool) {
                        out.println("Poor Inna and pony!");
                } else {
                        out.println(min);
                }
        }

        Scanner in;
        PrintWriter out;
        String input, output;

        public void run() throws Exception {
                if (input != null) {
                        in = new Scanner(new FileReader(input));
                } else {
                        in = new Scanner(System.in);
                }
                if (output != null) {
                        out = new PrintWriter(new File(output));
                } else {
                        out = new PrintWriter(System.out);
                }
                solution();
                out.close();
        }

        public static void main(String[] args) throws Exception {
                new R220_D2_A().run();
        }

        public class Scanner {

                private BufferedReader br;
                private StringTokenizer st;

                public Scanner(InputStream is) {
                        br = new BufferedReader(new InputStreamReader(is));
                }

                public Scanner(FileReader fr) {
                        br = new BufferedReader(fr);
                }

                public String next() throws Exception {
                        while (st == null || !st.hasMoreTokens()) {
                                st = new StringTokenizer(br.readLine());
                        }
                        return st.nextToken();
                }

                public Integer nextInt() throws Exception {
                        return Integer.parseInt(next());
                }

                public Long nextLong() throws Exception {
                        return Long.parseLong(next());
                }

                public Double nextDouble() throws Exception {
                        return Double.parseDouble(next());
                }
        }
}

import java.util.Scanner;

public class A220Div2
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(), m = in.nextInt(), i = in.nextInt(), j = in.nextInt(), a = in.nextInt(), b = in.nextInt();
		int[] xcorners = {1,n}, ycorners = {1,m};
		int bestTime = -1;
		for (int xc = 0; xc < xcorners.length; ++xc)
		{
			for (int yc = 0; yc < ycorners.length; ++yc)
			{
				int x = xcorners[xc], y = ycorners[yc];
				int dx = Math.abs(i-x), dy = Math.abs(j-y);
				if ((dx % a != 0) || (dy % b != 0)) continue;
				int nx = dx/a, ny = dy/b;
				if (nx % 2 != ny % 2) continue;
				int time = Math.max(nx, ny);
				if (bestTime == -1 || time < bestTime) bestTime = time;
			}
		}
		System.out.println(bestTime == -1 ? "Poor Inna and pony!" : bestTime);
	}
}

import java.util.Scanner;

public class a {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n = in.nextInt()-1;
		int m = in.nextInt()-1;
		int i = in.nextInt()-1;
		int j = in.nextInt()-1;
		if(i==0){
			if(j==0||j==m){
				System.out.println(0);
				return;
			}
		}
		if(i==n){
			if(j==0||j==m){
				System.out.println(0);
				return;
			}
		}
		int a = in.nextInt();
		int b = in.nextInt();
		int right = n-i;
		int down = m-j;
		//System.out.println("LEFT "+i+" UP "+j+" DOWN "+down+" RIGHT "+right);
		int goleft = i/a;
		if(i%a!=0 || a>i){
			goleft=Integer.MAX_VALUE;
		}
		int goup = j/b;
		if(j%b!=0 || b>j){
			goup=Integer.MAX_VALUE;
		}
		int goright = right/a;
		if(right%a!=0 || right + a > n){
			goright=Integer.MAX_VALUE;
		}
		int godown = down/b;
		if(i%b!=0 || down +b > m){
			godown=Integer.MAX_VALUE;
		}
		//System.out.println("LEFT "+goleft+" UP "+goup+" DOWN "+godown+" RIGHT "+goright);
		int min = Integer.MAX_VALUE;

		if(godown%2==goleft%2){
			min = Math.min(min, Math.max(godown, goleft));
		}
		if(godown%2==goright%2){
			min = Math.min(min, Math.max(godown, goright));
		}
		if(goup%2==goleft%2){
			min = Math.min(min, Math.max(goup, goleft));
		}
		if(goup%2==goright%2){
			min = Math.min(min, Math.max(goup, goright));
		}
		System.out.println(min==Integer.MAX_VALUE?"Poor Inna and pony!":min);
	}

}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class TA {

	public void solve(int n, int m, int i, int j, int a, int b) {
		int[][] corner = new int[][] {{1, m}, {n, 1}, {n, m}, {1, 1}};
		long ans = Long.MAX_VALUE;
		for (int k = 0; k < 4; k ++) {
			if (i == corner[k][0] && j == corner[k][1]) {
				System.out.println(0);
				return;
			}
			if (Math.abs(i - corner[k][0]) % a == 0 && Math.abs(j - corner[k][1]) % b == 0) {
				int p = Math.abs(i - corner[k][0]) / a;
				int q = Math.abs(j - corner[k][1]) / b;

				if (Math.abs(p - q) % 2 == 0)
					ans = Math.min(ans, Math.max(p, q));
			}
		}

		if (ans == Long.MAX_VALUE)
			System.out.println("Poor Inna and pony!");
		else
			System.out.println(ans);
	}

	public static void main(String[] args) {
		FastScanner in = new FastScanner();

		new TA().solve(in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt());

	}

	static class FastScanner {

		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}

	}

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        int x = in.nextInt();
        int y = in.nextInt();
        int dx = in.nextInt();
        int dy = in.nextInt();

        int ans = Integer.MAX_VALUE;
        if (((n - x) % 2 * dx == 0 && (m - y) % 2 * dy == 0) ||
            (x + dx <= n && y + dy <= m && (n - x + dx) % 2 * dx == 0 && (m - y + dy) % 2 * dy == 0))
            ans = Math.min(ans, Math.max((n - x) / dx, (m - y) / dy));

        if (((n - x) % 2 * dx == 0 && (y - 1) % 2 * dy == 0) ||
            (x + dx <= n && y - dy > 0 && (n - x + dx) % 2 * dx == 0 && (y - 1 - dy) % 2 * dy == 0))
            ans = Math.min(ans, Math.max((n - x) / dx, (m - y) / dy));

        if (((x - 1) % 2 * dx == 0 && (m - y) % 2 * dy == 0) ||
            (x - dx > 0 && y + dy <= m && (x - 1 - dx) % 2 * dx == 0 && (m - y + dy) % 2 * dy == 0))
            ans = Math.min(ans, Math.max((n - x) / dx, (m - y) / dy));

        if (((x - 1) % 2 * dx == 0 && (y - 1) % 2 * dy == 0) ||
            (x - dx > 0 && y - dy > 0 && (x - 1 - dx) % 2 * dx == 0 && (y - 1 - dy) % 2 * dy == 0))
            ans = Math.min(ans, Math.max((n - x) / dx, (m - y) / dy));

        if (ans == Integer.MAX_VALUE) out.println("Poor Inna and pony!");
        else out.println(ans);
    }
}

class InputReader {
    BufferedReader in;
    StringTokenizer st;

    public InputReader(InputStream stream) {
        in = new BufferedReader(new InputStreamReader(stream));
        eat("");
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public String next() {
        while (!st.hasMoreTokens())
            eat(nextLine());
        return st.nextToken();
    }

    public String nextLine() {
        try {
            return in.readLine();
        } catch (IOException e) {
            throw new InputMismatchException();
        }
    }

    public void eat(String str) {
        if (str == null) throw new InputMismatchException();
        st = new StringTokenizer(str);
    }
}

import java.util.*;
/*
1 4 1 2 2 1

*/

public class aa {

	public static void main(String[] args) {

		Scanner qwe = new Scanner(System.in);

		int n = qwe.nextInt();
		int m = qwe.nextInt();
		int r = qwe.nextInt();
		int c =qwe.nextInt();
		int a = qwe.nextInt();
		int b = qwe.nextInt();

		ArrayList<Integer> pos = new ArrayList<Integer>();

		if((r-1) % a == 0){
			pos.add((r-1)/a);
		}
		if((n-r) % a == 0){
			pos.add((n-r)/a);
		}

		int min = Integer.MAX_VALUE;

		int d = c-1;
		for(int p : pos){
			if(d % b == 0){
				int o = d/b;
				if((o-p) % 2 == 0){
					min = Math.min(min, Math.max(o, p));
				}
			}
		}

		d = m-c;
		for(int p : pos){
			if(d % b == 0){
				int o = d/b;
				if((o-p) % 2 == 0){
					min = Math.min(min, Math.max(o, p));
				}
			}
		}

		boolean impos = false;
		if( (r-a < 1 && r + a > n) || (c-b < 1 && c + b > n) ){
			if((r == 1 || r == n) && (c == 1 || c == m)){

			}
			else impos = true;

		}

		if(min == Integer.MAX_VALUE || impos){
			System.out.println("Poor Inna and pony!");
		}
		else{
			System.out.println(min);
		}

		qwe.close();

	}

}

import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class A {
	public static void main(String[] args) {
		new A().go();
	}
	public boolean done(boolean x, boolean y, int xs, int ys){
		if (x && y) {
			if (xs%2 == ys%2) {
				return true;
			}
		}
		return false;
	}
	public int step(int xs, int ys){
		int steps = Math.max(xs, ys);
		return steps;
	}

	private void go() {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(), m = in.nextInt(), i = in.nextInt(), j = in
				.nextInt(), a = in.nextInt(), b = in.nextInt();
		boolean x_1 = x_1_1(n, m, i, j, a, b);
		boolean x_n = x_n_1(n, m, i, j, a, b);
		boolean y_1 = y_1_1(n, m, i, j, a, b);
		boolean y_m = y_m_1(n, m, i, j, a, b);

		boolean x_1_2 = x_1_2(n, m, i, j, a, b);
		boolean x_n_2 = x_n_2(n, m, i, j, a, b);
		boolean y_1_2 = y_1_2(n, m, i, j, a, b);
		boolean y_m_2 = y_m_2(n, m, i, j, a, b);

		int x_1_steps = (i - 1) / a;
		int x_n_steps = (n - i) / a;
		int y_1_steps = (j - 1) / b;
		int y_m_steps = (m - j) / b;

		boolean can = false;
		int steps = Integer.MAX_VALUE;

		if(i==1){
			if(j==1 || j==m){
				System.out.println(0);
				return;
			}
		}

		if(i==n){
			if(j==1 || j==m){
				System.out.println(0);
				return;
			}
		}
		if(done(x_1_2, y_1_2, x_1_steps, y_1_steps)){
			can = true;
			steps = Math.min(steps, step(x_1_steps, y_1_steps));
		}
		if(done(x_1_2, y_m_2, x_1_steps, y_m_steps)){
			can = true;
			steps = Math.min(steps, step(x_1_steps, y_m_steps));

		}
		if(done(x_n_2, y_1_2, x_n_steps, y_1_steps)){
			can = true;
			steps = Math.min(steps, step(x_n_steps, y_1_steps));

		}
		if(done(x_n_2, y_m_2, x_n_steps, y_m_steps)){
			can = true;
			steps = Math.min(steps, step(x_n_steps, y_m_steps));
		}

		if(done(x_1, y_1, x_1_steps, y_1_steps)){
			can = true;
			steps = Math.min(steps, step(x_1_steps, y_1_steps));
		}
		if(done(x_1, y_m, x_1_steps, y_m_steps)){
			can = true;
			steps = Math.min(steps, step(x_1_steps, y_m_steps));

		}
		if(done(x_n, y_1, x_n_steps, y_1_steps)){
			can = true;
			steps = Math.min(steps, step(x_n_steps, y_1_steps));

		}
		if(done(x_n, y_m, x_n_steps, y_m_steps)){
			can = true;
			steps = Math.min(steps, step(x_n_steps, y_m_steps));
		}

		if(can){
			System.out.println(steps);
			return;
		}
		System.out.println("Poor Inna and pony!");

	}

	public boolean x_1_1(int n, int m, int i, int j, int a, int b){
		if((i-a>0) || (i+a <=n)){
			return (i - 1) % ( a) == 0;
		}
		return false;
	}

	public boolean x_n_1(int n, int m, int i, int j, int a, int b){
		if((i-a>0) || (i+a <=n)){

			return (n-i) % ( a) == 0;
		}

		return false;
	}

	public boolean y_1_1(int n, int m, int i, int j, int a, int b){
		if(j==1) return true;
		if((j-b>0) || (j+b <=m)){
			return (j - 1) % ( b) == 0;
		}
		return false;
	}

	public boolean y_m_1(int n, int m, int i, int j, int a, int b){
		if((j-b>0) || (j+b <=m)){
			return (m-j) % ( b) == 0;
		}
		return false;
	}

	public boolean x_1_2(int n, int m, int i, int j, int a, int b){
		if((i-a>0) || (i+a <=n)){
			return (i - 1) % ( 2*a) == 0;
		}
		return false;
	}

	public boolean x_n_2(int n, int m, int i, int j, int a, int b){
		if((i-a>0) || (i+a <=n)){
			return (n-i) % ( 2*a) == 0;
		}
		return false;
	}

	public boolean y_1_2(int n, int m, int i, int j, int a, int b){
		if((j-b>0) || (j+b <=m)){
			return (j - 1) % ( 2*b) == 0;
		}
		return false;
	}

	public boolean y_m_2(int n, int m, int i, int j, int a, int b){
		if((j-b>0) || (j+b <=m)){
			return (m-j) % ( 2*b) == 0;
		}
		return false;
	}
}

import java.io.InputStreamReader;
import java.util.Scanner;

import static java.lang.Math.abs;
import static java.lang.Math.max;
import static java.lang.Math.min;

public class Main {

    public static final String POOR_INNA_AND_PONY = "Poor Inna and pony!";

    public static void main(String[] args) {
        Scanner sc = new Scanner( new InputStreamReader(System.in));
        String line = sc.nextLine();
        sc.close();
        sc = new Scanner(line);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int i = sc.nextInt();
        int j = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();
        if ((i == 1 || i == n) && (j == 1 || j == m)) {
            System.out.println("0");
            return;
        }

        if (((i-1) < a) && (n-i) < a) {
            System.out.println(POOR_INNA_AND_PONY);
            return;
        }

        if (((j-1) < a) && (m-j) < a) {
            System.out.println(POOR_INNA_AND_PONY);
            return;
        }

        int iDiff = 1-i;
        int jDiff = 1-j;
        int steps = -1;
        if ((iDiff % a == 0)&&(jDiff % b == 0)) {
            int iQuant = abs(iDiff / a);
            int jQuant = abs(jDiff / b);
            if ((iQuant % 2) == (jQuant % 2)) {
                int max = max(iQuant, jQuant);
                if (steps == -1) {
                    steps = max;
                }
            }
        }

        iDiff = n-i;
        jDiff = 1-j;
        if ((iDiff % a == 0)&&(jDiff % b == 0)) {
            int iQuant = abs(iDiff / a);
            int jQuant = abs(jDiff / b);
            if ((iQuant % 2) == (jQuant % 2)) {
                int max = max(iQuant, jQuant);
                if (steps == -1) {
                    steps = max;
                }
                steps = min(max, steps);
            }
        }

        iDiff = 1-i;
        jDiff = m-j;
        if ((iDiff % a == 0)&&(jDiff % b == 0)) {
            int iQuant = abs(iDiff / a);
            int jQuant = abs(jDiff / b);
            if ((iQuant % 2) == (jQuant % 2)) {
                int max = max(iQuant, jQuant);
                if (steps == -1) {
                    steps = max;
                }
                steps = min(max, steps);
            }
        }

        iDiff = n-i;
        jDiff = m-j;
        if ((iDiff % a == 0)&&(jDiff % b == 0)) {
            int iQuant = abs(iDiff / a);
            int jQuant = abs(jDiff / b);
            if ((iQuant % 2) == (jQuant % 2)) {
                int max = max(iQuant, jQuant);
                if (steps == -1) {
                    steps = max;
                }
                steps = min(max, steps);
            }
        }

        if (steps!=-1) {
            System.out.println(steps);
        } else {
            System.out.println(POOR_INNA_AND_PONY);
        }

    }
}

import java.util.Scanner;
public class CF2{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int i = sc.nextInt();
		int j = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int min = Integer.MAX_VALUE;
		//points are (1,1),(n,1),(1,m),(n,m)
		//both odd or even
		//completely divisible
		int[] x = new int[]{1,n,1,n};
		int[] y = new int[]{1,1,m,m};
		for(int k = 0; k < 4; k++){
		    int p = Math.abs(x[i]-i);
		    int q = Math.abs(y[i]-j);
		    if((p%a==0 && q%b==0)&&(((p/a)%2==0 && (q/b)%2==0)||((p/a)%2==1 && (q/b)%2==1))){
		        int ans = Math.max(p/a,q/b);
		        if(ans<min){
		            min = ans;
		        }
		    }
		}
		if(min==Integer.MAX_VALUE){
		    System.out.println("Poor Inna and pony!");
		}
		else{
		    System.out.println(min);
		}
	}
}

// package CF;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class A {
	static int INF = (int)1e8;
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt(), m = sc.nextInt(), i = sc.nextInt(), j = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt();
		int [] dx = {1, n, n, 1};
		int [] dy = {m, 1, m, 1};
		int min = INF;
		for (int k = 0; k < dy.length; k++) {
			if((i-dx[k]) % a == 0 && (j-dy[k]) % b == 0){
				int dfx = Math.abs(i-dx[k]) / a, dfy = Math.abs(j-dy[k]) / b;
				if(dfx % 2 == dfy % 2)
				min = Math.min(min, Math.max(dfx, dfy));
			}
		}
		out.println(min == INF || (n-i < a && i-1 < a) || (m-j < b && j-1 < b)?"Poor Inna and pony!":min);
		out.flush();
		out.close();
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(FileReader fileReader) {
			br = new BufferedReader(fileReader);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}
}

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForce18a {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int i = scan.nextInt();
        int j = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();

        double min = Double.MAX_VALUE;

        int currr = i, currc = j;
        int moves = 0;
        while (currr > 1 & currc > 1) {
            currr = currr - a;
            currc = currc - b;
            moves++;
        }

        if (currr == 1 && currc == 1) {
           min= Math.min(min,moves);
        }

        currr = i;
        currc = j;
        moves = 0;
        while (currr < n & currc < m) {
            currr = currr + a;
            currc = currc + b;
            moves++;
        }

        if (currr == n && currc == m) {
           min= Math.min(min,moves);
        }

        currr = i;
        currc = j;
        moves = 0;
        while (currr >1  & currc < m) {
            currr = currr - a;
            currc = currc + b;
            moves++;
        }

        if (currr == n && currc == m) {
           min= Math.min(min,moves);
        }

        currr = i;
        currc = j;
        moves = 0;
        while (currr >n  & currc < 1) {
            currr = currr + a;
            currc = currc - b;
            moves++;
        }

        if (currr == n && currc == m) {
           min= Math.min(min,moves);
        }

        if (min != Double.MIN_VALUE && min == (int) min) {
            System.out.println((int) min);
        } else {
            System.out.println("Poor Inna and pony!");
        }

    }
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.StringTokenizer;

public class a {

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder q = new StringBuilder();
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));

		String y[] = in.readLine().split(" ");
		int n = Integer.parseInt(y[0]);
		int m = Integer.parseInt(y[1]);
		int i = Integer.parseInt(y[2]);
		int j = Integer.parseInt(y[3]);
		int a = Integer.parseInt(y[4]);
		int b = Integer.parseInt(y[5]);
		int x1[] = { 1, 1, n, n };
		int y1[] = { 1, m, 1, m };
		int k;
		int min = Integer.MAX_VALUE;
		for (k = 0; k < 4; k++) {
			int one = Math.abs(x1[k] - i);
			int two = Math.abs(y1[k] - j);
			if (one % a == 0 && two % b == 0
					&& ((one / a) + (two / b)) % 2 == 0) {
				int kk = (int) Math.max(one / a, two / b);
				if (kk < min)
					min = kk;

			}
		}

		if (min == Integer.MAX_VALUE||(i+a>n&&i-a<1)||(j+b>m&&j-b<1))
			System.out.println("Poor Inna and pony!");
		else {

			System.out.println(min);
		}
		out.close();

	}
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class TA {

	public void solve(int n, int m, int i, int j, int a, int b) {
		int[][] corner = new int[][] {{1, m}, {n, 1}, {n, m}, {1, 1}};
		long ans = n + m;
		for (int k = 0; k < 4; k ++) {
			if (Math.abs(i - corner[k][0]) % a == 0 && Math.abs(j - corner[k][1]) % b == 0) {
				int p = Math.abs(i - corner[k][0]) / a;
				int q = Math.abs(j - corner[k][1]) / b;

				if (Math.abs(p - q) % 2 == 0)
					ans = Math.min(ans, Math.max(p, q));
			}
		}

		if (ans == n + m)
			System.out.println("Poor Inna and pony!");
		else
			System.out.println(ans);
	}

	public static void main(String[] args) {
		FastScanner in = new FastScanner();

		new TA().solve(in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt());

	}

	static class FastScanner {

		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}

	}

}

import java.util.*;
import java.io.*;

public class Main374A
{
  static PrintWriter out=new PrintWriter(System.out);

  public static void main(String[] args) throws IOException
  {
    Scanner sc=new Scanner(System.in);
    int f=100000000;
    int n=sc.nextInt();
    int m=sc.nextInt();
    int x=sc.nextInt();
    int y=sc.nextInt();
    int a=sc.nextInt();
    int b=sc.nextInt();
    boolean h=false;
    boolean v=false;
    if(x-a>=1||(n-a)>=x)
      h=true;
    if((y-a)>=1||(m-b)>=y)
      v=true;

    boolean flag=false;
    int val1=f,val2=f,val3=f,val4=f;
    if((x==1&&y==1)||(x==1&&y==m)||(x==n)&&(y==1)||x==n&&y==m)
    {
      out.println(0);
    }
    else{
    if((x-1)%a==0&&(y-1)%b==0&&((x-1)/a+(y-1)/b)%2==0)
    {
      val1=Math.max((x-1)/a,(y-1)/b);
      flag=true;
    }
    if((x-1)%a==0&&(m-y)%b==0&&((x-1)/a+(m-y)/b)%2==0)
    {
      val2=Math.max((x-1)/a,(m-y)/b);
      flag=true;
    }
    if((n-x)%a==0&&(y-1)%b==0&&((n-x)/a+(y-1)/b)%2==0)
    {
      val3=Math.max((n-x)/a,(y-1)/b);
      flag=true;
    }
    if((n-x)%a==0&&(m-y)%b==0&&((n-x)/a+(m-y)/b)%2==0)
    {
      val4=Math.max((n-x)/a,(m-y)/b);
      flag=true;
    }
    if(!flag||!h||!v)
      out.println("Poor Inna and pony!");
    else
      out.println(Math.min(val1,Math.min(val2,Math.min(val3,val4))));
    }
    out.flush();

  }
  static class Scanner
  {
    BufferedReader br;
    StringTokenizer tk=new StringTokenizer("");
    public Scanner(InputStream is)
        {
      br=new BufferedReader(new InputStreamReader(is));
    }
        public int nextInt() throws IOException
        {
          if(tk.hasMoreTokens())
                return Integer.parseInt(tk.nextToken());
          tk=new StringTokenizer(br.readLine());
          return nextInt();
        }
        public long nextLong() throws IOException
        {
            if(tk.hasMoreTokens())
              return Long.parseLong(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextLong();
        }
        public String next() throws IOException
        {
          if(tk.hasMoreTokens())
            return (tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return next();
        }
        public String nextLine() throws IOException
        {
          tk=new StringTokenizer("");
          return br.readLine();
        }
        public double nextDouble() throws IOException
        {
            if(tk.hasMoreTokens())
              return Double.parseDouble(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextDouble();
        }
        public char nextChar() throws IOException
        {
            if(tk.hasMoreTokens())
              return (tk.nextToken().charAt(0));
            tk=new StringTokenizer(br.readLine());
            return nextChar();
        }
        public int[] nextIntArray(int n) throws IOException
        {
            int a[]=new int[n];
            for(int i=0;i<n;i++)
              a[i]=nextInt();
            return a;
        }
        public long[] nextLongArray(int n) throws IOException
        {
          long a[]=new long[n];
            for(int i=0;i<n;i++)
              a[i]=nextLong();
            return a;
        }
        public int[] nextIntArrayOneBased(int n) throws IOException
        {
          int a[]=new int[n+1];
            for(int i=1;i<=n;i++)
              a[i]=nextInt();
            return a;
        }
        public long[] nextLongArrayOneBased(int n) throws IOException
        {
          long a[]=new long[n+1];
          for(int i=1;i<=n;i++)
                a[i]=nextLong();
          return a;
        }
  }
}

/**
 * Created with IntelliJ IDEA.
 * User: igar
 * Date: 14.12.13
 * Time: 16:15
 * To change this template use File | Settings | File Templates.
 */
import sun.nio.cs.ext.MacHebrew;

import java.math.BigInteger;
import java.util.Scanner;

public class CF220_A {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int i = scanner.nextInt();
        int j = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();

        // solve
        int x0 = (i - 1);
        int y0 = (j - 1);
        int x1 = (n - i);
        int y1 = (m - j);

        if (x0 == 0 && y0 == 0 || x0 == 0 && y1 == 0 || x1 == 0 && y0 == 0 || x1 == 0 && y1 == 0) {
            System.out.println(0);
            return;
        }
        int min = -1;
        if (canMove(x0, y0, a, b))
            min = Math.max(x0/a, y0/b);
        if (canMove(x0, y1, a, b))
            min = min > 0 ? Math.min(Math.max(x0/a, y1/b), min) : Math.max(x0/a, y1/b);
        if (canMove(x1, y0, a, b))
            min = min > 0 ? Math.min(Math.max(x1/a, y0/b), min) : Math.max(x1/a, y0/b);
        if (canMove(x1, y1, a, b))
            min = min > 0 ? Math.min(Math.max(x1/a, y1/b), min) : Math.max(x1/a, y1/b);

        if (min > 0)
            System.out.println(min);
        else
            System.out.println("Poor Inna and pony!");

    }

    static boolean canMove(int x, int y, int a, int b) {
        return x % a == 0 && y % b == 0 && (x/a + y/b)%2 == 0;
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class A374 {
    public static void main(String[] args)throws Exception{
        // TODO Auto-generated method stub
        new A374().run();
    }

    int n,m,i,j,a,b;

    int getMin(int toX, int toY){
        if((toX-i)%a==0 && (toY-j)%b==0){
            int x=(toX-i)/a;
            int y=(toY-j)/b;
            if((x&1)!=(y&1)) return Integer.MAX_VALUE;
            //System.out.println(toX+";"+toY+" res: "+x+":"+y);
            return Math.max(x, y);
        }
        else return Integer.MAX_VALUE;
    }

    void run() throws Exception{
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

        String s=reader.readLine();

        String[] ss=s.split(" ");
        n=Integer.parseInt(ss[0]);
        m=Integer.parseInt(ss[1]);
        i=Integer.parseInt(ss[2]);
        j=Integer.parseInt(ss[3]);
        a=Integer.parseInt(ss[4]);
        b=Integer.parseInt(ss[5]);

        int res=Math.min(Math.min(getMin(1,1), getMin(1,m)), Math.min(getMin(n,1), getMin(n,m)));

        if(res==Integer.MAX_VALUE)
            System.out.println("Poor Inna and pony!");
        else
            System.out.println(res);

        System.out.flush();
        reader.close();
    }
}

/**
 * Created with IntelliJ IDEA.
 * User: igar
 * Date: 14.12.13
 * Time: 16:15
 * To change this template use File | Settings | File Templates.
 */
import sun.nio.cs.ext.MacHebrew;

import java.math.BigInteger;
import java.util.Scanner;

public class CF220_A {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int i = scanner.nextInt();
        int j = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();

        // solve
        int x0 = (i - 1);
        int y0 = (j - 1);
        int x1 = (n - i);
        int y1 = (m - j);

        int min = -1;
        if (canMove(x0, y0, a, b))
            min = Math.max(x0/a, y0/b);
        if (canMove(x0, y1, a, b))
            min = min > 0 ? Math.min(Math.max(x0/a, y1/b), min) : Math.max(x0/a, y1/b);
        if (canMove(x1, y0, a, b))
            min = min > 0 ? Math.min(Math.max(x1/a, y0/b), min) : Math.max(x1/a, y0/b);
        if (canMove(x1, y1, a, b))
            min = min > 0 ? Math.min(Math.max(x1/a, y1/b), min) : Math.max(x1/a, y1/b);

        if (min > 0)
            System.out.println(min);
        else
            System.out.println("Poor Inna and pony!");

    }

    static boolean canMove(int x, int y, int a, int b) {
        return x % a == 0 && y % b == 0 && (x/a + y/b)%2 == 0;
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class InnaPinkPony {

    private static int INF = 1000000;

    public static void main(String[] args) {
        int n, m, i, j, a, b;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line = br.readLine();
            String[] params = line.split(" ");
            n = Integer.parseInt(params[0]);
            m = Integer.parseInt(params[1]);
            i = Integer.parseInt(params[2]);
            j = Integer.parseInt(params[3]);
            a = Integer.parseInt(params[4]);
            b = Integer.parseInt(params[5]);

            int[][] corners = new int[][] { { 1, m }, { n, 1 }, { n, m },
                    { 1, 1 } };

            int min = INF;
            for (int[] cor : corners) {
                int xdiff = cor[0] - i;
                int ydiff = cor[1] - j;

                if (xdiff % a != 0 || ydiff % b != 0) {
                    continue;
                }
                int xmoves = Math.abs(xdiff) / a;
                int ymoves = Math.abs(ydiff) / b;
                if (xmoves % 2 == ymoves % 2) {
                    min = Math.min(min, Math.max(xmoves, ymoves));
                }
            }
            if (i != n && j != m
                    && ((i - a < 1 && i + a > n) || (j - b < 1 && j + b > m))) {
                min = INF;
            }
            if (min == INF) {
                System.out.print("Poor Inna and pony!");
            } else {
                System.out.print(min);
            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
}

/**
 * Created with IntelliJ IDEA.
 * User: igar
 * Date: 14.12.13
 * Time: 16:15
 * To change this template use File | Settings | File Templates.
 */
import sun.nio.cs.ext.MacHebrew;

import java.math.BigInteger;
import java.util.Scanner;

public class CF220_A {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int i = scanner.nextInt();
        int j = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();

        // solve
        int x0 = (i - 1);
        int y0 = (j - 1);
        int x1 = (n - i);
        int y1 = (m - j);

        if (x0 == 0 && y0 == 0 || x0 == 0 && y1 == 0 || x1 == 0 && y0 == 0 || x1 == 0 && y1 == 1) {
            System.out.println(0);
            return;
        }
        int min = -1;
        if (canMove(x0, y0, a, b))
            min = Math.max(x0/a, y0/b);
        if (canMove(x0, y1, a, b))
            min = min > 0 ? Math.min(Math.max(x0/a, y1/b), min) : Math.max(x0/a, y1/b);
        if (canMove(x1, y0, a, b))
            min = min > 0 ? Math.min(Math.max(x1/a, y0/b), min) : Math.max(x1/a, y0/b);
        if (canMove(x1, y1, a, b))
            min = min > 0 ? Math.min(Math.max(x1/a, y1/b), min) : Math.max(x1/a, y1/b);

        if (min > 0)
            System.out.println(min);
        else
            System.out.println("Poor Inna and pony!");

    }

    static boolean canMove(int x, int y, int a, int b) {
        return x % a == 0 && y % b == 0 && (x/a + y/b)%2 == 0;
    }
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

//package codeforces;

import java.io.PrintWriter;
import java.util.Scanner;

/**
 *
 * @author huseyngasimov
 */
public class InnaAndNine {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        String s = in.next();
        int N = s.length();
        if (N < 3) {
            out.println(1);
        }
        else {
            int[] prev2 = new int[2];
            int[] prev = new int[2];
            prev2[0] = prev[0] = 1;
            if (sum(N-1, N-2, s) == 9) prev[1] = 1;

            int[] cur = new int[2];
            for (int i = N-3; i >= 0; i--) {
                if (sum(i, i+1, s) == 9) {
                    if (prev2[1] + 1 == prev[1]) {
                        cur[0] = 2 * prev2[0];
                        cur[1] = prev[1];
                    }
                    else {
                        cur[0] = prev2[0];
                        cur[1] = prev2[1] + 1;
                    }
                }
                else {
                    System.arraycopy(prev, 0, cur, 0, 2);
                }

                System.arraycopy(prev, 0, prev2, 0, 2);
                System.arraycopy(cur, 0, prev, 0, 2);
            }

            out.println(cur[0]);
        }

        out.flush();
    }

    private static int sum(int i, int j, String s) {
        return (int) s.charAt(i) + (int) s.charAt(j) - 2* (int)'0';
    }
}

import java.util.Scanner;

public class InnaAndPinkPony {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int i = sc.nextInt();
		int j = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		int x1 = (i-1)/a;
		int x2 = (n-i)/a;

		int y1 = (j-1)/b;
		int y2 = (m-j)/b;

		int ans = Integer.MAX_VALUE;

		if(x1%2==0 && y1%2==0){
			if(Math.max(x1, y1)<ans){
				ans = Math.max(x1, y1);
			}
		}
		else if(x1%2==0 && y2%2==0){
				if(Math.max(x1, y2)<ans){
					ans = Math.max(x1, y2);
				}
		}
		else if(x2%2==0 && y1%2==0){
			if(Math.max(x2, y1)<ans){
				ans = Math.max(x2, y1);
			}
		}
		else if(x2%2==0 && y2%2==0){
			if(Math.max(x2, y2)<ans){
				ans = Math.max(x2, y2);
			}
		}

		else if(x1%2==1 && y1%2==1){
			if(Math.max(x1, y1)<ans){
				ans = Math.max(x1, y1);
			}
		}
		else if(x1%2==1 && y2%2==1){
				if(Math.max(x1, y2)<ans){
					ans = Math.max(x1, y2);
				}
		}
		else if(x2%2==1 && y1%2==1){
			if(Math.max(x2, y1)<ans){
				ans = Math.max(x2, y1);
			}
		}
		else if(x2%2==1 && y2%2==1){
			if(Math.max(x2, y2)<ans){
				ans = Math.max(x2, y2);
			}
		}
		if(ans<Integer.MAX_VALUE)
			System.out.println(ans);
		else
			System.out.println("Poor Inna and pony!");
		sc.close();
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Comparator;

public class d {
    static BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
    public static void main(String[] args) throws IOException {
      StringBuilder sb=new StringBuilder();
      String[] st=s();
       int n=i(st[0]);
        int m=i(st[1]);
        int i=i(st[2]);
        int j=i(st[3]);
        int a=i(st[4]);
        int b=i(st[5]);
         int i1=i;int j1=j;long ans=Long.MAX_VALUE;
         if((n-i1)%a==0&&(m-j)%b==00){
             int x=Math.min((n-i)/a,(m-j)/b);
             i1+=a*x;j1+=b*x;
             if((m-j1)%b==0&&((m-j1)/b)%2==0&&((n-i1)%a==0&&(n-i1)/a%2==0)){
                 ans=Math.min(ans,x+Math.max(((m-j1)/b),(n-i1)/a));
             }
         }
         i1=i;j1=j;
         if((i1-1)%a==0&&(m-j1)%b==0){
             int x=Math.min((i1-1)/a,(m-j1)/b);
             i1-=a*x;j1+=b*x;
             if((m-j1)%b==0&&((m-j1)/b)%2==0&&((i1-1)%a==0&&(i1-1)/a%2==0)){
                 ans=Math.min(ans,x+Math.max(((m-j1)/b),(i1-1)/a));
             }
         }
        i1=i;j1=j;
        if((i1-1)%a==0&&(j1-1)%b==0){
            int x=Math.min((i1-1)/a,(j1-1)/b);
            i1-=a*x;j1-=b*x;
            if((j1-1)%b==0&&((j1-1)/b)%2==0&&((i1-1)%a==0&&(i1-1)/a%2==0)){
                ans=Math.min(ans,x+Math.max(((j1-1)/b),(i1-1)/a));
            }
        }
        i1=i;j1=j;
        if((n-i1)%a==0&&(j1-1)%b==0){
            int x=Math.min((n-i1)/a,(j1-1)/b);
            i1+=a*x;j1-=b*x;
            if((j1-1)%b==0&&((j1-1)/b)%2==0&&((n-i1)%a==0&&(n-i1)/a%2==0)){
                ans=Math.min(ans,x+Math.max(((j1-1)/b),(n-i1)/a));
            }
        }
        if(ans==Long.MAX_VALUE){
            System.out.println("Poor Inna and pony!");
        }else
        System.out.println(ans);

    }    static String[] s() throws IOException {
        return s.readLine().trim().split("\\s+");
    }
    static int i(String ss) {
        return Integer.parseInt(ss);
    }
    static long l(String ss) {
        return Long.parseLong(ss);
    }

}
class Student12 {
    int l;int r;
    public Student12(int l, int r) {
        this.l = l;
        this.r = r;
    }

    public String toString()
    {
        return this.l+" ";
    }
}
class Sortbyroll12 implements Comparator<Student12> {

    public int compare(Student12 a, Student12 b){
        return a.l-b.l;
        /*if(a.r<b.r) return 1;
        else if(a.r==b.r){
             return a.l-b.l;
            }
        return -1;*/  }
}

import java.util.Scanner;

public class Main {

    public static class point {
        long i,j;
        public point (long f,long l)
        {
            i=f;
            j=l;
        }
    }

public static void main (String []args) {

    Scanner s=new Scanner(System.in);
    long n=s.nextLong(),m=s.nextLong();
    point E[] = new point[4];
    E[0] = new point (1,1);
    E[1] = new point (1,m);
    E[2] = new point (n,1);
    E[3] = new point (n,m);
    long i=s.nextLong(),j=s.nextLong();
    long a=s.nextLong(),b=s.nextLong();

    long ans = Long.MAX_VALUE;
    for (int k=0;k<4;k++)
    {
        int val1 = (int) Math.abs(E[k].i-i);
        int val2 =(int) Math.abs(E[k].j-j);
         if (val1%a!=0 || val2%b!=0 || (val1/a+val2/b)%2!=0)
         {
             continue;
         }
         ans=Math.min(ans, Math.max(val1/a, val2/b));

    }

    if (ans==Long.MAX_VALUE)
    {
        System.out.println("Poor Inna and pony!");
    } else {
        System.out.println(ans);
    }

}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.Vector;

public class InnaandPinkPony {
    static boolean[][] visited;
    static Vector<Long> steps;

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] line = br.readLine().split(" ");
        long n = Long.parseLong(line[0]);
        long m = Long.parseLong(line[1]);
        long i = Long.parseLong(line[2]);
        long j = Long.parseLong(line[3]);
        long a = Long.parseLong(line[4]);
        long b = Long.parseLong(line[5]);
        // visited = new boolean[n][m];
        // steps = new Vector<Long>();
        // long count = 0;
        // check(n - 1, m - 1, --i, --j, a, b, count);
        // Collections.sort(steps);
        // System.out.prlongln(steps.size() == 0 ? "Poor Inna and pony!" : steps
        // .firstElement());
        long leftUpH = Math.abs((i - 1) / a);
        long leftUpV = Math.abs((j - 1) / b);
        long leftUp = -1;
        if (((i - 1) % a == 0) && ((j - 1) % b == 0)
                && Math.abs(leftUpH - leftUpV) % 2 == 0) {
            leftUp = Math.max(leftUpH, leftUpV);
        }
        long leftDownH = Math.abs((i - n) / a);
        long leftDownV = Math.abs((j - 1) / b);
        long leftDown = -1;
        if (((i - n) % a == 0) && ((j - 1) % b == 0)
                && Math.abs(leftDownH - leftDownV) % 2 == 0) {
            leftDown = Math.max(leftDownH, leftDownV);
        }
        long rightUpH = Math.abs((i - 1) / a);
        long rightUpV = Math.abs((j - m) / b);
        long rightUp = -1;
        if (((i - 1) % a == 0) && ((j - m) % b == 0)
                && Math.abs(rightUpH - rightUpV) % 2 == 0) {
            rightUp = Math.max(rightUpH, rightUpV);
        }
        long rightDownH = Math.abs((i - n) / a);
        long rightDownV = Math.abs((j - m) / b);
        long rightDown = -1;
        if (((i - n) % a == 0) && ((j - m) % b == 0)
                && Math.abs(rightDownH - rightDownV) % 2 == 0) {
            rightDown = Math.max(rightDownH, rightDownV);
        }
        if (leftDown == -1 && leftUp == -1 && rightDown == -1 && rightUp == -1)
            System.out.println("Poor Inna and pony!");
        else {
            leftDown = leftDown == -1 ? Long.MAX_VALUE : leftDown;
            leftUp = leftUp == -1 ? Long.MAX_VALUE : leftUp;
            rightUp = rightUp == -1 ? Long.MAX_VALUE : rightUp;
            rightDown = rightDown == -1 ? Long.MAX_VALUE : rightDown;
            System.out.println(Math.min(
                    Math.min(Math.min(leftDown, leftUp), rightDown), rightUp));
        }
    }

    // private static void check(int n, int m, int i, int j, int a, int b,
    // int count) {
    // if ((i == 0 && j == 0) || (i == 0 && j == m) || (i == n && j == 0)
    // || (i == n && j == m))
    // steps.add(count);
    // visited[i][j] = true;
    // if (i + a >= 0 && i + a <= n && j + b >= 0 && j + b <= m
    // && !visited[i + a][j + b])
    // check(n, m, i + a, j + b, a, b, ++count);
    // if (i + a >= 0 && i + a <= n && j - b >= 0 && j - b <= m
    // && !visited[i + a][j - b])
    // check(n, m, i + a, j - b, a, b, ++count);
    // if (i - a >= 0 && i - a <= n && j - b >= 0 && j - b <= m
    // && !visited[i - a][j - b])
    // check(n, m, i - a, j - b, a, b, ++count);
    // if (i - a >= 0 && i - a <= n && j + b >= 0 && j + b <= m
    // && !visited[i - a][j + b])
    // check(n, m, i - a, j + b, a, b, ++count);
    // }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        a374 solver = new a374();
        solver.solve(1, in, out);
        out.close();
    }

    static class a374 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int i = in.nextInt();
            int j = in.nextInt();
            int a = in.nextInt();
            int b = in.nextInt();
            int ans = Integer.MAX_VALUE;
            ans = Math.min(ans, dist(i, j, 1, 1, a, b));
            ans = Math.min(ans, dist(i, j, 1, m, a, b));
            ans = Math.min(ans, dist(i, j, n, 1, a, b));
            ans = Math.min(ans, dist(i, j, n, m, a, b));
            if (ans == Integer.MAX_VALUE) {
                out.println("Poor Inna and pony!");
            } else {
                out.println(ans);
            }
        }

        int dist(int y, int x, int yb, int xb, int yStep, int xStep) {
            int dx = xb - x;
            int dy = yb - y;
            if (dx % xStep != 0) return Integer.MAX_VALUE;
            if (dy % yStep != 0) return Integer.MAX_VALUE;
            if (Math.abs(dx / xStep) % 2 == Math.abs(dy / yStep) % 2) {
                return Math.max(Math.abs(dx / xStep), Math.abs(dy / yStep));
            }
            return Integer.MAX_VALUE;
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String next() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}
}

class Task {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        int x = in.nextInt() ;
        int y = in.nextInt() ;
        int ai = in.nextInt();
        int bi = in.nextInt();
        int min = Integer.MAX_VALUE;
        if((x-1) % ai == 0 && (y-1) % bi == 0){
            if(((x-1)/ai)%2 == ((y-1)/bi)%2 )
                min = Math.max((x-1)/ai,(y-1)/bi);
        }
        if((n-x) % ai == 0 && (y-1) % bi == 0){
            if(((n-x)/ai)%2 == ((y-1)/bi)%2)
                min = Math.max((n-x)/ai,(y-1)/bi);
        }
        if((x-1) % ai == 0 && (m-y) % bi == 0){
            if(((x-1)/ai) % 2 == ((m-y)/bi) % 2 )
                min = Math.max((x-1)/ai,(m-y)/bi);
        }
        if((n-x) % ai == 0 && (m-y) % bi == 0){
            if(((n-x)/ai) % 2 == ((m-y)/bi) % 2 )
                min = Math.max((n-x)/ai,(m-y)/bi);
        }
        String ans = min == Integer.MAX_VALUE?"Poor Inna and pony!":min+"";
        out.println(ans);
    }
}

class InputReader {
    private BufferedReader br;
    private StringTokenizer st;
    public InputReader(InputStream in) {
        br=new BufferedReader(new InputStreamReader(in));
        try {
            st=new StringTokenizer(br.readLine());
        } catch (IOException ignored) {

        }
    }

    public int nextInt(){
        return Integer.parseInt(st.nextToken());
    }

}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C220P1 {

    private static BufferedReader in;
    private static PrintWriter out;
    private static StringTokenizer input;

    public static void main(String[] args) throws IOException {
        // -------------------------------------------------------------------------
        // Initializing...
        new C220P1();
        // -------------------------------------------------------------------------
        // put your code here... :)
        int n = nextInt();
        int m = nextInt();

        int i = nextInt();
        int j = nextInt();

        int a = nextInt();
        int b = nextInt();

        int ret = 1 << 30;

        boolean cantmove = false;

        if ( i-a < 1 && n - a < i ) cantmove = true;
        if ( j-b < 1 && m - b < j ) cantmove = true;

        // first corner. (1,1)
        int lefta = i - 1;
        int leftb = j - 1;
        if (lefta % a == 0 && leftb % b == 0
                && Math.abs(lefta/a - leftb/b) % 2 == 0)
            ret = Math.min(ret, Math.max(lefta / a, leftb / b));

        // first corner. (n,1)
        lefta = n - i;
        leftb = j - 1;
        if (lefta % a == 0 && leftb % b == 0
                && Math.abs(lefta/a - leftb/b) % 2 == 0)
            ret = Math.min(ret, Math.max(lefta / a, leftb / b));

        // first corner. (1,m)
        lefta = i - 1;
        leftb = m - j;
        if (lefta % a == 0 && leftb % b == 0
                && Math.abs(lefta/a - leftb/b) % 2 == 0)
            ret = Math.min(ret, Math.max(lefta / a, leftb / b));

        // first corner. (n,m)
        lefta = n - i;
        leftb = m - j;
        if (lefta % a == 0 && leftb % b == 0
                && Math.abs(lefta/a - leftb/b) % 2 == 0)
            ret = Math.min(ret, Math.max(lefta / a, leftb / b));

        writeln((ret == (1<<30)|| cantmove?"Poor Inna and pony!":""+ret));
        // -------------------------------------------------------------------------
        // closing up
        end();
        // --------------------------------------------------------------------------

    }

    public C220P1() throws IOException {
        // Input Output for Console to be used for trying the test samples of
        // the problem
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        // -------------------------------------------------------------------------
        // Initalize Stringtokenizer input
        input = new StringTokenizer(in.readLine());
    }

    private static int nextInt() throws IOException {
        if (!input.hasMoreTokens())
            input = new StringTokenizer(in.readLine());
        return Integer.parseInt(input.nextToken());
    }

    private static long nextLong() throws IOException {
        if (!input.hasMoreTokens())
            input = new StringTokenizer(in.readLine());
        return Long.parseLong(input.nextToken());
    }

    private static double nextDouble() throws IOException {
        if (!input.hasMoreTokens())
            input = new StringTokenizer(in.readLine());
        return Double.parseDouble(input.nextToken());
    }

    private static String nextString() throws IOException {
        if (!input.hasMoreTokens())
            input = new StringTokenizer(in.readLine());
        return input.nextToken();
    }

    private static void write(String output) {
        out.write(output);
        out.flush();
    }

    private static void writeln(String output) {
        out.write(output + "\n");
        out.flush();
    }

    private static void end() throws IOException {
        in.close();
        out.close();
        System.exit(0);
    }

}

import java.util.*; //Scanner;
import java.io.PrintWriter; //PrintWriter

public class R220_Div2_A
{
	public static void main(String[] args) {
		Scanner      in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		solve(in, out);
		out.close();
		in.close();
	}

	public static void solve(Scanner in, PrintWriter out)
	{
		int n = in.nextInt();
		int m = in.nextInt();
		int x = in.nextInt();
		int y = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();

		int[] dx = new int[4];
		int[] dy = new int[4];
		dx[0] = x-1; dy[0] = y-1;
		dx[1] = n-x; dy[1] = y-1;
		dx[2] = x-1; dy[2] = m-y;
		dx[3] = n-x; dy[3] = m-y;

		int min = Integer.MAX_VALUE;
		int cnt1, cnt2, max;
		for (int i = 0; i < 4; i++)
		{
			if ((dx[i] % a > 0) || (dy[i] % b > 0)) continue;
			cnt1 = dx[i] / a;
			cnt2 = dy[i] / b;
			if (cnt1 > cnt2)
			{
				if (cnt1 % 2 == 1) dy[i] -= b;
				if (dy[i] % (2*b) == 0) min = Math.min(min, cnt1);
			}
			else //cnt2 >= cnt1
			{
				if (cnt2 % 2 == 1) dx[i] -= a;
				if (dx[i] % (2*a) == 0) min = Math.min(min, cnt2);
			}
		}
		if (min == Integer.MAX_VALUE)
			out.println("Poor Inna and pony!");
		else
			out.println(min);
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class A {

	//IO
	static BufferedReader f;
	static PrintWriter out;
	static StringTokenizer st;

	final public static void main( String[] args ) throws IOException {
		f = new BufferedReader( new InputStreamReader( System.in ) );
		out = new PrintWriter( System.out );
		solve();
		f.close();
		out.close();
		System.exit( 0 );
	}

	static int n;
	static int m;
	static int i;
	static int j;
	static int a;
	static int b;
	final public static void solve() throws IOException {
		n = nextInt();
		m = nextInt();
		i = nextInt();
		j = nextInt();
		a = nextInt();
		b = nextInt();

		int[] cornerX = { 1 , 1 , n , n };
		int[] cornerY = { 1 , m , 1 , m };
		int best = Integer.MAX_VALUE;
		for ( int idx = 0 ; idx < 4 ; idx++ ) {
			best = Math.min( best , numMoves( cornerX[ idx ], cornerY[ idx ] ) );
		}
		if ( best == Integer.MAX_VALUE ) {
			out.println( "Poor Inna and pony!" );
		} else {
			out.println( best );
		}
	}

	static int numMoves( int endX , int endY ) {
		int dX = endX - i;
		int dY = endY - j;
		int rtn = 0;

		if ( Math.abs( dX ) < Math.abs( dY ) ) {

			//pony needs to travel y distance extra
			int extraYDist = Math.abs( dY ) - Math.abs( dX );
			if ( extraYDist % b == 0 && (extraYDist / b) % 2 == 0 ) {
				if ( j+b <= n || j-b >= 1 ) {
					rtn += 2 * ( Math.abs( extraYDist ) / b );
				} else {
					return Integer.MAX_VALUE;
				}
			} else {
				return Integer.MAX_VALUE;
			}
			if ( Math.abs( dX ) % a == 0 ) {
				rtn += Math.abs( dX ) / a;
			} else {
				return Integer.MAX_VALUE;
			}
		} else {

			//pony needs to travel x distance extra
			int extraXDist = Math.abs( dX ) - Math.abs( dY );
			if ( extraXDist % a == 0 && (extraXDist / a) % 2 == 0 ) {
				if ( i+a <= m || i-a >= 1 ) {
					rtn += 2 * ( Math.abs( extraXDist ) / a );
				} else {
					return Integer.MAX_VALUE;
				}
			} else {
				return Integer.MAX_VALUE;
			}
			if ( Math.abs( dY ) % b == 0 ) {
				rtn += Math.abs( dY ) / b;
			} else {
				return Integer.MAX_VALUE;
			}
		}
		return rtn;

	}

	final public static String nextToken() throws IOException {
		while ( st == null || !st.hasMoreTokens() ) {
			st = new StringTokenizer( f.readLine() );
		}
		return st.nextToken();
	}

	final public static int nextInt() throws IOException {
		return Integer.parseInt( nextToken() );
	}

	final public static long nextLong() throws IOException {
		return Long.parseLong( nextToken() );
	}

	final public static double nextDouble() throws IOException {
		return Double.parseDouble( nextToken() );
	}

	final public static boolean nextBoolean() throws IOException {
		return Boolean.parseBoolean( nextToken() );
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Algorithm {

	public static void main(String args[]) throws Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Solution s = new Solution();
		s.solve(in, out);
		out.close();
	}
}

class Solution {

	public void solve(InputReader in, PrintWriter out) {
		int n = in.nextInt();
		int m = in.nextInt();
		int i = in.nextInt();
		int j = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();

		int min = m + 1;
		if (((i - 1) / a) % 2 == ((j - 1) / b) % 2 ) {
			if ((i - 1) % a == 0 && (j - 1) % b == 0)
			min = Math.min(min, Math.max((i - 1) / a, (j - 1) / b));
		}
		if (((i - 1) / a) % 2 == ((m - j) / b) % 2) {
			if ((i - 1) % a == 0 && (m - j) % b == 0)
			min = Math.min(min, Math.max((i - 1) / a,  (m - j) / b));
		}
		if (((n - i) / a) % 2 == ((j - 1) / b) % 2 ) {
			if ((n - i) % a == 0 && (j - 1) % b == 0)
			min = Math.min(min, Math.max((n - i) / a, (j - 1) / b));
		}
		if (((n - i) / a) % 2 == ((m - j) / b) % 2) {
			if ((n - i) % a == 0 && (m - j) % b == 0)
			min = Math.min(min, Math.max((n - i) / a,  (m - j) / b));
		}
		if (min < m + 1){
			if (min > 0 && ((a + i > n && i - a <1) || ((b + j > m && j - b <1)))){
				out.print("Poor Inna and pony!");
			}else{
			out.print(min);
			}
		}else{
			out.print("Poor Inna and pony!");
		}
	}
}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

}

import java.util.Scanner;
public class CF2{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int i = sc.nextInt();
		int j = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int min = Integer.MAX_VALUE;
		//points are (1,1),(n,1),(1,m),(n,m)
		//both odd or even
		//completely divisible
		int[] x = new int[]{1,n,1,n};
		int[] y = new int[]{1,1,m,m};
		for(int k = 0; k < 4; k++){
		    int p = Math.abs(x[i]-i);
		    int q = Math.abs(y[i]-j);
		    if((p%a==0 && q%b==0)&&(((p/a)%2==0 && (q/b)%2==0)||((p/a)%2==1 && (q/b)%2==1))){
		        int ans = Math.max(p/a,q/b);
		        if(ans<min){
		            min = ans;
		        }
		    }
		}
		System.out.println(min);
	}
}

import java.util.*;
import java.io.*;

public class Main implements Runnable {

        int N, M, i, j, a, b;
        int answer = Integer.MAX_VALUE;
	public void solve() throws IOException {
                N = nextInt();
                M = nextInt();
                i = nextInt();
                j = nextInt();
                a = nextInt();
                b = nextInt();

                ok(1,1);
                ok(1, N);
                ok(M, 1);
                ok(N, M);

                if(answer != Integer.MAX_VALUE) out.println(answer);
                else out.println("Poor Inna and pony!");

	}

        private void ok(int endi, int endj){
                int first = Math.abs(endi - i);
                int second = Math.abs(endj - j);
                if(first % a != 0 || second % b != 0) return;
                if((first/a) % 2 != (second/b) % 2) return;

                answer = Math.min(answer, Math.max(first/a, second/b));

        }

	//-----------------------------------------------------------
	public static void main(String[] args) {
		new Main().run();
	}

        public void debug(Object... arr){
            System.out.println(Arrays.deepToString(arr));
        }

        public void print1Int(int[] a){
                for(int i = 0; i < a.length; i++)
                        System.out.print(a[i] + " ");
                System.out.println();
        }

        public void print2Int(int[][] a){
                for(int i = 0; i < a.length; i++){
                        for(int j = 0; j < a[0].length; j++){
                                System.out.print(a[i][j] + " ");
                        }
                        System.out.println();
                }
        }

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
                        out = new PrintWriter(System.out);
			tok = null;
			solve();
			in.close();
                        out.close();
		} catch (IOException e) {
			System.exit(0);
		}
	}

	public String nextToken() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
        PrintWriter out;
	BufferedReader in;
	StringTokenizer tok;
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        Solve s = new Solve();
    }

}

class Solve {
   StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

    public Solve() throws IOException {
        solve();
    }

    void solve() throws IOException {
        int n, m, i, j, a, b;

        n = NI();
        m = NI();
        i = NI() - 1;
        j = NI() - 1;
        a  = NI();
        b = NI();

        Coord corns[] = {new Coord(0, 0), new Coord(0, m), new Coord(n, 0), new Coord(n, m)};
        for (int k = 0; k < 4; k++) {
             corns[k].dist = abs(corns[k].i - i) + abs(corns[k].j - j);
        }

        Arrays.sort(corns, new Comparator<Coord>() {
            @Override
            public int compare(Coord lhs, Coord rhs) {
                return lhs.dist - rhs.dist;
            }
        });

        for (int k = 0; k < 4; k++) {
            if (abs(corns[k].i - i) / a == abs(corns[k].j - j) / b) {
                System.out.println(abs(corns[k].j - j) / b);
                return;
            }
        }
        System.out.println("Poor Inna and pony!");
    }

    long min(long i1, long i2) {
        return i1 < i2 ? i1 : i2;
    }

    long max(long i1, long i2) {
        return i1 > i2 ? i1 : i2;
    }

    int NI() throws IOException {
        in.nextToken();
        return (int)in.nval;
    }

    int abs(int x) {
        return x < 0 ? -x : x;
    }
}

class Coord {
    int i, j, dist;
    public Coord(int a, int b) {
        i = a;
        j = b;
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class InnaAndPinkPony {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] line = br.readLine().split(" ");
        long n = Long.parseLong(line[0]);
        long m = Long.parseLong(line[1]);
        long i = Long.parseLong(line[2]);
        long j = Long.parseLong(line[3]);
        long a = Long.parseLong(line[4]);
        long b = Long.parseLong(line[5]);

        long leftUpH = Math.abs((i - 1) / a);
        long leftUpV = Math.abs((j - 1) / b);
        long leftUp = -1;
        if (((i - 1) % a == 0) && ((j - 1) % b == 0)
                && Math.abs(leftUpH - leftUpV) % 2 == 0) {
            leftUp = (leftUpH != 0 && leftUpV != 0 ? Math.max(leftUpH, leftUpV)
                    : -1);
        }
        long leftDownH = Math.abs((i - n) / a);
        long leftDownV = Math.abs((j - 1) / b);
        long leftDown = -1;
        if (((i - n) % a == 0) && ((j - 1) % b == 0)
                && Math.abs(leftDownH - leftDownV) % 2 == 0) {
            leftDown = (leftDownH != 0 && leftDownV != 0 ? Math.max(leftDownH,
                    leftDownV) : -1);
        }
        long rightUpH = Math.abs((i - 1) / a);
        long rightUpV = Math.abs((j - m) / b);
        long rightUp = -1;
        if (((i - 1) % a == 0) && ((j - m) % b == 0)
                && Math.abs(rightUpH - rightUpV) % 2 == 0) {
            rightUp = (rightUpH != 0 && rightUpV != 0 ? Math.max(rightUpH,
                    rightUpV) : -1);
        }
        long rightDownH = Math.abs((i - n) / a);
        long rightDownV = Math.abs((j - m) / b);
        long rightDown = -1;
        if (((i - n) % a == 0) && ((j - m) % b == 0)
                && Math.abs(rightDownH - rightDownV) % 2 == 0) {
            rightDown = (rightDownH != 0 && rightDownV != 0 ? Math.max(
                    rightDownH, rightDownV) : -1);
        }
        if (leftDown == -1 && leftUp == -1 && rightDown == -1 && rightUp == -1)
            System.out.println("Poor Inna and pony!");
        else {
            leftDown = leftDown == -1 ? Long.MAX_VALUE : leftDown;
            leftUp = leftUp == -1 ? Long.MAX_VALUE : leftUp;
            rightUp = rightUp == -1 ? Long.MAX_VALUE : rightUp;
            rightDown = rightDown == -1 ? Long.MAX_VALUE : rightDown;
            System.out.println(Math.min(
                    Math.min(Math.min(leftDown, leftUp), rightDown), rightUp));
        }
    }
}

import java.util.Scanner;

public class A {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		int i = in.nextInt();
		int j = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();
		int best = Integer.MAX_VALUE;
		if((i-1)%a == 0 && (j-1)%b == 0 && ((i-1)/a)%2 == ((j-1)/b)%2){
			best = Math.min(best, Math.max((i-1)/a, (j-1)/b));
		}
		if((i-1)%a == 0 && (m-j)%b == 0 && ((i-1)/a)%2 == ((m-j)/b)%2){
			best = Math.min(best, Math.max((i-1)/a, (m-j)/b));
		}
		if((n-i)%a == 0 && (j-1)%b == 0 && ((n-i)/a)%2 == ((j-1)/b)%2){
			best = Math.min(best, Math.max((n-i)/a, (j-1)/b));
		}
		if((n-i)%a == 0 && (m-j)%b == 0 && ((n-i)/a)%2 == ((m-j)/b)%2){
			best = Math.min(best, Math.max((n-i)/a, (m-j)/b));
		}
		if(best < Integer.MAX_VALUE) System.out.println(best);
		else System.out.println("Poor Inna and pony!");
	}

}

import java.util.*;
import java.io.*;
public class CF374A {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    void solve() throws IOException {
        int n = nextInt();
        int m = nextInt();
        int I = nextInt();
        int J = nextInt();
        int a = nextInt();
        int b = nextInt();
        int[] x = {1, n, 1, n};
        int[] y = {1, 1, m, m};
        String fail = "Poor Inna and pony!";
        int res = Integer.MAX_VALUE;
        for(int i = 0; I + i * 2 * a <= m; i++) {
            for(int j = 0; j < x.length; j++) {
                int tp = getNum(x[j], y[j], I + 2 * i * a, J, a, b);
                if(tp != Integer.MAX_VALUE) {
                    res = Math.min(res, tp + i);
                }
            }
        }
        for(int i = 0; I - i * 2 * a >= 0; i++) {
            for(int j = 0; j < x.length; j++) {
                int tp = getNum(x[j], y[j], I - 2 * i * a, J, a, b);
                if(tp != Integer.MAX_VALUE) {
                    res = Math.min(res, tp + i);
                }
            }
        }
        if(res == Integer.MAX_VALUE) {
            out(fail);
            return;
        }
        out(res);

    }
    public int getNum(int n, int m, int i, int j, int a, int b) {
        if((n - i) % a != 0)
            return Integer.MAX_VALUE;
        if((m - j) % b != 0)
            return Integer.MAX_VALUE;
        if((n - i) / a != (m - j) / b)
            return Integer.MAX_VALUE;
        return (n - i) / a;
    }

    private void outln(Object o) {
        System.out.println(o);
    }
    private void out(Object o) {
        System.out.print(o);
    }
    public CF374A() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new CF374A();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        a374 solver = new a374();
        solver.solve(1, in, out);
        out.close();
    }

    static class a374 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int i = in.nextInt();
            int j = in.nextInt();
            int a = in.nextInt();
            int b = in.nextInt();
            int ans = Integer.MAX_VALUE;
            ans = Math.min(ans, dist(i, j, 1, 1, b, a));
            ans = Math.min(ans, dist(i, j, 1, m, b, a));
            ans = Math.min(ans, dist(i, j, n, 1, b, a));
            ans = Math.min(ans, dist(i, j, n, m, b, a));
            if (ans == Integer.MAX_VALUE) {
                out.println("Poor Inna and pony!");
            } else {
                out.println(ans);
            }
        }

        int dist(int y, int x, int yb, int xb, int yStep, int xStep) {
            int dx = xb - x;
            int dy = yb - y;
            if (dx % xStep != 0) return Integer.MAX_VALUE;
            if (dy % yStep != 0) return Integer.MAX_VALUE;
            if ((dx / xStep) % 2 == (dy / yStep) % 2) return dx / xStep + dy / yStep;
            return Integer.MAX_VALUE;
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String next() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class CodeForce18a {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int i = scan.nextInt();
        int j = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();

        int min = Integer.MAX_VALUE;

        int currr = i, currc = j;
        int moves = 0;
        while (currr > 1 & currc > 1) {
            currr = currr - a;
            currc = currc - b;
            moves++;
        }

        if (currr == 1 && currc == 1) {
           min= Math.min(min,moves);
        }

        currr = i;
        currc = j;
        moves = 0;
        while (currr < n & currc < m) {
            currr = currr + a;
            currc = currc + b;
            moves++;
        }

        if (currr == n && currc == m) {
           min= Math.min(min,moves);
        }

        currr = i;
        currc = j;
        moves = 0;
        while (currr >1  & currc < m) {
            currr = currr - a;
            currc = currc + b;
            moves++;
        }

        if (currr == 1 && currc == m) {
           min= Math.min(min,moves);
        }

        currr = i;
        currc = j;
        moves = 0;
        while (currr >n  & currc < 1) {
            currr = currr + a;
            currc = currc - b;
            moves++;
        }

        if (currr == n && currc == 1) {
           min= Math.min(min,moves);
        }

        if (min != Integer.MAX_VALUE) {
            System.out.println(min);
        } else {
            System.out.println("Poor Inna and pony!");
        }

    }
}

import java.util.Scanner;

public class innaandPinky {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int i = sc.nextInt();
		int j = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans = Integer.MAX_VALUE;
		ans = Math.min(ans, sol(1, 1, i, j, a, b));
		ans = Math.min(ans, sol(1, m, i, j, a, b));
		ans = Math.min(ans, sol(n, 1, i, j, a, b));
		ans = Math.min(ans, sol(n, m, i, j, a, b));

		if (ans == Integer.MAX_VALUE || (i - a < 1 && i + a > n )|| (j - b < 1 && j + b > m) && ans != 0) {
			System.out.println("Poor Inna and pony!");
		} else {
			System.out.println(ans);
		}
	}

	private static int sol(int n, int m, int i, int j, int a, int b) {
		if (i == n && m == j)
			return 0;
		int x = Math.abs(n - i);
		int y = Math.abs(m - j);

		if (x % a == 0 && y % b == 0) {
			if ((x / a) % 2 == (y/b) % 2) {
				x = x / a;
				y = y / b;
				return Math.max(x, y);
			}
		}
		return Integer.MAX_VALUE;
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {

	public void solve(InputReader in, PrintWriter out) {
		int n=in.nextInt();
		int m=in.nextInt();
		int i=in.nextInt();
		int j=in.nextInt();
		int a=in.nextInt();
		int b=in.nextInt();

		int[][] pos=new int[][]{{1,m},{n,1},{n,m},{1,1}};

		int res=Integer.MAX_VALUE;
		for(int k=0;k<4;k++){
			int ta=pos[k][0]-i>0?pos[k][0]-i:i-pos[k][0];
			int tb=pos[k][1]-j>0?pos[k][1]-j:j-pos[k][1];

			if(ta%a!=0 || tb%b!=0)
				continue;

			ta/=a;
			tb/=b;

			if((ta-tb)%2!=0)
				continue;

			if(ta==0){
				if(j+b>m && j-b<1)
					continue;
			}

			if(tb==0){
				if(i+a>n && i-a<1)
					continue;
			}

			int t=ta>tb?ta:tb;
			if(res>t)
				res=t;
		}

		if(res==Integer.MAX_VALUE)
			out.println("Poor Inna and pony!");
		else
			out.println(res);
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

}

import java.io.*;
import java.util.*;

public class Template implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine(), " :");
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    int[] readIntArray(int size) throws IOException {
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = readInt();
        }
        return res;
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    <T> List<T>[] createGraphList(int size) {
        List<T>[] list = new List[size];
        for (int i = 0; i < size; i++) {
            list[i] = new ArrayList<>();
        }
        return list;
    }

    public static void main(String[] args) {
        new Template().run();
        // new Thread(null, new Template(), "", 1l * 200 * 1024 * 1024).start();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    long memoryTotal, memoryFree;

    void memory() {
        memoryFree = Runtime.getRuntime().freeMemory();
        System.err.println("Memory = " + ((memoryTotal - memoryFree) >> 10)
                + " KB");
    }

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            memoryTotal = Runtime.getRuntime().freeMemory();
            init();
            solve();
            out.close();
            if (System.getProperty("ONLINE_JUDGE") == null) {
                time();
                memory();
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    int check(int v, int h, int a, int b) {
        if (v % a == 0 && h % b == 0 && (v / a) % 2 == (h / b) % 2) {
            return Math.max(v / a, h / b);
        } else {
            return Integer.MAX_VALUE;
        }
    }

    void solve() throws IOException {
        int n = readInt();
        int m = readInt();
        int i = readInt();
        int j = readInt();
        int a = readInt();
        int b = readInt();

        int ans = Integer.MAX_VALUE;
        ans = Math.min(ans, check(i - 1, j - 1, a, b));
        ans = Math.min(ans, check(i - 1, m - j, a, b));
        ans = Math.min(ans, check(n - i, j - 1, a, b));
        ans = Math.min(ans, check(n - i, m - j, a, b));
        out.println(ans == Integer.MAX_VALUE ? "Poor Inna and pony!" : ans);

    }

}

import java.util.Scanner;

public class Main {

    public static class point {
        long i,j;
        public point (long f,long l)
        {
            i=f;
            j=l;
        }
    }

public static void main (String []args) {

    Scanner s=new Scanner(System.in);
    long n=s.nextLong(),m=s.nextLong();
    point E[] = new point[4];
    E[0] = new point (1,1);
    E[1] = new point (1,m);
    E[2] = new point (n,1);
    E[3] = new point (n,m);
    long i=s.nextLong(),j=s.nextLong();
    long a=s.nextLong(),b=s.nextLong();

    long ans = Long.MAX_VALUE;
    for (int k=0;k<4;k++)
    {
        int val1 = (int) Math.abs(E[k].i-i);
        int val2 =(int) Math.abs(E[k].j-j);
         if (val1%a!=0 || val2%b!=0 || (val1/a+val2/b)%2!=0)
         {
             continue;
         }
         ans=Math.min(ans, Math.max(val1/a, val2/b));

    }

    if (ans==Long.MAX_VALUE)
    {
        System.out.println("Poor Inna and pony!");
    } else {
        System.out.println(ans);
    }

}

}

/**
 * Created with IntelliJ IDEA.
 * User: igar
 * Date: 14.12.13
 * Time: 16:15
 * To change this template use File | Settings | File Templates.
 */
import sun.nio.cs.ext.MacHebrew;

import java.math.BigInteger;
import java.util.Scanner;

public class CF220_A {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int i = scanner.nextInt();
        int j = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();

        // solve
        int x0 = (i - 1);
        int y0 = (j - 1);
        int x1 = (n - i);
        int y1 = (m - j);

        int min = -1;
        if (canMove(x0, y0, a, b))
            min = Math.max(x0/a, y0/b);
        if (canMove(x0, y1, a, b))
            min = min > 0 ? Math.min(Math.max(x0/a, y1/b), min) : Math.max(x0/a, y1/b);
        if (canMove(x1, y0, a, b))
            min = min > 0 ? Math.min(Math.max(x1/a, y0/b), min) : Math.max(x1/a, y0/b);
        if (canMove(x1, y1, a, b))
            min = min > 0 ? Math.min(Math.max(x1/a, y1/b), min) : Math.max(x1/a, y1/b);

        if (min > 0)
            System.out.println(min);
        else
            System.out.println("Poor Inna and pony!");

    }

    static boolean canMove(int x, int y, int a, int b) {
        return x % a == 0 && y % b == 0 && (x/a + y/b)%2 == 0;
    }
}

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;

public class InnaAndPinkPony {

	private static final boolean DEBUG = true;

	public static void main(String[] args) {

		try {

			final InputReader in;
			final OutputWriter out;

			if (DEBUG) {

				final String fileIn = InnaAndPinkPony.class.getSimpleName().toLowerCase() + ".in";
				final String fileOut = InnaAndPinkPony.class.getSimpleName().toLowerCase() + ".out";

				in = new InputReader(new FileInputStream(fileIn));
				out = new OutputWriter(new FileWriter(fileOut));
			} else {

				in = new InputReader(System.in);
				out = new OutputWriter(new OutputStreamWriter(System.out));
			}

			new InnaAndPinkPony().solve(in, out);

			out.close();

		} catch (Exception ex) {

			ex.printStackTrace();
		}
	}

	private final void solve(final InputReader in, final OutputWriter out) throws Exception {

		final int n = in.nextInt();
		final int m = in.nextInt();
		final int i = in.nextInt() - 1;
		final int j = in.nextInt() - 1;
		final int a = in.nextInt();
		final int b = in.nextInt();

		final int result = Math.min(find(n, m, i, j, a, b),
				Math.min(find(n, m, n - i - 1, j, a, b), Math.min(find(n, m, i, m - j - 1, a, b), find(n, m, n - i - 1, m - j - 1, a, b))));

		if (result == Integer.MAX_VALUE) {
			out.writeln("Poor Inna and pony!");
		} else {
			out.writeln(result);
		}
	}

	private final int find(int n, int m, int i, int j, int a, int b) {

		if (i % a != 0 || j % b != 0) {
			return Integer.MAX_VALUE;
		}

		int cnt0 = Math.min(i / a, j / b);

		i -= cnt0 * a;
		j -= cnt0 * b;

		if (i != 0) {
			int t;

			t = i;
			i = j;
			j = t;

			t = a;
			a = b;
			b = t;

			t = n;
			n = m;
			m = t;
		}

		if (j > 0) {
			if (a > n || ((j / b) & 1) == 1) {
				return Integer.MAX_VALUE;
			}
			cnt0 += (j / b);
		}

		return cnt0;
	}

	private static final class InputReader {

		private static final byte ZERO = '0';
		private static final byte NINE = '9';

		private static final int BUFFER_SIZE = 1 << 17;

		private final BufferedInputStream in;

		private byte[] buffer = new byte[BUFFER_SIZE + 1];
		private int offset = buffer.length;

		private InputReader(final InputStream in) {

			this.in = (in instanceof BufferedInputStream) ? ((BufferedInputStream) in) : (new BufferedInputStream(in));
		}

		public int nextInt() throws Exception {

			int result = 0;

			int position = this.offset;

			while (position < BUFFER_SIZE && (buffer[position] < ZERO || buffer[position] > NINE)) {

				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return nextInt();
			}

			offset = position;

			while (position < BUFFER_SIZE && buffer[position] >= ZERO && buffer[position] <= NINE) {

				result = result * 10 + buffer[position] - ZERO;
				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return nextInt();
			}

			offset = position;

			return result;
		}

		public long nextLong() throws Exception {

			long result = 0;

			int position = this.offset;

			while (position < BUFFER_SIZE && (buffer[position] < ZERO || buffer[position] > NINE)) {

				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return nextLong();
			}

			offset = position;

			while (position < BUFFER_SIZE && buffer[position] >= ZERO && buffer[position] <= NINE) {

				result *= 10;
				result += buffer[position] - ZERO;
				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return nextLong();
			}

			offset = position;

			return result;
		}

		public String next() throws Exception {

			int position = this.offset;

			while (position < BUFFER_SIZE && Character.isWhitespace(buffer[position])) {

				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return next();
			}

			offset = position;

			while (position < BUFFER_SIZE && !Character.isWhitespace(buffer[position])) {
				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return next();
			}

			final String result = new String(buffer, offset, position - offset);
			offset = position;

			return result;
		}

	}

	private static final class OutputWriter {

		private static final String NEW_LINE = String.format("%n");

		private final Writer output;
		private final StringBuilder buffer = new StringBuilder(1 << 17);

		public OutputWriter(final Writer output) {

			this.output = output;
		}

		public void write(final int i) {

			buffer.append(i);
		}

		public void write(final String s) {

			buffer.append(s);
		}

		public void writeln(final String s) {

			buffer.append(s);
			buffer.append(NEW_LINE);
		}

		public void writeln(final long l) {

			buffer.append(l);
			buffer.append(NEW_LINE);
		}

		public void writeln(final int i) {

			buffer.append(i);
			buffer.append(NEW_LINE);
		}

		public void close() throws Exception {

			output.write(buffer.toString());
			output.flush();
			output.close();
		}
	}
}

//package cf220;

import java.util.*;
import java.io.*;

public class A {
	FastScanner in;
	PrintWriter out;

	public void solve() throws IOException {
		int n = in.nextInt();
		int m = in.nextInt();
		int i = in.nextInt();
		int j = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();
		ArrayList<Integer> h = new ArrayList<Integer>();
		ArrayList<Integer> v = new ArrayList<Integer>();
		if (((i - 1) % a) == 0 ) {
			h.add((i - 1) / a);
		}
		if (((n - i) % a) == 0 ) {
			h.add((n - i) / a);
		}
		if (((j - 1) % b) == 0 ) {
			v.add((j - 1) / b);
		}
		if (((n - i) % b) == 0 ) {
			v.add((m - j) / b);
		}
		boolean hasAns = false;
		int ans = 0;;
		for (Integer hh : h) {
			for (Integer gg : v) {
				if ((hh - gg) % 2 == 0) {
					hasAns = true;
					ans = Math.max(hh, gg);
				}
			}
		}

		if (!hasAns) {
			System.out.println("Poor Inna and pony!");
		} else {
			System.out.println(ans);
		}

	}

	public void run() {
		try {
			in = new FastScanner(System.in);
			out = new PrintWriter(System.out);

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return null;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	public static void main(String[] arg) {
		new A().run();
	}
}

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;

public class InnaAndPinkPony {

	private static final boolean DEBUG = false;

	public static void main(String[] args) {

		try {

			final InputReader in;
			final OutputWriter out;

			if (DEBUG) {

				final String fileIn = InnaAndPinkPony.class.getSimpleName().toLowerCase() + ".in";
				final String fileOut = InnaAndPinkPony.class.getSimpleName().toLowerCase() + ".out";

				in = new InputReader(new FileInputStream(fileIn));
				out = new OutputWriter(new FileWriter(fileOut));
			} else {

				in = new InputReader(System.in);
				out = new OutputWriter(new OutputStreamWriter(System.out));
			}

			new InnaAndPinkPony().solve(in, out);

			out.close();

		} catch (Exception ex) {

			ex.printStackTrace();
		}
	}

	private final void solve(final InputReader in, final OutputWriter out) throws Exception {

		final int n = in.nextInt();
		final int m = in.nextInt();
		final int i = in.nextInt() - 1;
		final int j = in.nextInt() - 1;
		final int a = in.nextInt();
		final int b = in.nextInt();

		final int result = Math.min(find(n, m, i, j, a, b),
				Math.min(find(n, m, n - i - 1, j, a, b), Math.min(find(n, m, i, m - j - 1, a, b), find(n, m, n - i - 1, m - j - 1, a, b))));

		if (result == Integer.MAX_VALUE) {
			out.writeln("Poor Inna and pony!");
		} else {
			out.writeln(result);
		}
	}

	private final int find(int n, int m, int i, int j, int a, int b) {

		if (i % a != 0 || j % b != 0) {
			return Integer.MAX_VALUE;
		}

		int cnt0 = Math.min(i / a, j / b);

		i -= cnt0 * a;
		j -= cnt0 * b;

		if (i != 0) {
			int t;

			t = i;
			i = j;
			j = t;

			t = a;
			a = b;
			b = t;

			t = n;
			n = m;
			m = t;
		}

		if (j > 0) {
			if (a > n || ((j / b) & 1) == 1) {
				return Integer.MAX_VALUE;
			}
			cnt0 += (j / b);
		}

		return cnt0;
	}

	private static final class InputReader {

		private static final byte ZERO = '0';
		private static final byte NINE = '9';

		private static final int BUFFER_SIZE = 1 << 17;

		private final BufferedInputStream in;

		private byte[] buffer = new byte[BUFFER_SIZE + 1];
		private int offset = buffer.length;

		private InputReader(final InputStream in) {

			this.in = (in instanceof BufferedInputStream) ? ((BufferedInputStream) in) : (new BufferedInputStream(in));
		}

		public int nextInt() throws Exception {

			int result = 0;

			int position = this.offset;

			while (position < BUFFER_SIZE && (buffer[position] < ZERO || buffer[position] > NINE)) {

				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return nextInt();
			}

			offset = position;

			while (position < BUFFER_SIZE && buffer[position] >= ZERO && buffer[position] <= NINE) {

				result = result * 10 + buffer[position] - ZERO;
				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return nextInt();
			}

			offset = position;

			return result;
		}

		public long nextLong() throws Exception {

			long result = 0;

			int position = this.offset;

			while (position < BUFFER_SIZE && (buffer[position] < ZERO || buffer[position] > NINE)) {

				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return nextLong();
			}

			offset = position;

			while (position < BUFFER_SIZE && buffer[position] >= ZERO && buffer[position] <= NINE) {

				result *= 10;
				result += buffer[position] - ZERO;
				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return nextLong();
			}

			offset = position;

			return result;
		}

		public String next() throws Exception {

			int position = this.offset;

			while (position < BUFFER_SIZE && Character.isWhitespace(buffer[position])) {

				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return next();
			}

			offset = position;

			while (position < BUFFER_SIZE && !Character.isWhitespace(buffer[position])) {
				++position;
			}

			if (position >= BUFFER_SIZE) {

				System.arraycopy(buffer, offset, buffer, 0, position - offset);
				final int bytesRead = in.read(buffer, position - offset, BUFFER_SIZE - position + offset);
				buffer[position - offset + (bytesRead == -1 ? 0 : bytesRead)] = 0;
				offset = 0;

				return next();
			}

			final String result = new String(buffer, offset, position - offset);
			offset = position;

			return result;
		}

	}

	private static final class OutputWriter {

		private static final String NEW_LINE = String.format("%n");

		private final Writer output;
		private final StringBuilder buffer = new StringBuilder(1 << 17);

		public OutputWriter(final Writer output) {

			this.output = output;
		}

		public void write(final int i) {

			buffer.append(i);
		}

		public void write(final String s) {

			buffer.append(s);
		}

		public void writeln(final String s) {

			buffer.append(s);
			buffer.append(NEW_LINE);
		}

		public void writeln(final long l) {

			buffer.append(l);
			buffer.append(NEW_LINE);
		}

		public void writeln(final int i) {

			buffer.append(i);
			buffer.append(NEW_LINE);
		}

		public void close() throws Exception {

			output.write(buffer.toString());
			output.flush();
			output.close();
		}
	}
}

import java.util.*;
import java.io.*;

public class A220 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int i = sc.nextInt();
        int j = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();

        int cnt1 = Integer.MAX_VALUE, cnt2 = Integer.MAX_VALUE, cnt3 = Integer.MAX_VALUE, cnt4 = Integer.MAX_VALUE;

        if((i==1 && j==1) || (i==n && j==1) || (i==1 && j==m) || (i==n && j==m)){
            out.println(0);
            out.flush();
            return;
        }

        if(i+a>n && i-a<0){
            out.println("Poor Inna and pony!");
            out.flush();
            return;
        }
        if(j+b>m && j-b<0){
            out.println("Poor Inna and pony!");
            out.flush();
            return;
        }

        int deltay = Math.abs(i - 1);
        int deltax = Math.abs(j - 1);
        if (deltax % b == 0 && deltay % a == 0) {
            int stepa = deltax / b;
            int stepb = deltay / a;
            if (Math.abs(stepa - stepb) % 2 == 0) {
                cnt1 = Math.max(stepa, stepb);
            }
        }

        deltax = Math.abs(m - j);
        deltay = Math.abs(n - i);
        if (deltax % b == 0 && deltay % a == 0) {
            int stepa = deltax / b;
            int stepb = deltay / a;
            if (Math.abs(stepa - stepb) % 2 == 0) {
                cnt2 = Math.max(stepa, stepb);
            }
        }

        deltax = Math.abs(j - 1);
        deltay = Math.abs(n - i);
        if (deltax % b == 0 && deltay % a == 0) {
            int stepa = deltax / b;
            int stepb = deltay / a;
            if (Math.abs(stepa - stepb) % 2 == 0) {
                cnt3 = Math.max(stepa, stepb);
            }
        }

        deltax = Math.abs(m - j);
        deltay = Math.abs(i - 1);
        if (deltax % b == 0 && deltay % a == 0) {
            int stepa = deltax / b;
            int stepb = deltay / a;
            if (Math.abs(stepa - stepb) % 2 == 0) {
                cnt4 = Math.max(stepa, stepb);
            }
        }

        int res = Math.min(cnt1, cnt2);
        res = Math.min(res, cnt3);
        res = Math.min(res, cnt4);

        if (res == Integer.MAX_VALUE) {
            out.println("Poor Inna and pony!");
            out.flush();
            return;
        }

        out.println(res);
        out.flush();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class A {
	BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

    int INF = Integer.MAX_VALUE/2;
    int STOP = 2000000;

    int N;
    int M;
    int I;
    int J;
    int A;
    int B;
	public void solve() throws IOException {
		N = nextInt();
		M = nextInt();
		I = nextInt();
		J = nextInt();
		A = nextInt();
		B = nextInt();

		int ans = INF;
		ans = Math.min(ans, go(1, 1));
		ans = Math.min(ans, go(1, M));
		ans = Math.min(ans, go(N, 1));
		ans = Math.min(ans, go(N, M));

		if (ans == INF) {
			out.println("Poor Inna and pony!");
		} else {
			out.println(ans);
		}
	}

	public int go(int targetX, int targetY) {
		int curX = I;
		int curY = J;
		int ans = 0;
		while (true) {
			if (curX == targetX && curY == targetY) return ans;

			if (curX + A > N) {
				curX -= A;
			} else if(curX - A < 1) {
				curX += A;
			} else {
				if (curX <= targetX) {
					curX += A;
				} else {
					curX -= A;
				}
			}

			if (curY + B > M) {
				curY -= B;
			} else if(curY - B < 1) {
				curY += B;
			} else {
				if (curY <= targetY) {
					curY += A;
				} else {
					curY -= A;
				}
			}

			ans++;
			if (ans == STOP) {
				return INF;
			}
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new A().run();
	}

	public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            out = new PrintWriter(System.out);
            solve();
            reader.close();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

}

import java.util.Collection;
import java.util.Scanner;

public class A
{

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int i = sc.nextInt();
        int j = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        int[] steps = new int[4];
        steps[0] = countSteps(1, 1, i, j, a, b);
        steps[1] = countSteps(1, m, i, j, a, b);
        steps[2] = countSteps(n, 1, i, j, a, b);
        steps[3] = countSteps(n, m, i, j, a, b);

        int res = -1;
        for(int c = 0; c < 4; c++)
        {
            if(steps[c] == -1) continue;
            if(res == - 1) res = steps[c];
            res = res > steps[c] ? steps[c] : res;
        }

        if(res == -1) System.out.print("Poor Inna and pony!");
        else System.out.print(res);

    }

    public static int countSteps(int x, int y, int i, int j, int a, int b)
    {
        int dx = Math.abs(x - i);
        int dy = Math.abs(y - j);

        if(dx % a != 0 || dy % b != 0) return -1;

        int kx = dx / a;
        int ky = dy / b;

        if(kx % 2 != ky % 2) return -1;

        return Math.max(kx, ky);
    }
}

import java.util.*;
public class a {
public static void main(String[] args)
{
    Scanner input = new Scanner(System.in);
    int n = input.nextInt(), m = input.nextInt(), i = input.nextInt()-1, j = input.nextInt()-1, a = input.nextInt(), b = input.nextInt();
    int[] rs = new int[]{0, n-1, n-1, 0};
    int[] cs = new int[]{m-1, 0, m-1, 0};
    int res = 987654321;
    for(int k = 0; k<4; k++)
    {
        int dr = Math.abs(rs[k] - i);
        int dc = Math.abs(cs[k] - j);
        if(dr%a != 0 || dc%b != 0) continue;
        dr /= a;
        dc /= b;
        if(Math.abs(dr-dc)%2 != 0) continue;
        dr = Math.abs(dr);
        dc = Math.abs(dc);
        //System.out.println(dr+" "+dc);
        res = Math.min(res, Math.max(dr, dc));
    }
    if((i+a >= n && i-a<0) || (j+b >= m && j-b < 0)) res = 987654321;
    System.out.println(res == 987654321 ? "Poor Inna and pony!" : res);
}

}

import static java.lang.Math.*;

public class A {

	private final static boolean autoflush = false;

	public A () {
		long N = sc.nextInt();
		long M = sc.nextInt();
		long i = sc.nextInt();
		long j = sc.nextInt();
		long a = sc.nextInt();
		long b = sc.nextInt();

		--i; --j;
		String NO = "Poor Inna and pony!";

		long res;

		if ((res = solve(N, M, i, j, a, b)) != -1)
			exit(res);
		if ((res = solve(N, M, N-1-i, j, a, b)) != -1)
			exit(res);
		if ((res = solve(N, M, i, M-1-j, a, b)) != -1)
			exit(res);
		if ((res = solve(N, M, N-1-i, M-1-j, a, b)) != -1)
			exit(res);

		exit(NO);
	}

	long solve(long N, long M, long i, long j, long a, long b) {
		if (i == 0 && j == 0)
			return 0;

		if (i == 0)
			if (a < N && j % (2*b) == 0) return j/b;
			else return -1;

		if (j == 0)
			if (b < M && i % (2*a) == 0) return i/a;
			else return -1;

		if (i%a != 0 && j%b != 0)
			return -1;

		long p = i/a, q = j/b;
		if ((p-q)%2 != 0)
			return -1;

		return max(p, q);
	}

	////////////////////////////////////////////////////////////////////////////////////
	private final static MyScanner sc = new MyScanner();
	private static class MyScanner {
		public String next() { newLine(); return line[index++]; }
		public int nextInt() { return Integer.parseInt(next()); }
		//////////////////////////////////////////////
		private boolean eol() { return index == line.length; }
		private String readLine() {
			try {
				return r.readLine();
			} catch (Exception e) {
				throw new Error (e);
			}
		}
		private final java.io.BufferedReader r;
		private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
		private MyScanner (java.io.BufferedReader r) {
			try {
				this.r = r;
				while (!r.ready())
					Thread.sleep(1);
				start();
			} catch (Exception e) {
				throw new Error(e);
			}
		}
		private String [] line;
		private int index;
		private void newLine() {
			if (line == null || eol()) {
				line = readLine().split(" ");
				index = 0;
			}
		}
	}
	private static void print (Object o, Object... a) { printDelim(" ", o, a); }
	private static void printDelim (String delim, Object o, Object... a) { pw.println(build(delim, o, a)); }
	private static void exit (Object o, Object... a) { print(o, a); exit(); }
	private static void exit() {
		pw.close();
		System.out.flush();
		System.err.println("------------------");
		System.err.println("Time: " + ((millis() - t) / 1000.0));
		System.exit(0);
	}
	////////////////////////////////////////////////////////////////////////////////////
	private static String build (String delim, Object o, Object... a) {
		StringBuilder b = new StringBuilder();
		append(b, o, delim);
		for (Object p : a)
			append(b, p, delim);
		return b.substring(delim.length());
	}
	private static void append(StringBuilder b, Object o, String delim) {
		if (o.getClass().isArray()) {
			int L = java.lang.reflect.Array.getLength(o);
			for (int i = 0; i < L; ++i)
				append(b, java.lang.reflect.Array.get(o, i), delim);
		} else if (o instanceof Iterable<?>)
			for (Object p : (Iterable<?>)o)
				append(b, p, delim);
		else
			b.append(delim).append(o);
	}
	////////////////////////////////////////////////////////////////////////////////////
	private static void start() { t = millis(); }
	private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out, autoflush);
	private static long t;
	private static long millis() { return System.currentTimeMillis(); }
	public static void main (String[] args) { new A(); exit(); }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.Vector;

public class InnaandPinkPony {
    static boolean[][] visited;
    static Vector<Integer> steps;

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] line = br.readLine().split(" ");
        int n = Integer.parseInt(line[0]);
        int m = Integer.parseInt(line[1]);
        int i = Integer.parseInt(line[2]);
        int j = Integer.parseInt(line[3]);
        int a = Integer.parseInt(line[4]);
        int b = Integer.parseInt(line[5]);
        // visited = new boolean[n][m];
        // steps = new Vector<Integer>();
        // int count = 0;
        // check(n - 1, m - 1, --i, --j, a, b, count);
        // Collections.sort(steps);
        // System.out.println(steps.size() == 0 ? "Poor Inna and pony!" : steps
        // .firstElement());
        int leftUpH = Math.abs((i - 1) / a);
        int leftUpV = Math.abs((j - 1) / b);
        int leftUp = -1;
        if (Math.abs(leftUpH - leftUpV) % 2 == 0) {
            leftUp = Math.max(leftUpH, leftUpV);
        }
        int leftDownH = Math.abs((i - n) / a);
        int leftDownV = Math.abs((j - 1) / b);
        int leftDown = -1;
        if (Math.abs(leftDownH - leftDownV) % 2 == 0) {
            leftDown = Math.max(leftDownH, leftDownV);
        }
        int rightUpH = Math.abs((i - 1) / a);
        int rightUpV = Math.abs((j - m) / b);
        int rightUp = -1;
        if (Math.abs(rightUpH - rightUpV) % 2 == 0) {
            rightUp = Math.max(rightUpH, rightUpV);
        }
        int rightDownH = Math.abs((i - n) / a);
        int rightDownV = Math.abs((j - m) / b);
        int rightDown = -1;
        if (Math.abs(rightDownH - rightDownV) % 2 == 0) {
            rightDown = Math.max(rightDownH, rightDownV);
        }
        if (leftDown == -1 && leftUp == -1 && rightDown == -1 && rightUp == -1)
            System.out.println("Poor Inna and pony!");
        else
            System.out.println(Math.max(
                    Math.max(Math.max(leftDown, leftUp), rightDown), rightUp));

    }

    // private static void check(int n, int m, int i, int j, int a, int b,
    // int count) {
    // if ((i == 0 && j == 0) || (i == 0 && j == m) || (i == n && j == 0)
    // || (i == n && j == m))
    // steps.add(count);
    // visited[i][j] = true;
    // if (i + a >= 0 && i + a <= n && j + b >= 0 && j + b <= m
    // && !visited[i + a][j + b])
    // check(n, m, i + a, j + b, a, b, ++count);
    // if (i + a >= 0 && i + a <= n && j - b >= 0 && j - b <= m
    // && !visited[i + a][j - b])
    // check(n, m, i + a, j - b, a, b, ++count);
    // if (i - a >= 0 && i - a <= n && j - b >= 0 && j - b <= m
    // && !visited[i - a][j - b])
    // check(n, m, i - a, j - b, a, b, ++count);
    // if (i - a >= 0 && i - a <= n && j + b >= 0 && j + b <= m
    // && !visited[i - a][j + b])
    // check(n, m, i - a, j + b, a, b, ++count);
    // }
}

//package cf220;

import java.util.*;
import java.io.*;

public class A {
	FastScanner in;
	PrintWriter out;

	public void solve() throws IOException {
		int n = in.nextInt();
		int m = in.nextInt();
		int i = in.nextInt();
		int j = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();
		ArrayList<Integer> h = new ArrayList<Integer>();
		ArrayList<Integer> v = new ArrayList<Integer>();
		if (((i - 1) % a) == 0 ) {
			h.add((i - 1) / a);
		}
		if (((n - i) % a) == 0 ) {
			h.add((n - i) / a);
		}
		if (((j - 1) % b) == 0 ) {
			v.add((j - 1) / b);
		}
		if (((n - i) % a) == 0 ) {
			v.add((m - j) / b);
		}
		boolean hasAns = false;
		int ans = 0;;
		for (Integer hh : h) {
			for (Integer gg : v) {
				if ((hh - gg) % 2 == 0) {
					hasAns = true;
					ans = Math.max(hh, gg);
				}
			}
		}

		if (!hasAns) {
			System.out.println("Poor Inna and pony!");
		} else {
			System.out.println(ans);
		}

	}

	public void run() {
		try {
			in = new FastScanner(System.in);
			out = new PrintWriter(System.out);

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return null;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	public static void main(String[] arg) {
		new A().run();
	}
}

import java.util.*;
public class Main {
public static void main(String [] args){
	Scanner in = new Scanner(System.in);
	int n=in.nextInt();
	int m=in.nextInt();
	int i=in.nextInt();
	int j=in.nextInt();
	int a=in.nextInt();
	int b=in.nextInt();
	int min=Integer.MAX_VALUE;
	if((i-1)%a==0 && (j-1)%b==0 && Math.abs((i-1)/a - (j-1)/b)%2==0)
		min=Math.min(min,Math.max((i-1)/a,(j-1)/b));
	if((i-1)%a==0 && (m-j)%b==0 && Math.abs((i-1)/a - (m-j)/b)%2==0)
		min=Math.min(min,Math.max((i-1)/a,(m-j)/b));
	if((n-i)%a==0 && (m-j)%b==0 && Math.abs((n-i)/a - (m-j)/b)%2==0)
		min=Math.min(min,Math.max((n-i)/a,(m-j)/b));
	if((n-i)%a==0 && (j-1)%b==0 && Math.abs((n-i)/a - (j-1)/b)%2==0)
		min=Math.min(min,Math.max((n-i)/a,(j-1)/b));
	if(min==Integer.MAX_VALUE)System.out.print("Poor Inna and pony!");
	else System.out.print(min);
}
}

import java.util.*;

public class aa {

	public static void main(String[] args) {

		Scanner qwe = new Scanner(System.in);

		int n = qwe.nextInt();
		int m = qwe.nextInt();
		int r = qwe.nextInt();
		int c =qwe.nextInt();
		int a = qwe.nextInt();
		int b = qwe.nextInt();

		ArrayList<Integer> pos = new ArrayList<Integer>();

		if((r-1) % a == 0){
			pos.add((r-1)/a);
		}
		if((n-r) % a == 0){
			pos.add((n-r)/a);
		}

		int min = Integer.MAX_VALUE;

		int d = c-1;
		for(int p : pos){
			if(d % b == 0){
				int o = d/b;
				if((o-p) % 2 == 0){
					min = Math.min(min, Math.max(o, p));
				}
			}
		}

		d = m-c;
		for(int p : pos){
			if(d % b == 0){
				int o = d/b;
				if((o-p) % 2 == 0){
					min = Math.min(min, Math.max(o, p));
				}
			}
		}

		if(min == Integer.MAX_VALUE){
			System.out.println("Poor Inna and pony!");
		}
		else{
			System.out.println(min);
		}

		qwe.close();

	}

}

/**
 * Created by Omar on 12/25/2015.
 */

import java.util.*;
import java.io.*;

public class InnaandPinkPony {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] parts=br.readLine().split(" ");
        int n=Integer.parseInt(parts[0]);
        int m=Integer.parseInt(parts[1]);
        int i=Integer.parseInt(parts[2]);
        int j=Integer.parseInt(parts[3]);
        int a=Integer.parseInt(parts[4]);
        int b=Integer.parseInt(parts[5]);
        int min=Integer.MAX_VALUE;
        int corner1=0;
        int corner2=0;
        int corner3=0;
        int corner4=0;
        int I=i;
        int J=j;

        //step 1
while(i-a>1){
    i=i-a;
    corner1++;
}
        while(j-b>1){
            j=j-b;
            corner1++;
        }
        if(i==1 && j==1) min=Math.min(min,corner1);

        //step 2
        i=I;
        j=J;
        while(i+a<n){
            i=i+a;
            corner2++;
        }
        while(j+b<m){
            j=j+b;
            corner2++;
        }
        if(i==n && j==m) min=Math.min(min,corner2);

        //step 3
        i=I;
        j=J;
        while(i-a>1){
            i=i-a;
            corner3++;
        }
        while(j+b<m){
            j=j+b;
            corner3++;
        }
        if(i==1 && j==m) min=Math.min(min,corner3);

        //step 4
        i=I;
        j=J;
        while(i+a<n){
            i=i+a;
            corner4++;
        }
        while(j-b>1){
            j=j-b;
            corner4++;
        }
        if(i==n && j==1) min=Math.min(min,corner4);

        if(min!=Integer.MAX_VALUE)System.out.println(min);else
        System.out.println("Poor Inna and pony!");
        br.close();
    }
}

import java.util.Scanner;

public class a {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n = in.nextInt()-1;
		int m = in.nextInt()-1;
		int i = in.nextInt()-1;
		int j = in.nextInt()-1;
		if(i==0){
			if(j==0||j==m){
				System.out.println(0);
				return;
			}
		}
		if(i==n){
			if(j==0||j==m){
				System.out.println(0);
				return;
			}
		}
		int a = in.nextInt();
		int b = in.nextInt();
		int right = n-i;
		int down = m-j;
		//System.out.println("LEFT "+i+" UP "+j+" DOWN "+down+" RIGHT "+right);
		int goleft = i/a;
		if(i%a!=0 || (a>i&&i!=0)){
			goleft=Integer.MAX_VALUE;
		}
		int goup = j/b;
		if(j%b!=0 || (b>j&&j!=0)){
			goup=Integer.MAX_VALUE;
		}
		int goright = right/a;
		if(right%a!=0 || (right + a > n && right!=n)){
			goright=Integer.MAX_VALUE;
		}
		int godown = down/b;
		if(i%b!=0 || (down +b > m && down!=m)){
			godown=Integer.MAX_VALUE;
		}
		//System.out.println("LEFT "+goleft+" UP "+goup+" DOWN "+godown+" RIGHT "+goright);
		int min = Integer.MAX_VALUE;

		if(godown%2==goleft%2){
			min = Math.min(min, Math.max(godown, goleft));
		}
		if(godown%2==goright%2){
			min = Math.min(min, Math.max(godown, goright));
		}
		if(goup%2==goleft%2){
			min = Math.min(min, Math.max(goup, goleft));
		}
		if(goup%2==goright%2){
			min = Math.min(min, Math.max(goup, goright));
		}
		System.out.println(min==Integer.MAX_VALUE?"Poor Inna and pony!":min);
	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int N=in.readInt();
        int M=in.readInt();
        int x=in.readInt();
        int y=in.readInt();
        int a=in.readInt();
        int b=in.readInt();
        int ans=Integer.MAX_VALUE;
        if ((x-1)%a==0&&(y-1)%b==0&&((x-1)/a+(y-1)/b)%2==0) ans=Math.min(ans,Math.max((x-1)/a,(y-1)/b));
        if ((N-x)%a==0&&(y-1)%b==0&&((N-x)/a+(y-1)/b)%2==0) ans=Math.min(ans,Math.max((N-x)/a,(y-1)/b));
        if ((N-x)%a==0&&(M-y)%b==0&&((N-x)/a+(M-y)/b)%2==0) ans=Math.min(ans,Math.max((N-x)/a,(M-y)/b));
        if ((x-1)%a==0&&(M-y)%b==0&&((x-1)/a+(M-y)/b)%2==0) ans=Math.min(ans,Math.max((x-1)/a,(M-y)/b));

        if (ans==Integer.MAX_VALUE) out.println("Poor Inna and pony!");
        else out.println(ans);
    }
}

class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
                this.stream = stream;
        }

        public int read() {
                if (numChars == -1)
                        throw new InputMismatchException();
                if (curChar >= numChars) {
                        curChar = 0;
                        try {
                                numChars = stream.read(buf);
                        } catch (IOException e) {
                                throw new InputMismatchException();
                        }
                        if (numChars <= 0)
                                return -1;
                }
                return buf[curChar++];
        }

        public int readInt() {
                int c = read();
                while (isSpaceChar(c))
                        c = read();
                int sgn = 1;
                if (c == '-') {
                        sgn = -1;
                        c = read();
                }
                int res = 0;
                do {
                        if (c < '0' || c > '9')
                                throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = read();
                } while (!isSpaceChar(c));
                return res * sgn;
        }

        public boolean isSpaceChar(int c) {
                if (filter != null)
                        return filter.isSpaceChar(c);
                return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
                return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
                public boolean isSpaceChar(int ch);
        }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class A374 {
    public static void main(String[] args)throws Exception{
        // TODO Auto-generated method stub
        new A374().run();
    }

    int n,m,i,j,a,b;

    int getMin(int toX, int toY){
        int diffX=Math.abs(toX-i);
        int diffY=Math.abs(toY-j);
        if( diffX%a==0 && diffY%b==0){
            int x=diffX/a;
            int y=diffY/b;
            if((x&1)!=(y&1)) return Integer.MAX_VALUE;
            //System.out.println(toX+";"+toY+" res: "+x+":"+y);
            return Math.max(x, y);
        }
        else return Integer.MAX_VALUE;
    }

    void run() throws Exception{
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

        String s=reader.readLine();

        String[] ss=s.split(" ");
        n=Integer.parseInt(ss[0]);
        m=Integer.parseInt(ss[1]);
        i=Integer.parseInt(ss[2]);
        j=Integer.parseInt(ss[3]);
        a=Integer.parseInt(ss[4]);
        b=Integer.parseInt(ss[5]);

        int res=Math.min(Math.min(getMin(1,1), getMin(1,m)), Math.min(getMin(n,1), getMin(n,m)));

        if(res==Integer.MAX_VALUE || n==1 || m==1)
            System.out.println("Poor Inna and pony!");
        else
            System.out.println(res);

        System.out.flush();
        reader.close();
    }
}

import java.util.Scanner;

public class InnaAndPinkPony {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int i = sc.nextInt();
		int j = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		int x1 = (i-1)/a;
		int xx1 = (i-1)%a;
		int x2 = (n-i)/a;
		int xx2 = (n-i)%a;

		int y1 = (j-1)/b;
		int yy1 = (j-1)%b;
		int y2 = (m-j)/b;
		int yy2 = (m-j)%b;

		//System.out.println(x1 + " " + x2 + " " + y1 + " " + y2);

		int ans = Integer.MAX_VALUE;

		if(x1%2==0 && y1%2==0 && xx1==0 && yy1==0){
			if(Math.max(x1, y1)<ans){
				ans = Math.max(x1, y1);
			}
		}
		if(x1%2==0 && y2%2==0 && xx1==0 && yy2==0){
				if(Math.max(x1, y2)<ans){
					ans = Math.max(x1, y2);
				}
		}
		if(x2%2==0 && y1%2==0 && xx2==0 && yy1==0){
			if(Math.max(x2, y1)<ans){
				ans = Math.max(x2, y1);
			}
		}
		if(x2%2==0 && y2%2==0 && xx2==0 && yy2==0){
			if(Math.max(x2, y2)<ans){
				ans = Math.max(x2, y2);
			}
		}

		if(x1%2==1 && y1%2==1 && xx1==0 && yy1==0){
			if(Math.max(x1, y1)<ans){
				ans = Math.max(x1, y1);
			}
		}
		if(x1%2==1 && y2%2==1 && xx1==0 && yy2==0){
				if(Math.max(x1, y2)<ans){
					ans = Math.max(x1, y2);
				}
		}
		if(x2%2==1 && y1%2==1 && xx2==0 && yy1==0){
			if(Math.max(x2, y1)<ans){
				ans = Math.max(x2, y1);
			}
		}
		if(x2%2==1 && y2%2==1 && xx2==0 && yy2==0){
			if(Math.max(x2, y2)<ans){
				ans = Math.max(x2, y2);
			}
		}
		if(ans<Integer.MAX_VALUE)
			System.out.println(ans);
		else
			System.out.println("Poor Inna and pony!");
		sc.close();
	}
}

import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.io.*;

public class Main {

    public static void main(String[] args) throws IOException {
        try {
            if (new File("input.txt").exists())
                System.setIn(new FileInputStream("input.txt"));
        } catch (SecurityException e) {
        }
        new Main().run();
    }

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    final int INF = Integer.MAX_VALUE/2;

    private void solve() throws IOException {
        int n = nextInt(), m = nextInt(), i = nextInt(), j = nextInt(), a = nextInt(), b = nextInt();
        int ans1 = INF, ans2 = INF, ans3 = INF, ans4 = INF;
        if(j != 1 && i != 1 && j != m && i != n){
            if((m-j) % a == 0 && (n-i) % b == 0 && (m-j)/a == (n-i)/b){
                ans1 = (m-j)/a;
            }
            if((m-j) % a == 0 && (i-1) % b == 0 && (m-j)/a == (i-1)/b){
                ans2 = (m-j)/a;
            }
            if((j-1) % a == 0 && (i-1) % b == 0 && (j-1)/a == (i-1)/b){
                ans3 = (j-1)/a;
            }
            if((j-1) % a == 0 && (n-i) % b == 0 && (j-1)/a == (n-i)/b){
                ans4 = (j-1)/a;
            }
        }
        if((i == 1 && j == 1) || (i == n && j == 1) || (i == n && j == m) || (i == 1 && j == m))
            ans1 = 0;
        if(i == 1 && j != 1 && j != m){
            if((m-j) % b == 0 && a <= n-1 && ((m-j)/b) % 2 == 0)
                ans1 = min(ans1,(m-j)/b);
            if((j-1) % b == 0 && a <= n-1 && ((j-1)/b) % 2 == 0)
                ans1 = min(ans1,(j-1)/b);
        }
        if(i == n && j != 1 && j != m){
            if((m-j) % b == 0 && a <= n-1 && ((m-j)/b) % 2 == 0)
                ans1 = min(ans1,(m-j)/b);
            if((j-1) % b == 0 && a <= n-1 && ((j-1)/b) % 2 == 0)
                ans1 = min(ans1,(j-1)/b);
        }
        if(j == 1 && i != 1 && i != n){
            if((n-i) % a == 0 && b <= m-1 && ((n-i)/a) % 2 == 0)
                ans1 = min(ans1, (n-i)/a);
            if((i-1) % a == 0 && b <= m-1 && ((i-1)/a) % 2 == 0)
                ans1 = min(ans1, (i-1)/a);

        }
        if(j == m && i != 1 && i != n){
            if((n-i) % a == 0 && b <= m-1 && ((n-i)/a) % 2 == 0)
                ans1 = min(ans1, (n-i)/a);
            if((i-1) % a == 0 && b <= m-1 && ((i-1)/a) % 2 == 0)
                ans1 = min(ans1, (i-1)/a);
        }
        int ans = min(ans1, min(ans2, min(ans3, ans4)));
        if(ans == INF)
            out.println("Poor Inna and pony!");
        else
            out.println(ans);
    }

    int gcd(int a, int b){return b == 0 ? a : gcd(b,a%b);}

    void arrayToString(int[] m){
        Arrays.toString(m);
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextLine() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }
    boolean EOF() throws IOException {
        while (!st.hasMoreTokens()) {
            String s = in.readLine();
            if (s == null)
                return true;
            st = new StringTokenizer(s);
        }
        return false;
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class A374 {
    public static void main(String[] args)throws Exception{
        // TODO Auto-generated method stub
        new A374().run();
    }

    int n,m,i,j,a,b;

    int getMin(int toX, int toY){
        int diffX=Math.abs(toX-i);
        int diffY=Math.abs(toY-j);
        if( diffX%a==0 && diffY%b==0){
            int x=diffX/a;
            int y=diffY/b;
            if((x&1)!=(y&1)) return Integer.MAX_VALUE;
            //System.out.println(toX+";"+toY+" res: "+x+":"+y);
            return Math.max(x, y);
        }
        else return Integer.MAX_VALUE;
    }

    void run() throws Exception{
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

        String s=reader.readLine();

        String[] ss=s.split(" ");
        n=Integer.parseInt(ss[0]);
        m=Integer.parseInt(ss[1]);
        i=Integer.parseInt(ss[2]);
        j=Integer.parseInt(ss[3]);
        a=Integer.parseInt(ss[4]);
        b=Integer.parseInt(ss[5]);

        if((i==1 && j==1) || (i==n && j==m) || (i==1 && j==m) || (i==n && j==1))
            System.out.println(0);
        else{
            int res=Math.min(Math.min(getMin(1,1), getMin(1,m)), Math.min(getMin(n,1), getMin(n,m)));

            if(res==Integer.MAX_VALUE || (n==1 || m==1))
                System.out.println("Poor Inna and pony!");
            else
                System.out.println(res);
        }
        System.out.flush();
        reader.close();
    }
}

import java.util.Scanner;

public class Main {

    public static class point {
        long i,j;
        public point (long f,long l)
        {
            i=f;
            j=l;
        }
    }

public static void main (String []args) {

    Scanner s=new Scanner(System.in);
    long n=s.nextLong(),m=s.nextLong();
    point E[] = new point[4];
    E[0] = new point (1,1);
    E[1] = new point (1,m);
    E[2] = new point (n,1);
    E[3] = new point (n,m);
    long i=s.nextLong(),j=s.nextLong();
    long a=s.nextLong(),b=s.nextLong();

    if (a>=n || b>=m)
    {
        System.out.println("Poor Inna and pony!");
        return;
    }
    long ans = Long.MAX_VALUE;
    for (int k=0;k<4;k++)
    {
        int val1 = (int) Math.abs(E[k].i-i);
        int val2 =(int) Math.abs(E[k].j-j);
         if (val1%a!=0 || val2%b!=0 || (val1/a)%2 != (val2/b)%2)
         {
             continue;
         }
         ans=Math.min(ans, Math.max(val1/a, val2/b));

    }

    if (ans==Long.MAX_VALUE)
    {
        System.out.println("Poor Inna and pony!");
    } else {
        System.out.println(ans);
    }

}

}

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mark
 */
public class InnaPony {

    public static void main(String[] args) throws FileNotFoundException {
        //FileInputStream file = new FileInputStream(new File("/home/mark/tmp/input.txt"));
        //Scanner scan = new Scanner(file);
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int i = scan.nextInt();
        int j =scan.nextInt();
        int a =scan.nextInt();
        int b=scan.nextInt();

        if (a>=n || b>=m){
            System.out.println("Poor Inna and pony!");
            return;
        }

        int c1= getMin(1,1,a,b,i,j);
        int c2=getMin(1,m,a,b,i,j);
        int c3=getMin(n,m,a,b,i,j);
        int c4=getMin(n,1,a,b,i,j);

        int min = Math.min(c1,Math.min(c2,Math.min(c3, c4)));
        if (min==Integer.MAX_VALUE){
            System.out.println("Poor Inna and pony!");
        }else{
            System.out.println(min);
        }
    }

    private static int getMin(int x, int y, int a, int b, int i, int j){
        int rm=-1;
        int cm=-1;
        int res=Integer.MAX_VALUE;

        if (Math.abs(x-i)%a==0){
            rm=Math.abs(x-i)/a;
        }

        if (Math.abs(y-j)%b==0){
            cm=Math.abs(y-j)/b;
        }
        if (rm!=-1 && cm!=-1  && cm==rm){
            res=rm;
        }else if (rm!=-1 && cm!=-1 && cm%2==rm%2){
            res=Math.max(rm,cm);
        }
        return res;
    }
}

//package com.congli.codeforces;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Locale;
import java.util.StringTokenizer;

public class C220Div2A_InnaAndPinkPony {

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok = new StringTokenizer("");
	long multiply = 2000000L;

	public static void main(String[] args) {
		C220Div2A_InnaAndPinkPony test = new C220Div2A_InnaAndPinkPony();
		test.start();
	}

	public void solve() throws IOException {
		int n = readInt(), m = readInt();
		int i = readInt(), j = readInt();
		int a = readInt(), b = readInt();

		int result = Integer.MAX_VALUE;
		result = Math.min(result, getStep(i, j, 1, 1, a, b));
		result = Math.min(result, getStep(i, j, 1, m, a, b));
		result = Math.min(result, getStep(i, j, n, 1, a, b));
		result = Math.min(result, getStep(i, j, n, m, a, b));

		if (result == Integer.MAX_VALUE) {
			out.println("Poor Inna and pony!");
		} else {
			out.println(result);
		}
	}

	public int getStep(int x1, int y1, int x2, int y2, int a, int b) {
		if (Math.abs(x1 - x2) % a != 0) {
			return Integer.MAX_VALUE;
		}
		if (Math.abs(y1 - y2) % b != 0) {
			return Integer.MAX_VALUE;
		}
		int step1 = Math.abs(x1 - x2) / a;
		int step2 = Math.abs(y1 - y2) / b;
		if (Math.abs(step1 - step2) % 2 != 0) {
			return Integer.MAX_VALUE;
		}
		return Math.max(step1, step2);
	}

	public void start()
	{
		try {
			long t1 = System.currentTimeMillis();
			if (System.getProperty("ONLINE_JUDGE") != null) {
				in = new BufferedReader(new InputStreamReader(System.in));
				out = new PrintWriter(System.out);
			} else {
				in = new BufferedReader(new FileReader("/Users/congli/Documents/javaworkspace/codeforces/src/com/congli/codeforces/input.txt"));
				out = new PrintWriter(System.out);
			}
			Locale.setDefault(Locale.US);
			solve();
			in.close();
			out.close();
			long t2 = System.currentTimeMillis();
			System.err.println("Time = " + (t2 - t1));
		} catch (Throwable t) {
			t.printStackTrace(System.err);
			System.exit(-1);
		}
	}

	public String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	public long readLong() throws IOException {
		return Long.parseLong(readString());
	}

	public double readDouble() throws IOException {
		return Double.parseDouble(readString());
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class InnaPinkPony {

    private static int INF = 1000000;

    public static void main(String[] args) {
        int n, m, i, j, a, b;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line = br.readLine();
            String[] params = line.split(" ");
            n = Integer.parseInt(params[0]);
            m = Integer.parseInt(params[1]);
            i = Integer.parseInt(params[2]);
            j = Integer.parseInt(params[3]);
            a = Integer.parseInt(params[4]);
            b = Integer.parseInt(params[5]);

            int[][] corners = new int[][] { { 1, m }, { n, 1 }, { n, m },
                    { 1, 1 } };

            int min = INF;
            for (int[] cor : corners) {
                int xdiff = cor[0] - i;
                int ydiff = cor[1] - j;

                if (xdiff % a != 0 || ydiff % b != 0) {
                    continue;
                }
                int xmoves = Math.abs(xdiff) / a;
                int ymoves = Math.abs(ydiff) / b;
                if (xmoves % 2 == ymoves % 2) {
                    min = Math.min(min, Math.max(xmoves, ymoves));
                }
            }
            if (i != n && j != m
                    && ((i - a < 1 && i + a > n) || (j - b < 1 && j + b > m))) {
                min = INF;
            }
            if (min == INF) {
                System.out.print("Poor Inna and pony!");
            } else {
                System.out.print(min);
            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
}