#include <bits/stdc++.h>

using namespace std;

using ll = long long;

constexpr int MAX_MOD = 1 << 24;
constexpr int MAXM = 1000;

ll z[MAX_MOD];
int a[MAXM], b[MAXM], x[MAXM], y[MAXM];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int m, n;
    int mulx, addx, muly, addy;
    int mod;
    cin >> m >> n >> mulx >> addx >> muly >> addy >> mod;

    for (int i = 0; i < m; i++) {
        cin >> x[i];
    }

    for (int i = 0; i < m; i++) {
        cin >> y[i];
    }

    for (int i = 0; i < m; i++) {
        cin >> a[i];
    }

    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }

    for (int i = 0; i < m; i++) {
        z[x[i]] += y[i];
    }

    ll curx = x[m - 1], cury = y[m - 1], cura = a[m-1], curb = b[m-1];
    for (int i = m; i < n; i++) {
        curx = ((curx * mulx + addx) & (mod - 1));
        cury = ((cury * muly + addy) & (mod - 1));
        z[curx] += cury;
    }

    for (int aa = 1; aa <= mod; aa++) {
        for (int i = aa * 2; i < mod; i += aa) {
            z[aa] += z[i];
        }
    }

    ll all_ans = 0;
    for (int i = 0; i < m; i++) {
        ll ans = 0;
        if ((ll)a[i] * b[i] >= mod) {
            ans = (a[i] >= mod ? 0 : z[a[i]]);
        } else {
            ans = (a[i] >= mod ? 0 : z[a[i]] - z[a[i] * b[i]]);
        }
        cout << ans << "\n";
        all_ans ^= ans;
    }

    for (int i = m; i < n; i++) {
        cura = ((cura * mulx + addx + mod - 1) & (mod - 1)) + 1;
        curb = ((curb * muly + addy + mod - 1) & (mod - 1)) + 1;
        ll ans = 0;
        if (cura * curb >= mod) {
            ans = (cura >= mod ? 0 : z[cura]);
        } else {
            ans = (cura >= mod ? 0 : z[cura] - z[cura * curb]);
        }
        all_ans ^= ans;
    }

    cout << all_ans << "\n";
    return 0;
}