#include <vector>
#include <iostream>
#include <utility>
#include <queue>

using namespace std;

int lx, ly;
inline int convert(const int x, const int y, const int t)
{
    const int X = 2 * lx + 1;
    const int Y = 2 * ly + 1;
    const int TOTAL = X * Y;
    const int dx = x + lx;
    const int dy = y + ly;
    return X * dy + dx + TOTAL * t;
}

struct Edge {
    Edge(const int from, const int to, const int cost) : from{from}, to{to}, cost{cost} {}
    int from;
    int to;
    int cost;
};

struct Graph {
    Graph(const int n)
    {
        edge.resize(n);
    }
    void addEdge(const int from, const int to, const int cost)
    {
        edge[from].push_back(Edge{from, to, cost});
    }
    vector<vector<Edge>> edge;
};

constexpr int dirx[] = {0, 1, 1, 0, -1, -1};
constexpr int evendiry[] = {1, 0, -1, -1, -1, 0};
constexpr int odddiry[] = {1, 1, 0, -1, 0, 1};


int main()
{
    int sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;
    int n;
    cin >> n;
    vector<int> fx(n);
    vector<int> fy(n);
    for (int i = 0; i < n; i++) {
        cin >> fx[i] >> fy[i];
    }
    cin >> lx >> ly;
    const int total = (2 * lx + 1) * (2 * ly + 1) * 6;
    vector<bool> ok(total, true);
    for (int i = 0; i < n; i++) {
        for (int t = 0; t < 6; t++) {
            const int v = convert(fx[i], fy[i], t);
            ok[v] = false;
        }
    }

    Graph g(total);
    for (int x = -lx; x <= lx; x++) {
        for (int y = -ly; y <= ly; y++) {
            for (int t = 0; t < 6; t++) {
                const int p = convert(x, y, t);
                const int dir = abs(x * y * t) % 6;
                for (int d = 0; d < 6; d++) {
                    const int newx = x + dirx[d];
                    const int newy = y + ((x % 2 == 0) ? evendiry[d] : odddiry[d]);
                    const int newt = (t + 1) % 6;
                    g.addEdge(p, convert(x, y, newt), 1);
                    if (abs(newx) <= lx and abs(newy) <= ly) {
                        const int newp = convert(newx, newy, newt);
                        if (not ok[newp]) {
                            continue;
                        }

                        if (d == dir) {
                            g.addEdge(p, newp, 0);
                        } else {
                            g.addEdge(p, newp, 1);
                        }
                    }
                }
            }
        }
    }

    const int sp = convert(sx, sy, 0);
    int gp[6];
    for (int t = 0; t < 6; t++) {
        const int p = convert(gx, gy, t);
        gp[t] = p;
    }

    using P = pair<int, int>;
    priority_queue<P, vector<P>, greater<P>> q;
    constexpr int INF = (1 << 30);
    vector<int> d(total, INF);
    d[sp] = 0;
    q.push(make_pair(0, sp));
    while (not q.empty()) {
        const auto& p = q.top();
        const int s = p.second;
        const int cost = p.first;
        q.pop();
        if (d[s] < cost) {
            continue;
        }
        for (const auto& e : g.edge[s]) {
            if (d[e.to] > d[s] + e.cost) {
                d[e.to] = d[s] + e.cost;
                q.push(make_pair(d[e.to], e.to));
            }
        }
    }
    int mini = INF;
    for (int t = 0; t < 6; t++) {
        mini = min(mini, d[gp[t]]);
    }
    if (mini == INF) {
        cout << -1 << endl;
    } else {
        cout << mini << endl;
    }

    return 0;
}

Measured memory_bytes: 58740