#include<bits/stdc++.h>
#define int long long
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll mod=1e9+7;
const int N=100010;
int n,q,k,l,r,ans=0,a[N];
void solve(){
	ans=k+(a[r]-a[l]+1)-2*(r-l+1);
}
signed main(){
	ios::sync_with_stdio(false);
	cout.tie(NULL);
	cin>>n>>q>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	while(q--){
		cin>>l>>r;
		solve();
		cout<<ans<<endl;
	}
	return 0;//完结撒花
}
