#include #include #include #include using namespace std; struct seg { vector rt, lazy; int SZ; seg(int n) { SZ = 1; while(SZ < n) SZ *= 2; rt.resize(2*SZ); lazy.resize(2*SZ); } void apply(int idx, int v) { rt[idx] = max(rt[idx], v); if(idx < SZ) lazy[idx] = max(lazy[idx], v); } void upd(int lhs, int rhs, int v) { lhs += SZ; rhs += SZ; while(lhs <= rhs) { if(lhs%2) apply(lhs++, v); if(rhs%2==0) apply(rhs--, v); lhs /= 2; rhs /= 2; } } void prop() { for(int i = 1; i < SZ; i++) { if(lazy[i]) { apply(2*i, lazy[i]); apply(2*i+1, lazy[i]); } } } }; int main() { int td, sd; scanf("%d%d", &td, &sd); td *= 2; sd *= 2; seg maxh(sd / 2 + 1); for(int diag = 0; 3 * diag <= sd; diag++) { int lhs = diag; int reach = (sd - 3 * diag) / 2; maxh.upd(lhs, lhs + reach, 2 * lhs + reach); } maxh.prop(); int64_t tot = 0; int64_t good = 0; for(int i = 0; i < sd/2+1; i++) { int h = maxh.rt[i + maxh.SZ] - i; tot += 2 * h + 1; if(i > 0) tot += 2 * h + 1; } for(int x = -min(sd, td)/2; x <= min(sd, td)/2; x++) { int maxcan = min(maxh.rt[abs(x) + maxh.SZ] - abs(x), (td-abs(2*x)) / 2); good += 2 * maxcan + 1; } int64_t f = gcd(tot, good); tot /= f; good /= f; if(tot == 1) printf("1\n"); else printf("%lld/%lld\n", good, tot); }