1 #include<iostream>
2 #include<cstdlib>
3 #include<cstdio>
4 #include<cstring>
5 #include<queue>
6 #include<algorithm>
7 #include<cmath>
8 #include<map>
9 #include<vector>
10 #define N 100004
11 #define int long long
12 using namespace std;
13 int n,m;
14 struct no
15 {
16 int left,right,mid;
17 long long lazy;
18 long long data[5];
19 long long sum[5];
20 }node[N*4];
21 long long gcd(long long a,long long b)
22 {
23 if(b==0)return a;
24 return gcd(b,a%b);
25 }
26 void pushup(int x)
27 {
28 for(int i=1;i<=4;i++)
29 {
30 node[x].data[i]=node[x*2].data[i]+node[2*x+1].data[i];
31 node[x].sum[i]=node[x*2].sum[i]+node[2*x+1].sum[i];
32 }
33 }
34 void build(int left,int right,int x)
35 {
36 node[x].left=left,node[x].right=right;
37 if(left==right)
38 {
39 node[x].data[1]=left+1;
40 node[x].data[2]=left;
41 node[x].data[3]=1;
42 node[x].data[4]=left*(left+1);
43 return;
44 }
45 int mid=(left+right)>>1;
46 node[x].mid=mid;
47 build(left,mid,2*x);
48 build(mid+1,right,2*x+1);
49 pushup(x);
50 }
51 struct inf
52 {
53 long long a,b;
54 };
55 char b[50];
56 void pushdown(int x)
57 {
58 if(node[x].lazy)
59 {
60 node[2*x].lazy+=node[x].lazy;
61 node[x*2+1].lazy+=node[x].lazy;
62 for(int i=1;i<=4;i++)
63 {
64 node[2*x].sum[i]+=node[x].lazy*node[2*x].data[i];
65 node[2*x+1].sum[i]+=node[x].lazy*node[2*x+1].data[i];
66 }
67 node[x].lazy=0;
68 }
69 }
70 void add(int left,int right,int x,int z)
71 {
72 if(node[x].left==left&&node[x].right==right)
73 {
74 node[x].lazy+=z;
75 for(int i=1;i<=4;i++)
76 node[x].sum[i]+=node[x].data[i]*z;
77 return;
78 }
79 pushdown(x);
80 int mid=node[x].mid;
81 if(left>mid)
82 add(left,right,x*2+1,z);
83 else if(right<=mid)
84 add(left,right,2*x,z);
85 else
86 add(left,mid,x*2,z),add(mid+1,right,2*x+1,z);
87 pushup(x);
88 }
89 inf get(long long left,long long right,int x,long long l,long long r)
90 {
91 if(node[x].left==left&&node[x].right==right)
92 {
93 inf aa;
94 aa.a=node[x].sum[1]*r-l*r*node[x].sum[3];
95 aa.a-=node[x].sum[4];
96 aa.a+=l*node[x].sum[2];
97 aa.b=(r-l+1)*(r-l)/2;
98 long long t=gcd(aa.a,aa.b);
99 aa.a/=t;
100 aa.b/=t;
101 return aa;
102 }
103 pushdown(x);
104 int mid=node[x].mid;
105 if(left>mid)
106 return get(left,right,2*x+1,l,r);
107 else if(right<=mid)
108 return get(left,right,2*x,l,r);
109 else
110 {
111 inf aa=get(left,mid,2*x,l,r);
112 inf bb=get(mid+1,right,2*x+1,l,r);
113 if(aa.b==bb.b)
114 {
115 aa.a+=bb.a;
116 long long t=gcd(aa.a,aa.b);
117 if(t!=1)
118 aa.a/=t,aa.b/=t;
119 return aa;
120 }
121 else
122 {
123 long long tt=gcd(aa.b,bb.b);
124 long long c;
125 if(aa.b%tt==0)
126 {
127 c=aa.b/tt;
128 c*=bb.b;
129 }
130 else if(bb.b%tt==0)
131 {
132 c=bb.b/tt;
133 c*aa.b;
134 }
135 else
136 {
137 c=aa.b*bb.b/tt;
138 }
139 aa.a*=c/aa.b;
140 bb.a*=c/bb.b;
141 aa.a+=bb.a;
142 aa.b=c;
143 long long t=gcd(aa.a,aa.b);
144 if(t!=1)
145 aa.a/=t,aa.b/=t;
146 return aa;
147 }
148 }
149 }
150 signed main()
151 {
152 scanf("%lld%lld",&n,&m);
153 build(1,n-1,1);
154 while(m--)
155 {
156 scanf("%s",b);
157 if(b[0]==‘C‘)
158 {
159 int l,r,z;
160 scanf("%lld%lld%lld",&l,&r,&z);
161 add(l,r-1,1,z);
162 }
163 else
164 {
165 long long l,r;
166 scanf("%lld%lld",&l,&r);
167 inf tt=get(l,r-1,1,l,r);
168 printf("%lld/%lld\n",tt.a,tt.b);
169 }
170 }
171 return 0;
172 }