#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M, x, y, dx, dy, mx, my, ans = 10000000;
  scanf("%d %d %d %d %d %d", &N, &M, &x, &y, &dx, &dy);
  pair<int, int> corners[] = {pair<int, int>(1, 1), pair<int, int>(1, M),
                              pair<int, int>(N, 1), pair<int, int>(N, M)};
  for (int i = 0; i < 4; i++) {
    if (x == corners[i].first && y == corners[i].second) {
      ans = 0;
      break;
    }
    if ((corners[i].first - x) % dx || (corners[i].second - y) % dy) continue;
    mx = abs(corners[i].first - x) / dx;
    my = abs(corners[i].second - y) / dy;
    if ((mx & 1) == (my & 1)) {
      if ((mx || (x + dx <= N || x - dx >= 1)) &&
          (my || (y + dy <= M || y - dy >= 1)))
        ans = min(ans, max(mx, my));
    }
  }
  if (ans == 10000000)
    printf("Poor Inna and pony!\n");
  else
    printf("%d\n", ans);
  return 0;
}
