import sys
from numbers import Rational
from fractions import Fraction
def derive (p):
return [p[i] * i for i in range (1, len (p))]
def mult (p, q):
a = [0 for k in range (len (p) + len (q) - 1)]
for i in range (len (p)):
for j in range (len (q)):
a[i + j] += p[i] * q[j]
return a
def add (p, q):
a = [0 for k in range (max (len (p), len (q)))]
for i in range (len (p)):
a[i] += p[i]
for j in range (len (q)):
a[j] += q[j]
return a
C, D = [0, 1], [1, -1]
def next (p, k):
return mult (C, (add (mult ([k], p), mult (derive (p), D))))
a, b = map (int, sys.stdin.readline ().split ())
if b == 1:
sys.stdout.write ('infinity')
else:
p, q = C, D
for i in range (a):
p, q = next (p, i + 1), mult (q, D)
u = sum (Fraction (p[i], b ** i) for i in range (len (p)))
v = sum (Fraction (q[j], b ** j) for j in range (len (q)))
z = u / v
sys.stdout.write ('%d/%d\n' % (z.numerator, z.denominator))
aW1wb3J0IHN5cwpmcm9tIG51bWJlcnMgaW1wb3J0IFJhdGlvbmFsCmZyb20gZnJhY3Rpb25zIGltcG9ydCBGcmFjdGlvbgoKZGVmIGRlcml2ZSAocCk6CglyZXR1cm4gW3BbaV0gKiBpIGZvciBpIGluIHJhbmdlICgxLCBsZW4gKHApKV0KCmRlZiBtdWx0IChwLCBxKToKCWEgPSBbMCBmb3IgayBpbiByYW5nZSAobGVuIChwKSArIGxlbiAocSkgLSAxKV0KCWZvciBpIGluIHJhbmdlIChsZW4gKHApKToKCQlmb3IgaiBpbiByYW5nZSAobGVuIChxKSk6CgkJCWFbaSArIGpdICs9IHBbaV0gKiBxW2pdCglyZXR1cm4gYQoKZGVmIGFkZCAocCwgcSk6CglhID0gWzAgZm9yIGsgaW4gcmFuZ2UgKG1heCAobGVuIChwKSwgbGVuIChxKSkpXQoJZm9yIGkgaW4gcmFuZ2UgKGxlbiAocCkpOgoJCWFbaV0gKz0gcFtpXQoJZm9yIGogaW4gcmFuZ2UgKGxlbiAocSkpOgoJCWFbal0gKz0gcVtqXQoJcmV0dXJuIGEKCkMsIEQgPSBbMCw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