#include<bits/stdc++.h>
using namespace std;



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long long n,q,k;
    cin>>n>>q>>k;
    deque<long long>a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    a.push_front(0);

    deque<long long>start(n,0);
    start[0]=a[2]-1-1;
    for(int i=1;i<n-1;i++) start[i]=a[i+2]-1-a[i]-1;
    start[n-1]=k-a[n-1]-1;
    start.push_front(0);
    for(int i=1;i<n+1;i++) start[i]+=start[i-1];
   // for(auto i:start) cout<<i<<" ";cout<<endl;
    while(q--)
    {
        long long l,r;cin>>l>>r;
        if(l==r){cout<<k-1<<"\n";continue;}
        long long ans=start[r-1]-start[l];
        ans+=k-a[r-1]-1;
        ans+=a[l+1]-1-1;
        cout<<ans<<"\n";
    }
}