possible_combination=[]
find_flag=False
def find_combination(prefix,remain,target):
global possible_combination
global find_flag
if find_flag:
return
if sum(prefix)==target:
possible_combination.append(prefix[:])
find_flag=True
return
if remain==[]:
return
if sum(prefix)>target:
return
if not find_flag:
find_combination(prefix, remain[1:], target)
if not find_flag:
find_combination(prefix[:]+[remain[0]], remain[1:], target)
return
def find_yueshu(number):
pre_factor=[]
post_factor=[]
for i in range(1,int(number**0.5)+1):
if number%i==0:
pre_factor.append(i)
post_factor.append(number//i)
if number**0.5==int(number**0.5):
pre_factor=pre_factor[:-1]
post_factor=post_factor[::-1]
return pre_factor+post_factor
while True:
try:
raw_string=input()
string=raw_string.split('/')
fenzi=int(string[0])
fenmu=int(string[1])
if fenzi==1:
print(raw_string)
factor=2
while True:
possible_combination=[]
find_flag=False
big_fenmu=fenmu*factor
all_yueshu=find_yueshu(big_fenmu)
big_fenzi=fenzi*factor
find_combination([],all_yueshu,big_fenzi)
if find_flag:
all_res_fenzi=possible_combination[0]
res_output=[]
for sub_fenzi in all_res_fenzi:
res_output.append('1/'+str(big_fenmu//sub_fenzi))
print('+'.join(res_output))
break
else:
factor+=1
except:
break