#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 50005;
struct N{int l,r,id;ll A,B;}q[maxn];
int s[maxn],a[maxn],ans,unit;
int Be[maxn];
int cmp(N c,N d){
return Be[c.l]==Be[d.l]? c.r<d.r: c.l<d.l;
}
int cmp2(N c,N d){
return c.id<d.id;
}
ll gcd(ll a,ll b){return b>0?gcd(b,a%b):a; }
void revise(int x,int add){ans-=s[a[x]]*s[a[x]]; s[a[x]]+=add; ans+=s[a[x]]*s[a[x]]; }
int main()
{
int n,m,l,r;
scanf("%d %d",&n,&m); unit = sqrt(n);
for(int i=1;i<=n;i++)scanf("%d",&a[i]),Be[i] = i/unit+1;
for(int i=1;i<=m;i++){
scanf("%d %d",&q[i].l,&q[i].r);q[i].id = i;
}
sort(q+1,q+m+1,cmp);
l = 1,r = 0;
for(int i=1;i<=m;i++){
while(l<q[i].l)revise(l,-1),l++;
while(l>q[i].l)revise(l-1,1),l--;
while(r<q[i].r)revise(r+1,1),r++;
while(r>q[i].r)revise(r,-1),r--;
if(l==r){q[i].A = 0,q[i].B = 1;continue;}
q[i].A = ans - (q[i].r-q[i].l+1);
q[i].B = 1ll*(q[i].r - q[i].l + 1)*(q[i].r - q[i].l);
ll gd = gcd(q[i].B,q[i].A); q[i].A/=gd; q[i].B/=gd;
}
sort(q+1,q+m+1,cmp2);
for(int i=1;i<=m;i++){
printf("%lld/%lld\n",q[i].A,q[i].B);
}
return 0;
}