Given a positive integer k, two arrays are called k-similar if:

  * they are strictly increasing; 
  * they have the same length; 
  * all their elements are positive integers between 1 and k (inclusive); 
  * they differ in exactly one position. 



You are given an integer k, a strictly increasing array a and q queries. For each query, you are given two integers l_i ≤ r_i. Your task is to find how many arrays b exist, such that b is k-similar to array [a_{l_i},a_{l_i+1}…,a_{r_i}]. 

Input

The first line contains three integers n, q and k (1≤ n, q ≤ 10^5, n≤ k ≤ 10^9) — the length of array a, the number of queries and number k.

The second line contains n integers a_1, a_2, …,a_n (1 ≤ a_i ≤ k). This array is strictly increasing — a_1 < a_2 < … < a_n.

Each of the following q lines contains two integers l_i, r_i (1 ≤ l_i ≤ r_i ≤ n).

Output

Print q lines. The i-th of them should contain the answer to the i-th query.

Examples

Input


4 2 5
1 2 4 5
2 3
3 4


Output


4
3


Input


6 5 10
2 4 6 7 8 9
1 4
1 2
3 5
1 6
5 5


Output


8
9
7
6
9

Note

In the first example:

In the first query there are 4 arrays that are 5-similar to [2,4]: [1,4],[3,4],[2,3],[2,5].

In the second query there are 3 arrays that are 5-similar to [4,5]: [1,5],[2,5],[3,5].
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define po pop_back
#define mp make_pair
#define fi first
#define se  second
#define hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MOD 1000000007
using namespace std;
bool comp(ll a,ll b){if(a>b)return true;else return false;}
int isP(ll n){if(n==1)return 0;if(n==2 || n==3)return 1;for(ll i=2;i<=sqrt(n);i++){if(n%i==0)return 0;}return 1;}
ll power(ll a,ll b){if(b==0)return 1;if(b==1) return a;ll t=power(a,b/2);if(b%2==1) return t*t*a;else return t*t;}
ll powMOD(ll x,ll y){if(y==0)return 1;if(y==1)return x;ll t=powMOD(x,y/2);if(y%2==1)return t*t%MOD*x%MOD;else return t*t%MOD;}

int main()
{
    /*//----Hello World----//*/
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    hello;
    
    ll t;
//    cin>>t;
    t=1;
    while(t--){
    	ll n,q,k;
    	cin>>n>>q>>k;
    	ll ar[n+1];
    	for(ll i=1;i<=n;i++) cin>>ar[i];
    	ll val[n+2];
    	if(n>1){
	    	for(ll i=2;i<n;i++){
    			val[i]=ar[i+1]-ar[i-1]-1;
			}
			val[1]=ar[2];
			val[n]=k-ar[n-1]+1;
		}
		else{
			val[1]=k;
		}
		for(ll i=1;i<=n;i++) val[i]-=1;
		for(ll i=2;i<=n;i++) val[i]+=val[i-1];
    	while(q--){
    		ll l,r;
    		cin>>l>>r;
    		if(l==r){
    			cout<<k-1<<"\n";
    			continue;
			}
    		ll ans=val[r-1];
    		if(l>0) ans-=val[l];
    		ans+=ar[l+1]-2;
    		ans+=k-ar[r-1]-1;
    		cout<<ans<<"\n";
		}
	}
    
	/*//----Hello World----//*/
    return 0;  
}
