#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"

int N; 

int a, d;
map<int, int>mp;
int get(int place) {
	if (mp.find(place) == mp.end()) {
		return mp[place] = a + d*(place - 1);
	}
	else {
		return mp[place];
	}
}
int main() {
	cin >> N; 
	cin >> a >> d;
	int M; cin >> M;
	while (M--) {
		int x, y, z; cin >> x >> y >> z;
		if (x == 0) {
			int l = get(y);
			int r = get(z);
			mp[z] = l;
			mp[y] = r;
		}
		else {
			int l = get(y);
			int r = get(z);
			mp[y] = r;
		}
	}
	int K; cin >> K;
	int ans = get(K);
	cout << ans << endl;
	return 0;
}