#include #include #include #include using namespace std; #define LL long long #define INF 0x7fffffff #define LINF 0x7fffffffffffffffL struct X{ int val, n; X(int val_, int n_){ val = val_; n = n_; } }; inline bool operator==(const X& lhs, const X& rhs){return lhs.val == rhs.val; } inline bool operator!=(const X& lhs, const X& rhs){return !operator==(lhs,rhs);} inline bool operator< (const X& lhs, const X& rhs){return lhs.val < rhs.val; } inline bool operator> (const X& lhs, const X& rhs){return operator< (rhs,lhs);} inline bool operator<=(const X& lhs, const X& rhs){return !operator> (lhs,rhs);} inline bool operator>=(const X& lhs, const X& rhs){return !operator< (lhs,rhs);} int N, S, T; set st; vector V; vector P; LL simulate(int k){ set ss(st); LL sum = 0; while(ss.size() > 1){ int pos = (sum+k)%S; set::iterator next = ss.lower_bound(X(pos,1)); if(next->val == INF) next = ss.begin(); X cpy = *next; ss.erase(next); if(cpy.n > 1) ss.insert(X(cpy.val, cpy.n-1)); if(pos <= cpy.val) sum += cpy.val - pos + T; else sum += cpy.val - pos + S + T; } return sum; } LL max(LL a, LL b){return a > b ? a : b;} LL min(LL a, LL b){return a > b ? b : a;} LL gcd(LL a, LL b){ if(b == 0) return a; else return gcd(b, a%b); } void simplify(LL num, LL denom){ LL g = gcd(num, denom); printf("%lld/%lld\n", num/g, denom/g); } int main(){ // freopen("input.txt","r",stdin); scanf("%d %d %d", &N, &S, &T); for(int i = 1 ; i <= N ; i ++){ int in; scanf("%d", &in); if(st.find(X(in,1)) == st.end()){ st.insert(X(in, 1)); }else{ int n2 = st.find(X(in,1))->n; st.erase(st.find(X(in,1))); st.insert(X(in, n2+1)); } } st.insert(X(INF, 1)); for(set::iterator it = st.begin() ; it != st.end() ; it ++){ if(it->val == INF) break; P.push_back(it->val); V.push_back(simulate(it->val)); } LL mn = LINF; for(int i = 0 ; i < P.size() ; i ++){ mn = min(mn, V[i]); } LL mx = -1; for(int i = 0 ; i < P.size()-1 ; i ++){ int L = P[i+1]-P[i]; mx = max(mx, V[i+1]+L-1); }mx = max(mx, V[0]+S+P[0]-P[P.size()-1]-1); LL total = 0; for(int i = 0 ; i < P.size()-1 ; i ++){ LL L = P[i+1]-P[i]; total += L*V[i+1] + (L-1)*L/2.; } LL L = S+P[0]-P[P.size()-1]; total += L*V[0] + (L-1)*L/2.; printf("%lld\n%lld\n", mn, mx); simplify(total, S); return 0; }