#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>


typedef long long ll;
typedef long double ld;

using namespace std;

const int MAXN = 120000;

int t, n, m, q;
int a[MAXN];

ll solve() {
	ll ans = 0;
	int mx = 0;
	for (int i = 0; i < n; ++i) {
		mx = max(mx, a[i]);
		ans += m - mx;
	}
	return ans;
}


void solveq() {
	printf("%lld ", solve());
	for (int i = 0; i < q; ++i) {
        int pos;
        scanf("%d", &pos);
		scanf("%d", a + pos - 1);
		printf("%lld ", solve());
	}
	printf("\n");
}

int main() {
	scanf("%d%d%d", &t, &n, &m);
	for (int i = 0; i < n; ++i)
		scanf("%d", a + i);
    scanf("%d", &q);
    solveq();
	return 0;
}


