#include <bits/stdc++.h>
using namespace std;
const int NMAX = 100'000;
int B;
int a[NMAX];
int f[NMAX];
int ans[NMAX];
int sum = 0;
struct str {int l, r, p;} b[NMAX];
void add(int x) {
if(!f[a[x]])
sum += a[x];
f[a[x]] ++;
}
void rem(int x) {
f[a[x]] --;
if(!f[a[x]])
sum -= a[x];
}
int main() {
ifstream cin("distincte.in");
ofstream cout("distincte.out");
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, k, q; cin >> n >> k >> q;
B = sqrt(n);
for(int i = 0; i < n; cin >> a[i ++]);
for(int i = 0; i < q; i ++) {
auto &[l, r, p] = b[i];
cin >> l >> r; l --; r --;
p = i;
}
sort(b, b + q, [](str x, str y){
if(x.l / B == y.l / B)
return x.r < y.r;
return x.l < y.l;
});
int l = 0, r = -1;
for(int i = 0; i < q; i ++) {
auto &[ql, qr, p] = b[i];
while(r < qr) {
add(++ r);
}
while(l > ql) {
add(-- l);
}
while(r > qr) {
rem(r --);
}
while(l < ql) {
rem(l ++);
}
ans[p] = sum;
}
for(int i = 0; i < q; cout << ans[i ++] << '\n');
}