#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=500100;
ll n, q, len, now;
ll a[N], cnt[N], belong[N], ans1[N], ans2[N];
struct node {
int l, r, id, b;
} e[N];
void add(int x) {
++cnt[a[x]];
now+=2*(cnt[a[x]]-1);
}
void del(int x) {
now-=2*(cnt[a[x]]-1);
--cnt[a[x]];
}
bool cmp(node a, node b) {
return (a.b ^ b.b) ? a.b < b.b : (a.b & 1 ? a.r < b.r : a.r > b.r);
}
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();return x*f;}
void write(ll x){if(x<0)putchar('-'),x=-x;if(x>9)write(x/10);putchar(x%10+'0');return;}
int main() {
n=read();q=read();
len = sqrt(n);
for(int i = 1; i <= n; ++i) a[i] = read();
for(int i = 1; i <= q; ++i) {
e[i].l = read(), e[i].r = read();
e[i].id = i;
e[i].b = ceil(e[i].l / len);
}
sort(e + 1, e + q + 1, cmp);
int l = 1, r = 0;
for(int i = 1; i <= q; ++i) {
int x = e[i].l, y = e[i].r;
while(l < x) del(l++);
while(l > x) add(--l);
while(r < y) add(++r);
while(r > y) del(r--);
ll fenmu=(ll)(y-x+1)*(y-x);//两个int相乘压到第一个变量里 ((ll)y-x+1)*(y-x) 同效
ll yueshu=__gcd(fenmu,now);
ans1[e[i].id]=now/yueshu;
ans2[e[i].id]=fenmu/yueshu;
}
for(int i = 1; i <= q; ++i){
write(ans1[i]);printf("/");write(ans2[i]);
puts("");
}
return 0;
}