#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N (1<<20)
//n<=65536
long long a[2 * N];
bool b[2 * N];
long long k, n;
long long zzz;

//初期化
void init(void){
	f(i, 2 * N)a[i] = 0;
	f(i, 2 * N)b[i] = true;
	return;
}

//一斉挿入
void all_insert(void){
	long long x;
	zzz = 0;
	f(i, n){
		scanf("%lld", &x);
		x = -x;
		if (x > 0){
			a[N+i] = x%k;
			b[N+i] = true;
		}
		else if (x < 0){
			x = -x;
			x = x%k;
			x = (k - x) % k;
			a[N+i] = x;
			b[N+i] = true;
		}
		else {
			a[N+i] = 0;
			b[N+i] = false;
			zzz++;
		}
	}
	f(i, N){
		if (b[2 * (N - i - 1)] && b[2 * (N - i - 1) + 1]){
			a[N - i - 1] = a[2 * (N - i - 1)] + a[2 * (N - i - 1) + 1];
			b[N - i - 1] = true;
		}
		else if (!b[2 * (N - i - 1)] && b[2 * (N - i - 1) + 1]){
			a[N - i - 1] = a[2 * (N - i - 1)] + a[2 * (N - i - 1) + 1];
			b[N - i - 1] = false;
		}
		else if (b[2 * (N - i - 1)] && !b[2 * (N - i - 1) + 1]){
			a[N - i - 1] = a[2 * (N - i - 1) + 1] - a[2 * (N - i - 1)];
			b[N - i - 1] = false;
		}
		else{
			a[N - i - 1] = a[2 * (N - i - 1) + 1] - a[2 * (N - i - 1)];
			b[N - i - 1] = true;
		}

	}
	return;
}

//変更(k=1-n)
void change(long long k,long long x ,long long z){
	k += N;
	a[k] = x;
	b[k] = z;
	while (k > 1){
		k = k / 2;
		if (b[2 * k] && b[(2 * k) + 1]){
			a[k] = a[2 * k] + a[(2 * k) + 1];
			b[k] = true;
		}
		else 		if (!b[2 * k] && b[(2 * k) + 1]){
			a[k] = a[2 * k] + a[(2 * k) + 1];
			b[k] = false;
		}
		else 		if (b[2 * k] && !b[(2 * k) + 1]){
			a[k] = a[(2 * k) + 1] - a[2 * k];
			b[k] = false;
		}
		else {
			a[k] = a[(2 * k) + 1] - a[2 * k];
			b[k] = true;
		}
		
	}
	return;
}



int main(void){
	long long q;
	long long c, x, y;
	long long aa1, aa2;
	bool bb1, bb2;
	init();
	scanf("%lld %lld %lld",&k,&n, &q);
	all_insert();    //一斉挿入

	f(qq, q){
			scanf("%lld %lld", &x, &y);
			x--;
			y--;
			aa1 = a[N + x];
			aa2 = a[N + y];
			bb1 = b[N + x];
			bb2 = b[N + y];
			change(x, aa2, bb2);
			change(y, aa1, bb1);
			if (b[1]){
				c = a[1] + 1;
			}
			else{

				c = a[1] - 1;
			}
			if(c>=0)c = c%k;
			else{
				c = -c;
				c = c%k;
				c = (k - c) % k;
			}
			if (zzz % 2 == 0){
				if (c == 0)c = k;
			}
			else{
				c -= k;
				if (c == 0)c = -k;
			}

			printf("%d\n", c);
	}

	return 0;
}
