def stern_brocot_tree_search(max_val): lower=(1,1) upper=(0,1) now=(1,1) while True: now=(lower[0]+upper[0],lower[1]+upper[1]) now_judge=judge_function(now) if now_judge: frm=lower to=upper else: frm=upper to=lower L=1 R=2 while judge_function((frm[0]+R*to[0],frm[1]+R*to[1]))==now_judge: L*=2 R*=2 if frm[0]+L*to[0]>max_val or frm[1]+L*to[1]>max_val: return to while L+1=m: ans+=(n-1)*n*(a//m)//2 a%=m if b>=m: ans+=n*(b//m) b%=m y_max=(a*n+b)//m x_max=(y_max*m-b) if y_max==0: return ans ans+=(n-(x_max+a-1)//a)*y_max n,m,a,b=y_max,a,m,(a-x_max%a)%a def mertens_table(n): if n==0: return [[0],[0]] b=10**4 small=[1]*(n//b+1) large=[1]*(b+1) small[0]=0 large[0]=0 prime=[1]*(n//b+1) for p in range(2,n//b+1): if not prime[p]: continue for j in range(p,n//b+1,p): if j>p: prime[j]=0 if j%(p*p)==0: small[j]=0 else: small[j]*=-1 for i in range(1,n//b): small[i+1]+=small[i] for i in range(b,0,-1): l=2 while l<=n//i: q=n//(i*l) r=n//(i*q)+1 if i*l<=b: large[i]-=large[i*l]*(r-l) else: large[i]-=small[n//(i*l)]*(r-l) l=r return small,large def range_g(L,R,P,Q): return floor_sum(R-L,Q,P,L*P) def count(n,P,Q): res=0 for L,R in QR: x=n//L if x=k for _ in range(1): n,k=map(int,input().split()) small,large=mertens_table(n) QR=quotient_range(n) c=count(n,n-1,n) if k==c+1: print('1/1') continue if k<=c: rev=False elif k<=2*c+1: rev=True k=2*c+2-k else: print(-1) continue ans=stern_brocot_tree_search(n) num,den=ans if rev: den,num=num,den print(str(num)+'/'+str(den))