#include<stdio.h>
#include<algorithm>
using namespace std;
#define nmax 100005
#define dim 263000
struct interval{long a, b, poz;};
long n, k, m, poz, val, prec[nmax], v[nmax], i, a, b, sumt, ult[nmax], j, rez[nmax];
long sum[dim];
interval q[nmax];
void update(long st, long dr, long nod)
{
long mjc=(st+dr)/2;
if (st==dr)
sum[nod]+=val;
else
{
if (poz<=mjc)
update(st,mjc,2*nod);
if (mjc+1<=poz)
update(mjc+1,dr,2*nod+1);
sum[nod]=sum[2*nod]+sum[2*nod+1];
}
}
void query(long st, long dr, long nod)
{
long mjc=(st+dr)/2;
if ((a<=st) && (dr<=b))
sumt+=sum[nod];
else
{
if (a<=mjc)
query(st,mjc,2*nod);
if (mjc+1<=b)
query(mjc+1,dr,2*nod+1);
}
}
void citire()
{
scanf("%ld %ld %ld",&n,&k,&m);
for (i=1;i<=n;i++)
{
scanf("%ld",&v[i]);
poz=i; val=v[i]; update(1,n,1);
prec[i]=ult[v[i]];
ult[v[i]]=i;
}
for (i=1;i<=m;i++)
{ scanf("%ld %ld",&q[i].a,&q[i].b); q[i].poz=i; }
}
bool cmp(interval a, interval b)
{
return (a.b<b.b);
}
void rezolvare()
{
for (i=1;i<=m;i++)
{
for (j=q[i-1].b+1;j<=q[i].b;j++)
{
poz=prec[j]; val=-v[j];
if (poz>0)
update(1,n,1);
}
a=q[i].a; b=q[i].b; sumt=0;
query(1,n,1);
rez[q[i].poz]=sumt;
//printf("%ld\n",sumt);
}
}
int main()
{
freopen("distincte.in","r",stdin);
freopen("distincte.out","w",stdout);
citire();
sort(q+1,q+1+m,cmp);
rezolvare();
for (i=1;i<=m;i++)
printf("%ld\n",rez[i]);
return 0;
}