#include <bits/stdc++.h>
const int INF = 0x3f3f3f3f;
const int maxn = 1e6 + 50;
const int Mod = 1e9 + 7;
using namespace std;
int n, m, sx, sy, dx, dy;
int get(int sx, int sy, int ex, int ey) {
  int cx = abs(sx - ex), cy = abs(sy - ey);
  if (cx == 0 && cy == 0) return 0;
  if (cx % dx != 0 || cy % dy != 0) return INF;
  if (sx == ex) {
    if (!(sx - dx >= 1 || sx + dx <= n)) return INF;
  } else if (sy == ey) {
    if (!(sy - dy >= 1 || sy + dy <= m)) return INF;
  }
  int t1 = cx / dx, t2 = cy / dy;
  int cha = abs(t1 - t2);
  if (cha & 1) return INF;
  return max(t1, t2);
}
int main() {
  while (scanf("%d %d %d %d %d %d", &n, &m, &sx, &sy, &dx, &dy) != EOF) {
    int ans = INF;
    ans = min(get(sx, sy, 1, 1), ans);
    ans = min(get(sx, sy, 1, m), ans);
    ans = min(get(sx, sy, n, 1), ans);
    ans = min(get(sx, sy, n, m), ans);
    if (ans == INF)
      puts("Poor Inna and pony!");
    else
      printf("%d\n", ans);
  }
  return 0;
}
