#include <iostream>
#include <unordered_map>

using namespace std;

int main() {
    int N, a, d;
    cin >> N >> a >> d;

    int M;
    cin >> M;

    unordered_map<int, int> A;
    int x, y, z;
    int Ay, Az;

    while (M--) {
        cin >> x >> y >> z;
        Ay = A.find(y) != A.end() ? A[y] : (a + d * (y - 1));
        Az = A.find(z) != A.end() ? A[z] : (a + d * (z - 1));
        if (x == 0) {
            A[y] = Az;
            A[z] = Ay;
        } else {
            A[y] = Az;
        }
    }

    int K;
    cin >> K;
    cout << (A.find(K) != A.end() ? A[K] : (a + d * (K - 1))) << endl;
}
