Manao has a monitor. The screen of the monitor has horizontal to vertical length ratio a:b. Now he is going to watch a movie. The movie's frame has horizontal to vertical length ratio c:d. Manao adjusts the view in such a way that the movie preserves the original frame ratio, but also occupies as much space on the screen as possible and fits within it completely. Thus, he may have to zoom the movie in or out, but Manao will always change the frame proportionally in both dimensions.

Calculate the ratio of empty screen (the part of the screen not occupied by the movie) to the total screen size. Print the answer as an irreducible fraction p / q.


-----Input-----

A single line contains four space-separated integers a, b, c, d (1 ≤ a, b, c, d ≤ 1000).


-----Output-----

Print the answer to the problem as "p/q", where p is a non-negative integer, q is a positive integer and numbers p and q don't have a common divisor larger than 1.


-----Examples-----
Input
1 1 3 2

Output
1/3

Input
4 3 2 2

Output
1/4



-----Note-----

Sample 1. Manao's monitor has a square screen. The movie has 3:2 horizontal to vertical length ratio. Obviously, the movie occupies most of the screen if the width of the picture coincides with the width of the screen. In this case, only 2/3 of the monitor will project the movie in the horizontal dimension: [Image]

Sample 2. This time the monitor's width is 4/3 times larger than its height and the movie's frame is square. In this case, the picture must take up the whole monitor in the vertical dimension and only 3/4 in the horizontal dimension: [Image]

Source: codeforces | Difficulty: MEDIUM
Tags: Number theory

Mathematics

Greedy algorithms


Solutions:
import random
from fractions import gcd

def average(x):
	return sum(x) / len(x)

def shuffled(a):
	a = list(a)
	random.shuffle(a)
	return a

def read_ints():
	return [int(i) for i in input().split()]

def decrease(a):
	return [i - 1 for i in a]

def main():
	(a, b, c, d) = read_ints()
	if a / b < c / d:
		(a, b, c, d) = (b, a, d, c)
	(p, q) = (a * d - c * b, b * d)
	(s, t) = (p, a * d)
	print(s // gcd(s, t), t // gcd(s, t), sep='/')
main()


from math import gcd
(a, b, c, d) = map(int, input().split())
(p, q) = (-1, -1)
if d * a <= c * b:
	p = b * c - d * a
	q = b * c
else:
	p = a * d - b * c
	q = a * d
print('%d/%d' % (p / gcd(p, q), q / gcd(p, q)))


from fractions import Fraction as f
r = list(map(int, input().split()))
(a, b) = (r[0], r[1])
(c, d) = (r[2], r[3])
ans = min(abs(f(a * b - c * d * f(a, c) ** 2, a * b)), abs(f(a * b - c * d * f(b, d) ** 2, a * b)))
if ans == 0:
	print('0/1')
else:
	print(ans)


def nok(first, second):
	mx = max(first, second)
	final = mx
	while final % first != 0 or final % second != 0:
		final += mx
	return final

def nod(first, second):
	(_mx, _mn) = (max(first, second), min(first, second))
	while _mx % _mn != 0:
		(_mx, _mn) = (_mn, _mx % _mn)
	return _mn
ratios = [int(i) for i in input().split()]
if ratios[0] == ratios[1] and ratios[2] == ratios[3]:
	print('0/1')
	quit()
nk = nok(ratios[0], ratios[2])
ratios[1] *= nk // ratios[0]
ratios[0] *= nk // ratios[0]
ratios[3] *= nk // ratios[2]
ratios[2] *= nk // ratios[2]
(left, right) = (max(ratios[1], ratios[3]) - min(ratios[1], ratios[3]), max(ratios[1], ratios[3]))
print(str(left // nod(left, right)) + '/' + str(right // nod(left, right)))


import sys
inf = float('inf')
from math import ceil, floor, log, sqrt, factorial, pi, gcd

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(a, b, c, d) = get_ints()
if a * d < c * b:
	(a, b) = (b, a)
	(c, d) = (d, c)
a *= d
c *= b
p = a - c
q = a
g = gcd(p, q)
p //= g
q //= g
print(f'{p}/{q}')


import math
(n, k, l, m) = map(int, input().split())
k = k * l
m = m * n
a = abs(k - m)
b = max(k, m)
x = math.gcd(a, b)
a //= x
b //= x
print(str(a) + '/' + str(b))


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from math import *
(a, b, c, d) = f()
if a / c < b / d:
	x = a * b * c * c - a * a * c * d
	y = a * b * c * c
	g = gcd(x, y)
	print(str(x // g) + '/' + str(y // g))
elif a / c > b / d:
	x = a * b * d * d - c * b * d * b
	y = a * b * d * d
	g = gcd(x, y)
	print(str(x // g) + '/' + str(y // g))
else:
	print('0/1')


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def main():
	(a, b, c, d) = map(int, input().split())
	if d * a <= b * c:
		nom = a * d
		dem = b * c
		g = gcd(nom, dem)
		nom = nom // g
		dem = dem // g
		ans = (dem - nom, dem)
		if ans[0] != 0:
			print('{:d}/{:d}'.format(*ans))
		else:
			print('0/1')
	else:
		nom = b * c
		dem = a * d
		g = gcd(nom, dem)
		nom = nom // g
		dem = dem // g
		ans = (dem - nom, dem)
		if ans[0] != 0:
			print('{:d}/{:d}'.format(*ans))
		else:
			print('0/1')
main()


from math import gcd

def take_input(s):
	if s == 1:
		return int(input())
	return map(int, input().split())

def redc(a, b):
	c = gcd(a, b)
	return (a // c, b // c)
(a, b, c, d) = take_input(4)
(a, b) = redc(a, b)
(c, d) = redc(c, d)
if c != d:
	take = max(c, d)
	if take == c:
		itake = d
		over = a
		iover = b
	else:
		itake = c
		over = b
		iover = a
else:
	over = min(a, b)
	if over == a:
		iover = b
		take = c
		itake = d
	else:
		iover = a
		take = d
		itake = c
lcm = take * over // gcd(take, over)
mul_1 = lcm // over
mul_2 = lcm // take
(over, iover) = map(lambda x: x * mul_1, [over, iover])
(take, itake) = map(lambda x: x * mul_2, [take, itake])
a_1 = over * iover
a_2 = take * itake
if a_1 > a_2:
	(num, den) = redc(over * iover - take * itake, over * iover)
else:
	(num, den) = redc(a_2 - a_1, a_2)
print(str(num) + '/' + str(den))


def gcd(a, b):
	if a % b == 0:
		return b
	return gcd(b, a % b)
(a, b, c, d) = map(int, input().split())
a *= c * d
b *= c * d
if a / c * d <= b:
	a = b - a / c * d
	g = gcd(a, b)
	print(str(int(a / g)) + '/' + str(int(b / g)))
else:
	b = a - b / d * c
	g = gcd(a, b)
	print(str(int(b / g)) + '/' + str(int(a / g)))


import math
(a, b, c, d) = map(int, input().split())
l = a * d - b * c
den = a * d
if l < 0:
	l *= -1
	den = b * c
if l == 0:
	print('0/1')
else:
	print(l // math.gcd(l, den), end='')
	print('/', end='')
	print(den // math.gcd(l, den))


import math
(a, b, c, d) = map(int, input().split())
(x, y) = (a * d, b * c)
p = max(x, y) - min(x, y)
q = max(x, y)
z = math.gcd(p, q)
print(str(p // z) + '/' + str(q // z))


import math
(a, b, c, d) = map(int, input().split())
b = b * c
d = d * a
p = abs(b - d)
q = max(b, d)
x = math.gcd(p, q)
p //= x
q //= x
print(p, '/', q, sep='')


import sys
sys.setrecursionlimit(100000)
(a, b, c, d) = [int(x) for x in sys.stdin.readline().strip().split()]

def gcd(x, y):
	if x == 0:
		return y
	if y == 0:
		return x
	if x > y:
		x = x - y
		return gcd(x, y)
	else:
		y = y - x
		return gcd(x, y)
ca = gcd(c, a)
c = c // ca
a = a // ca
db = gcd(d, b)
b = b // db
d = d // db
ab = gcd(a, b)
a = a // ab
b = b // ab
cd = gcd(c, d)
c = c // cd
d = d // cd
if c * b <= d * a:
	nume = a * d - c * b
	deno = a * d
	if nume == 0:
		deno = 1
	print(str(nume) + '/' + str(deno))
elif c * b >= d * a:
	nume = c * b - a * d
	deno = c * b
	if nume == 0:
		deno = 1
	print(str(nume) + '/' + str(deno))


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
(a, b, c, d) = map(int, input().split())
e = a
f = e * d / c
s1 = 1000000
s2 = 1000000
if f <= b:
	s1 = a * (b * c - a * d) / c
	v = a * (b * c - a * d)
	n = c * a * b
	temp = gcd(v, n)
	t = str(v // temp) + '/' + str(n // temp)
f = b
e = f * c / d
if e <= a:
	s2 = b * (a * d - b * c) / d
	v = b * (a * d - b * c)
	n = d * a * b
	temp = gcd(v, n)
	s = str(v // temp) + '/' + str(n // temp)
if s1 < s2:
	print(t)
else:
	print(s)


import fractions
(a, b, c, d) = map(int, input().split())
f1 = fractions.Fraction(a, b)
f2 = fractions.Fraction(c, d)
l = fractions.Fraction(c, 1)
w = fractions.Fraction(d, 1)
x = fractions.Fraction(a * d, b)
y = fractions.Fraction(b * c, a)
ans = fractions.Fraction(0, 1)
a = fractions.Fraction(l - x, l)
b = fractions.Fraction(w - y, w)
if a < 0:
	ans = b
elif b < 0:
	ans = a
else:
	ans = min(a, b)
if ans.denominator == 1:
	print(str(ans) + '/' + str(1))
else:
	print(ans)


(a, b, c, d) = [int(x) for x in input().split()]
(total, empty) = (None, None)
if a / b == c / d:
	print('0/1')
elif a / b > c / d:
	total = a * d
	empty = a * d - b * c
else:
	total = b * c
	empty = b * c - a * d
if total != None:
	for i in reversed(range(1, int(empty) + 1)):
		if empty % i == 0 and total % i == 0:
			empty = empty / i
			total = total / i
	print('{}/{}'.format(int(empty), int(total)))


(a, b, c, d) = map(int, input().split())
if a / c > b / d:
	(a, b) = (b, a)
	(c, d) = (d, c)
x = a * c
y = a * d
n = x * y
d = a * b * c * c
n = d - n
from math import gcd
g = gcd(n, d)
n = n // g
d = d // g
print(str(n) + '/' + str(d))


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
(a, b, c, d) = [int(s) for s in input().split()]
if a / c < b / d:
	ch = abs(a * d - b * c)
	zn = c * b
else:
	ch = abs(b * c - a * d)
	zn = d * a
nod = gcd(ch, zn)
print(str(ch // nod) + '/' + str(zn // nod))


from sys import stdin, stdout
input = stdin.readline
import math, bisect

def gcd(a, b):
	if a == 0:
		return b
	if b == 0:
		return a
	return gcd(b, a % b)
(a, b, c, d) = map(int, input().split())
ac1 = gcd(a, c)
ac = a * c // ac1
a1 = ac
c1 = ac
b1 = ac // a * b
d1 = ac // c * d
bd2 = gcd(b, d)
bd = b * d // bd2
b2 = bd
d2 = bd
a2 = bd // b * a
c2 = bd // d * c
if b1 >= d1 and a2 >= c2:
	if (b1 - d1) // b1 < (a2 - c2) // a2:
		up = b1 - d1
		dw = b1
	else:
		up = a2 - c2
		dw = a2
elif b1 >= d1:
	up = b1 - d1
	dw = b1
else:
	up = a2 - c2
	dw = a2
g = gcd(up, dw)
print(up // g, end='/')
print(dw // g)


(a, b, c, d) = list(map(int, input().split()))
(actual, free) = (0, 0)
if a / b < c / d:
	free = b * c - a * d
	actual = b * c
elif a / b > c / d:
	free = a * d - b * c
	actual = a * d
else:
	print('0/1')
	exit()
import fractions
gcd = fractions.gcd(free, actual)
print(int(free / gcd), end='')
print('/', end='')
print(int(actual / gcd), end='')


def check(t):
	if x == int(x):
		return True
	else:
		return False

def gcd(x, y):
	if x % y == 0:
		return y
	else:
		return gcd(y, x % y)
(a, b, c, d) = map(int, input().split())
a *= max(c, d)
b *= max(c, d)
r = c / d
if a / b < r:
	x = b * c - a * d
	b = b * c
	u = gcd(x, b)
	p = str(int(x / u)) + '/' + str(int(b / u))
	print(p)
else:
	x = a * d - c * b
	a = a * d
	u = gcd(x, a)
	p = str(int(x / u)) + '/' + str(int(a / u))
	print(p)


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
(a, b, c, d) = map(int, input().strip().split())
(nr, dr) = (0, 0)
if a / b == c / d:
	print('0/1')
elif a / b > c / d:
	nr = a * d - b * c
	dr = a * d
	commDiv = gcd(nr, dr)
	print(str(nr // commDiv) + '/' + str(dr // commDiv))
else:
	nr = b * c - a * d
	dr = b * c
	commDiv = gcd(nr, dr)
	print(str(nr // commDiv) + '/' + str(dr // commDiv))


from fractions import Fraction
inp = input()
arr = inp.split(' ')
a = Fraction(int(arr[0]), 1)
b = Fraction(int(arr[1]), 1)
c = Fraction(int(arr[2]), 1)
d = Fraction(int(arr[3]), 1)
if d * a == c * b:
	ans = Fraction(0, 1)
elif d * a < c * b:
	ans = (b - d * (a / c)) / b
else:
	ans = (a - c * (b / d)) / a
print(ans.numerator, end='')
print('/', end='')
print(ans.denominator)


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
(x, y) = (a * d, b * c)
z = Fraction(max(x, y) - min(x, y), max(x, y))
if float(z) == 0:
	print('0/1')
else:
	print(z)


import math
(a, b, c, d) = list(map(int, input().split()))
if c / d > a / b:
	p = b * c - a * d
	q = b * c
else:
	p = a * d - b * c
	q = a * d
for i in range(2, p + 1):
	if p % i == 0 and q % i == 0:
		while p % i == 0 and q % i == 0:
			p = p // i
			q = q // i
if p == 0:
	q = 1
print(str(p) + '/' + str(q))


(a, b, c, d) = [int(x) for x in input().split()]
if b / a > d / c:
	u = b * c - a * d
	v = b * c
else:
	u = a * d - b * c
	v = a * d
for i in range(2, min(u, v) + 1):
	while u % i == 0 and v % i == 0:
		u = u // i
		v = v // i
if u == 0:
	print('0/1')
else:
	print(str(u) + '/' + str(v))


import sys
from math import gcd
input = lambda : sys.stdin.readline().strip('\r\n')
(a, b, c, d) = map(int, input().split())
(x, y) = (abs(a * d - b * c), max(a * d, b * c))
d = gcd(x, y)
print('{}/{}'.format(x // d, y // d))


from fractions import Fraction
from decimal import Decimal
(a, b, c, d) = map(int, input().split())
ans = max(Fraction((a * d - b * c) / (a * d)).limit_denominator(), Fraction((b * c - a * d) / (b * c)).limit_denominator())
if ans == 0:
	ans = '0/1'
print(ans)


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
p = a / b
q = c / d
if q > p:
	a = Fraction(b * c - a * d, b * c)
	print(a if a else '0/1')
else:
	a = Fraction(a * d - b * c, a * d)
	print(a if a else '0/1')


from math import gcd
(a, b, c, d) = map(int, input().split())
p = abs(a * d - b * c)
if a / b > c / d:
	q = a * d
elif a / b < c / d:
	q = b * c
else:
	print('0/1')
	exit()
print(str(int(p / gcd(p, q))) + '/' + str(int(q / gcd(p, q))))


def main():
	from fractions import Fraction
	(a, b, c, d) = map(int, input().split(' '))
	f = Fraction(a * d - b * c, a * d)
	if a * d <= b * c:
		f = Fraction(b * c - a * d, b * c)
	print('{}/{}'.format(f.numerator, f.denominator))
main()


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
(a, b, c, d) = map(int, input().split())
(p1, q1) = (a, c)
(p2, q2) = (b, d)
area1 = a * d * p1 / q1
area2 = c * (p2 / q2) * b
if p1 / q1 * d <= b and p2 / q2 * c <= a:
	if area1 > area2:
		(p, q) = (p1, q1)
	else:
		(p, q) = (p2, q2)
elif p1 / q1 * d <= b and (not p2 / q2 * c <= a):
	(p, q) = (p1, q1)
elif not p1 / q1 * d <= b and p2 / q2 * c <= a:
	(p, q) = (p2, q2)
if c % q == 0:
	c = c * p // q
else:
	d = d * p // q
remaining_n = q * a * b - c * d * p
remaining_d = q * a * b
s = '{}/{}'
print(s.format(remaining_n // gcd(remaining_n, remaining_d), remaining_d // gcd(remaining_n, remaining_d)))


def GCD(a, b):
	if b == 0:
		return a
	else:
		return GCD(b, a % b)
(n, k, l, m) = map(int, input().strip().split())
k = k * l
m = m * n
(a, b) = (int(abs(k - m)), int(max(k, m)))
x = GCD(a, b)
a //= x
b //= x
print(a, '/', b, sep='')


from fractions import Fraction
from sys import exit
(a, b, c, d) = map(float, input().split())
if a / b < c / d:
	sol = (b * c - a * d) / (b * c)
elif a / b > c / d:
	sol = (a * d - b * c) / (a * d)
else:
	print('0/1')
	exit(0)
print(Fraction(sol).limit_denominator())


from fractions import gcd

def Irreducible_Fraction(A, B):
	x = gcd(A, B)
	return [A // x, B // x]
(a, b, c, d) = map(int, input().split())
F = a / b
S = c / d
a / b < c / d
a / b == c / d
a / b > c / d
if a / b < c / d:
	stretching_factor = a / c
	New_horizontal = a
	New_vertical = a * d
	New_Movie_Area = int(New_horizontal * New_vertical)
	Screen_Area = int(a * b * c)
	Empty_Area = Screen_Area - New_Movie_Area
	desired_ratio = Irreducible_Fraction(Empty_Area, Screen_Area)
	nominator = desired_ratio[0]
	denominator = desired_ratio[1]
	print(nominator, end='/')
	print(denominator)
elif a / b == c / d:
	print('0/1')
else:
	stretching_factor = b / d
	New_vertical = b
	New_horizontal = b * c
	New_Movie_Area = int(New_horizontal * New_vertical)
	Screen_Area = int(a * b * d)
	Empty_Area = Screen_Area - New_Movie_Area
	desired_ratio = Irreducible_Fraction(Empty_Area, Screen_Area)
	nominator = desired_ratio[0]
	denominator = desired_ratio[1]
	print(nominator, end='/')
	print(denominator)


import sys
from math import sqrt
from fractions import Fraction
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
(a, b, c, d) = invr()
newW = c * b / d
newH = d * a / c
res = '{}/{}'.format(0, 1)
if newW < a:
	res = str(Fraction((a - newW) / a).limit_denominator())
elif newH < b:
	res = str(Fraction((b - newH) / b).limit_denominator())
print(res)


from fractions import Fraction
from math import gcd
(a, b, c, d) = map(int, input().split())
area = a * b
x_num = a * d
x_den = c
x = x_num / x_den
area1 = x * a
y_num = b * c
y_den = d
y = y_num / y_den
area2 = y * b
if area2 > area or y > a:
	area2 = 0
if area1 > area or x > b:
	area1 = 0
if area1 >= area2:
	left_num = b * x_den - x_num
	p_num = left_num * a
	p_den = x_den
	hm_num = p_num
	hm_den = p_den * area
	z = gcd(hm_num, hm_den)
	ans_num = hm_num // z
	ans_den = hm_den // z
	ans = str(ans_num) + '/' + str(ans_den)
if area1 <= area2:
	left_num = a * y_den - y_num
	p_num = left_num * b
	p_den = y_den
	hm_num = p_num
	hm_den = p_den * area
	z = gcd(hm_num, hm_den)
	ans_num = hm_num // z
	ans_den = hm_den // z
	ans = str(ans_num) + '/' + str(ans_den)
print(ans)


import fractions as f
import math
(a, b, c, d) = map(int, input().split(' '))
if a == b and c == d:
	print('0/1')
	quit()
elif a == b and c != d:
	new = f.Fraction(f.Fraction(b, 1) / f.Fraction(c, d))
	filmArea = f.Fraction(a, 1) * new
	screenArea = f.Fraction(a * a, 1)
elif a != b and c == d:
	filmArea = f.Fraction(min(a, b) ** 2, 1)
	screenArea = f.Fraction(a * b, 1)
elif a != b and c != d:
	if a / (c / d) <= b:
		new = f.Fraction(f.Fraction(a, 1) / f.Fraction(c, d))
		filmArea = f.Fraction(a, 1) * new
		screenArea = f.Fraction(a * b, 1)
	else:
		new = f.Fraction(b * c, d)
		filmArea = f.Fraction(b, 1) * new
		screenArea = f.Fraction(a * b, 1)
blackScreen = f.Fraction(1, 1) - filmArea / screenArea
print(blackScreen)


from math import gcd
from fractions import Fraction

def reduce_fraction(x, y):
	d = gcd(x, y)
	x = x // d
	y = y // d
	frac = Fraction(x / y).limit_denominator()
	print(frac)
(a, b, c, d) = map(int, input().split())
horizontal_space = b * c - a * d
vertical_space = a * d - b * c
flag = False
if horizontal_space == vertical_space:
	print('0/1')
	flag = True
elif horizontal_space > 0:
	numerator = horizontal_space
	denominator = b * c
elif vertical_space > 0:
	numerator = vertical_space
	denominator = a * d
if not flag:
	reduce_fraction(numerator, denominator)


from fractions import Fraction
(a, b, c, d) = list(map(int, input().split()))
if b * c / d <= a:
	k = Fraction(b, d)
else:
	k = Fraction(a, c)
ans = Fraction(1 - Fraction(k * c * k * d, a * b))
if str(ans) == '0':
	print('0/1')
else:
	print(str(ans))


def gdc(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a
vals = [int(x) for x in input().split()]
a = vals[0]
b = vals[1]
c = vals[2]
d = vals[3]
x = 0
y = 0
if a / b >= c / d:
	x = abs(d * a - c * b)
	y = d * a
else:
	x = abs(c * b - a * d)
	y = c * b
gdcXandY = gdc(max(x, y), min(x, y))
x /= gdcXandY
y /= gdcXandY
print(f'{int(x)}/{int(y)}')


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
x = a * d
y = b * c
(x, y) = (min(x, y), max(x, y))
ans = Fraction(abs(1 - Fraction(x / y).limit_denominator()))
if ans == 0:
	print(f'{ans}/1')
else:
	print(ans)


(sw, sh, fw, fh) = [int(x) for x in input().split()]
gcd = lambda a, b: b if a == 0 else gcd(b % a, a)
if sw * fh < fw * sh:
	fa = sw * sw * fh
	sa = sw * sh * fw
else:
	fa = sh * sh * fw
	sa = sw * sh * fh
d = gcd(sa - fa, sa)
print((sa - fa) // d, '/', sa // d, sep='')


import math
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())

def print_fract(p, q):
	g = math.gcd(p, q)
	p //= g
	q //= g
	print(str(p) + '/' + str(q))
(a, b, c, d) = invr()
if a >= c and b >= d or (a < c and b < d):
	fl = True
	area = 0
	if d * (a / c) <= b:
		area = d * a * a / c
	if c * (b / d) <= a:
		if area < c * b * b / d:
			fl = False
			p = a * d - b * c
			q = a * d
			print_fract(p, q)
	if fl:
		p = b * c - a * d
		q = b * c
		print_fract(p, q)
elif a >= c and b < d:
	p = a * d - b * c
	q = a * d
	print_fract(p, q)
elif a < c and b >= d:
	p = b * c - a * d
	q = b * c
	print_fract(p, q)


from fractions import Fraction as f
inps = list(map(int, input().split()))
(a, b, c, d) = (inps[0], inps[1], inps[2], inps[3])
if a / b < c / d:
	print(f(b * c - a * d, b * c))
elif a / b > c / d:
	print(f(a * d - b * c, a * d))
else:
	print('0/1')


def main():
	(a, b, c, d) = map(int, input().split())
	ans = '0/1'
	if a / b > c / d:
		ans = fractions.Fraction(d * a - b * c, d * a)
	elif a / b < c / d:
		ans = fractions.Fraction(c * b - a * d, c * b)
	print(ans)
import os
import sys
import fractions
import itertools
import math
from io import BytesIO, IOBase
BUFFER_SIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFFER_SIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFFER_SIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def gcd_euclid(den, num):
	if num == 0:
		return den
	return gcd_euclid(num, den % num)
(a, b, c, d) = input().split()
a = int(a)
b = int(b)
c = int(c)
d = int(d)
numerator = 0
denominator = 0
if d * (a / c) <= b:
	(a, b, c, d) = (a * c, b * c, c * a, d * a)
	numerator = b - d
	denominator = b
else:
	(a, b, c, d) = (a * d, b * d, c * b, d * b)
	numerator = a - c
	denominator = a
gcd = gcd_euclid(denominator, numerator)
print(str(numerator // gcd) + '/' + str(denominator // gcd))


import math
(a, b, c, d) = map(int, input().split())
a1 = 100
c1 = 100
b1 = [b * 100, a]
d1 = [d * 100, c]
x = math.gcd(b1[0], b1[1])
y = math.gcd(d1[0], d1[1])
b1[0] //= x
b1[1] //= x
d1[0] //= y
d1[1] //= y
if d1[0] == b1[0] and d1[1] == b1[1]:
	print('0/1')
elif d1[0] * b1[1] < d1[1] * b1[0]:
	x = b1[0] * d1[1] - d1[0] * b1[1]
	y = b1[1] * d1[1]
	num = x * b1[1]
	deno = y * b1[0]
	p = math.gcd(num, deno)
	num //= p
	deno //= p
	print(str(num) + '/' + str(deno))
else:
	b2 = 100
	d2 = 100
	a2 = [a * 100, b]
	c2 = [c * 100, d]
	x = math.gcd(a2[0], a2[1])
	y = math.gcd(c2[0], c2[1])
	a2[0] //= x
	a2[1] //= x
	c2[0] //= y
	c2[1] //= y
	x = a2[0] * c2[1] - c2[0] * a2[1]
	y = a2[1] * c2[1]
	num = x * a2[1]
	deno = y * a2[0]
	p = math.gcd(num, deno)
	num //= p
	deno //= p
	print(str(num) + '/' + str(deno))


def hcf(a, b):
	if b == 0:
		return a
	else:
		return hcf(b, a % b)
(a, b, c, d) = map(int, input().split())
b *= c
d *= a
e = abs(b - d)
f = max(b, d)
g = hcf(e, f)
e //= g
f //= g
print(e, '/', f, sep='')


def main():
	from math import gcd
	(a, b, c, d) = map(int, input().split())
	a *= d
	b *= c
	if a > b:
		(a, b) = (b, a)
	c = gcd(a, b)
	print('/'.join(map(str, ((b - a) // c, b // c))))
main()


import math
(a, b, c, d) = map(int, input().split())
if d * a / c <= b:
	num = a * b * c - a * a * d
	den = a * b * c
else:
	num = b * a * d - c * b * b
	den = a * b * d
g = math.gcd(num, den)
print(str(num // g) + '/' + str(den // g))


def inp(n):
	if n == 1:
		return map(int, stdin.readline().split())
	elif n == 2:
		return map(float, stdin.readline().split())
	else:
		return map(str, stdin.readline().split())
from sys import stdin
from fractions import Fraction
from math import gcd
(a, b, c, d) = inp(1)
if c <= a:
	(area2, area1) = (a * b, a * (d * (a / c)))
	(ma, mi) = (max(area1, area2), min(area2, area1))
else:
	(area2, area1) = (c * d, c * (b * (c / a)))
	(ma, mi) = (max(area1, area2), min(area2, area1))
ans = (Fraction(str(mi)) / Fraction(str(ma))).limit_denominator()
if ans != 1:
	print(1 - ans)
else:
	print('0/1')


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
ans = Fraction(abs(a * d - c * b) / max(a * d, b * c)).limit_denominator()
print('0/1' if not ans else ans)


from fractions import gcd

def socr(a, b):
	tmp = gcd(a, b)
	return (a // tmp, b // tmp)
(a, b, c, d) = list(map(int, input().split()))
ans = socr(a * d - b * c, a * d)
(a, b) = (b, a)
(c, d) = (d, c)
ans = socr(a * d - b * c, a * d) if ans[0] < 0 or ans[1] < 0 else ans
print(str(int(ans[0])) + '/' + str(int(ans[1])))


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
if c / a > d / b:
	d = d * (a / c)
	c = a
	k = b - d
	e = k / b
elif c / a < d / b:
	c = c * (b / d)
	d = b
	k = a - c
	e = k / a
else:
	print('0/1')
	exit()
print(Fraction(e).limit_denominator())


import sys
(a, b, c, d) = [int(x) for x in input().split()]

def find(a, b):
	if b == 0:
		return a
	return find(b, a % b)
p = c * d
a = a * p
b = b * p
k1 = a // c
k2 = b // d
if k1 == k2:
	print('0/1')
	sys.exit()
k = min(k1, k2)
if k * c == a:
	rem = b - k * d
	lcm = find(b, rem)
	rem = rem // lcm
	b = b // lcm
	print('{}/{}'.format(rem, b))
elif k * d == b:
	rem = a - k * c
	lcm = find(a, rem)
	rem = rem // lcm
	a = a // lcm
	print('{}/{}'.format(rem, a))


def gcd(a, b):
	while a != 0:
		(a, b) = (b % a, a)
	return b
(a, b, c, d) = map(int, input().split())
b *= c
d *= a
e = abs(b - d)
f = max(b, d)
g = gcd(e, f)
e //= g
f //= g
print(e, '/', f, sep='')


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase
from fractions import *

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]

def Lcm(a, b):
	return a * b // gcd(a, b)

def check(mon, fra):
	lcm = Lcm(mon[1], fra[1])
	mon = mon[0] * lcm // mon[1]
	fra = fra[0] * lcm // fra[1]
	if mon < fra:
		return inf
	return Fraction(mon - fra, mon)
(a, b, c, d) = value()
mon = [a, b]
fra = [c, d]
ans = min(check(mon, fra), check(mon[::-1], fra[::-1]))
if ans.numerator == 0:
	print('0/1')
else:
	print(ans)


import sys
import string
import math
from collections import defaultdict
from functools import lru_cache
from collections import Counter
from fractions import Fraction

def mi(s):
	return map(int, s.strip().split())

def lmi(s):
	return list(mi(s))

def tmi(s):
	return tuple(mi(s))

def mf(f, s):
	return map(f, s)

def lmf(f, s):
	return list(mf(f, s))

def js(lst):
	return ' '.join((str(d) for d in lst))

def line():
	return sys.stdin.readline().strip()

def linesp():
	return line().split()

def iline():
	return int(line())

def mat(n):
	matr = []
	for _ in range(n):
		matr.append(linesp())
	return matr

def mati(n):
	mat = []
	for _ in range(n):
		mat.append(lmi(line()))
	return mat

def pmat(mat):
	for row in mat:
		print(js(row))

def dist(x, y):
	return ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** 0.5

def fast_exp(x, n):
	if n == 0:
		return 1
	elif n % 2 == 1:
		return x * fast_exp(x, (n - 1) // 2) ** 2
	else:
		return fast_exp(x, n // 2) ** 2

def gcd(a, b):
	while b:
		a %= b
		(a, b) = (b, a)
	return a

def main(c, d, a, b):
	ans = []
	b2 = Fraction(b * c, a)
	if b2 <= Fraction(d, 1):
		ans.append(Fraction(b * c ** 2, a))
	a2 = Fraction(a * d, b)
	if a2 <= Fraction(c, 1):
		ans.append(Fraction(a * d ** 2, b))
	lowest = float('inf')
	for frac in ans:
		lowest = min(lowest, 1 - frac / Fraction(c * d, 1))
	if lowest == 0:
		print('0/1')
		return
	print(lowest / gcd(lowest.numerator, lowest.denominator))
arr = lmi(line())
main(*arr)


from math import gcd
(a, b, c, d) = map(int, input().split())
W = a * c / gcd(a, c)
H = W / a * b
w = W
h = W / c * d
if H - h < 0:
	H = b * d / gcd(b, d)
	W = H / b * a
	w = H / d * c
	h = H
if W == w:
	p = int(H - h)
	q = int(H)
	gcdd = int(gcd(p, q))
	p = int(p / gcdd)
	q = int(q / gcdd)
else:
	p = int(W - w)
	q = int(W)
	gcdd = int(gcd(p, q))
	p = int(p / gcdd)
	q = int(q / gcdd)
print(str(p) + '/' + str(q))


def mi():
	return map(int, input().split())
(a, b, c, d) = mi()
from math import gcd
if a / b < c / d:
	num = b * c - a * d
	den = b * c
elif a / b > c / d:
	num = a * d - b * c
	den = a * d
else:
	num = 0
	den = 1
nd = gcd(num, den)
print(num // nd, '/', den // nd, sep='')


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)
import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
S = lambda : list(map(str, input().split()))

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
(a, b, c, d) = I()
if a / b == c / d:
	print(str(0) + '/' + '1')
else:
	if a * d - c * b > 0:
		print(str(int((-(b * c) + a * d) / gcd(-(b * c) + a * d, a * d))) + '/' + str(int(a * d / gcd(-(b * c) + a * d, a * d))))
	if b * c - a * d > 0:
		print(str(int((b * c - a * d) / gcd(b * c - a * d, b * c))) + '/' + str(int(b * c / gcd(b * c - a * d, b * c))))


def gcd(a, b):
	while b > 0:
		(a, b) = (b, a % b)
	return a

def byt(lst):
	if lst[0] * lst[3] > lst[1] * lst[2]:
		tmp = lst[0]
		lst[0] = lst[1]
		lst[1] = tmp
		tmp = lst[2]
		lst[2] = lst[3]
		lst[3] = tmp
	m = (lst[1] * lst[2] - lst[0] * lst[3]) * lst[3]
	n = lst[1] * lst[2] * lst[3]
	g = gcd(m, n)
	return str(m // g) + '/' + str(n // g)
(a, b, c, d) = [int(i) for i in input().split()]
print(byt(list((a, b, c, d))))


(a, b, c, d) = map(int, input().split())
ad = a * d
bc = b * c
up = min(ad, bc)
down = max(ad, bc)
up = down - up
for i in range(down, 1, -1):
	if up % i == 0 and down % i == 0:
		up /= i
		down /= i
print(str(int(up)) + '/' + str(int(down)))


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
(a, b, c, d) = list(map(int, input().split()))
if a * d < c * b:
	hcf = gcd(b * c - a * d, b * c)
	print(str(int((b * c - a * d) / hcf)) + '/' + str(int(b * c / hcf)))
elif a * d > c * b:
	hcf = gcd(a * d - b * c, a * d)
	print(str(int((a * d - b * c) / hcf)) + '/' + str(int(a * d / hcf)))
else:
	print('0/1')


def gcd(a, b):
	if a == 0:
		return b
	else:
		return gcd(b % a, a)

def main():
	(a, b, c, d) = map(int, input().split())
	if a / b < c / d:
		print(f'{(b * c - a * d) // gcd(b * c - a * d, b * c)}/{b * c // gcd(b * c - a * d, b * c)}')
	elif a / b >= c / d:
		print(f'{(a * d - b * c) // gcd(a * d - b * c, a * d)}/{a * d // gcd(a * d - b * c, a * d)}')
main()


import math
(a, b, c, d) = map(int, input().split())
y = min(a / c, b / d)
if y == a / c:
	n = a * b * c ** 2 - c * d * a ** 2
	d = a * b * c ** 2
else:
	n = a * b * d ** 2 - c * d * b ** 2
	d = a * b * d ** 2
x = math.gcd(n, d)
print('%d/%d' % (n / x, d / x))


(a, b, c, d) = [int(i) for i in input().split()]
x = 0
if b * c < a * d:
	x = a
	a = b
	b = x
	x = d
	d = c
	c = x
q = b * c
p = q - a * d
for i in range(2, q + 1):
	while p % i == 0 and q % i == 0:
		p //= i
		q //= i
print(str(p) + '/' + str(q))


import math
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())

def print_fract(p, q):
	g = math.gcd(p, q)
	p //= g
	q //= g
	print(str(p) + '/' + str(q))
(a, b, c, d) = invr()
if d * (a / c) <= b:
	p = b * c - a * d
	q = b * c
	print_fract(p, q)
else:
	p = a * d - b * c
	q = a * d
	print_fract(p, q)


from math import gcd
(a, b, c, d) = map(int, input().split())
if a / b > c / d:
	a *= d
	c *= b
	print((a - c) // gcd(a - c, a), a // gcd(a - c, a), sep='/')
else:
	c *= b
	a *= d
	print((c - a) // gcd(c - a, c), c // gcd(c - a, c), sep='/')


from math import gcd

def lcm(x, y):
	return x * y // gcd(x, y)

def solve(a, b, c, d):
	k1 = lcm(a, c) // a
	k2 = lcm(a, c) // c
	a *= k1
	b *= k1
	c *= k2
	d *= k2
	hi = a * b - c * d
	lo = a * b
	if d <= b:
		return (hi // gcd(hi, lo), lo // gcd(hi, lo))
	else:
		return None
(a, b, c, d) = map(int, input().split())
v = solve(a, b, c, d)
h = solve(b, a, d, c)
if v is not None and h is not None:
	print('0/1')
elif v is not None:
	print('{}/{}'.format(v[0], v[1]))
else:
	print('{}/{}'.format(h[0], h[1]))


(a, b, c, d) = map(int, input().split())

def gcd(a, b):
	if b > a:
		return gcd(b, a)
	elif not a % b:
		return b
	else:
		return gcd(b, a % b)
if a / c > b / d:
	num = a * d - b * c
	den = a * d
else:
	num = b * c - a * d
	den = b * c
if num > 0:
	k = gcd(num, den)
	num = num // k
	den = den // k
else:
	den = 1
print(str(num) + '/' + str(den))


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
v = Fraction(abs(a * d - b * c), max(a * d, b * c))
print(v.numerator, '/', v.denominator, sep='')


from math import gcd

def lcm(a, b):
	return abs(a * b) // gcd(a, b)
(a, b, c, d) = map(int, input().split())
if a / c * d < b:
	ac = lcm(a, c)
	b *= ac // a
	d *= ac // c
	numerator = ac * b - ac * d
	denominator = ac * b
else:
	bd = lcm(b, d)
	a *= bd // b
	c *= bd // d
	numerator = bd * a - bd * c
	denominator = bd * a
divisor = gcd(numerator, denominator)
print(str(numerator // divisor) + '/' + str(denominator // divisor))


import math
from fractions import Fraction
(a, b, c, d) = map(int, input().split())
if c / d > a / b:
	conversion = Fraction(a, c)
	d *= conversion
	res = Fraction(b - d, b)
	if res == 0:
		print(str(res) + '/' + str(1))
	print(res)
else:
	conversion = Fraction(b, d)
	c *= conversion
	res = Fraction(a - c, a)
	if res == 0:
		print(str(res) + '/' + str(1))
	else:
		print(res)


def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
import math
from fractions import Fraction
(a, b, c, d) = mi()
if a / b < c / d:
	ans = b * c - a * d
	ans2 = b * c
else:
	ans = a * d - b * c
	ans2 = a * d
e = math.gcd(ans, ans2)
ans //= e
ans2 //= e
print(str(ans) + '/' + str(ans2))


from fractions import Fraction as f
(a, b, c, d) = map(int, input().split())
A = f(a, b)
B = f(c, d)
m = f(abs(d * a - b * c), max(d * a, b * c))
n = f(abs(a * d - c * b), max(a * d, c * b))
ans = min(m, n)
print(str(ans.numerator) + '/' + str(ans.denominator))


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
(m1, m2) = (99999999, 99999999)
if c * (b / a) >= d:
	temp = Fraction(c * b, a)
	x = temp - d
	m1 = Fraction(x * c, c * temp)
elif d * (a / b) >= c:
	temp = Fraction(d * a, b)
	x = temp - c
	m2 = Fraction(x * d, d * temp)
s = str(min(m1, m2))
g = s.split('/')
if len(g) == 2:
	print(s)
else:
	print(s + '/' + '1')


from fractions import gcd, Fraction, Decimal
(a, b, c, d) = map(int, input().split())
if a / b < c / d:
	N = b * c - a * d
	D = b * c
else:
	N = a * d - b * c
	D = a * d
x = gcd(N, D)
print(N // x, end='/')
print(D // x)


import math
(a, b, c, d) = [int(x) for x in input().split()]
if a * d / c > b:
	t1 = b * c
	t2 = a * d
	t3 = a * d - t1
	if t3 == 0:
		print('0/1')
	else:
		g1 = math.gcd(t3, t2)
		t3 //= g1
		t2 //= g1
		print(t3, '/', t2, sep='')
else:
	t1 = a * d
	t2 = b * c
	t3 = b * c - t1
	if t3 == 0:
		print('0/1')
	else:
		g1 = math.gcd(t3, t2)
		t3 //= g1
		t2 //= g1
		print(t3, '/', t2, sep='')


def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	if b == 0:
		return a
	return gcd(b, a % b)
(a, b, c, d) = map(int, input().split())
if a / c == b / d:
	print(0, end='')
	print('/', end='')
	print(1)
elif a / c > b / d:
	orignal_c = c
	num = a * d - c * b
	deno = a * d
	g = gcd(num, deno)
	num //= g
	deno //= g
	print(num, end='')
	print('/', end='')
	print(deno)
else:
	num = b * c - a * d
	deno = b * c
	g = gcd(num, deno)
	num //= g
	deno //= g
	print(num, end='')
	print('/', end='')
	print(deno)


import sys
from fractions import gcd
my_file = sys.stdin
line = [int(i) for i in my_file.readline().split()]
(a, b, c, d) = (line[0], line[1], line[2], line[3])
if a / b < c / d:
	N = b * c - a * d
	D = b * c
else:
	N = a * d - b * c
	D = a * d
dec = gcd(N, D)
print(N // dec, end='/')
print(D // dec)


from math import *
(x, y, a, b) = map(int, input().split())
if b / a * x > y:
	p = a * y * y
	q = b * x * y
else:
	p = b * x * x
	q = a * x * y
k = gcd(p, q)
p //= k
q //= k
p = q - p
print(str(p) + '/' + str(q))


def gcd(a, b):
	while a % b != 0:
		(a, b) = (b, a % b)
	return b
l = input().split(' ')
(a, b, c, d) = (int(l[0]), int(l[1]), int(l[2]), int(l[3]))
if a * d > b * c:
	p = a * d - b * c
	q = a * d
else:
	p = b * c - a * d
	q = b * c
e = gcd(p, q)
p //= e
q //= e
print(str(p) + '/' + str(q))


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
s = input().split(' ')
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
r1 = a / b
r2 = c / d
if r1 < r2:
	nom = b * c - d * a
	den = c * b
	g = gcd(nom, den)
	nom = nom // g
	den = den // g
	print(str(nom) + '/' + str(den))
else:
	nom = a * d - c * b
	den = d * a
	g = gcd(nom, den)
	nom = nom // g
	den = den // g
	print(str(nom) + '/' + str(den))


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
h = a * d / c
v = b * c / d
if v > a:
	v = 0
if h > b:
	h = 0
if h != 0:
	ans = str(Fraction((b - h) / b).limit_denominator())
else:
	ans = str(Fraction((a - v) / a).limit_denominator())
if ans == '0':
	print('0/1')
else:
	print(ans)


import math

def solve(a, b, c, d):
	if a == c and c == d:
		return '0/1'
	if a < c or b < d:
		x1 = c / a
		x2 = d / b
		if x1 > x2:
			num = int(b * c - d * a)
			den = c * b
		else:
			num = int(a * d - b * c)
			den = d * a
		i = 2
		while i <= num:
			if num % i == 0 and den % i == 0:
				num = num // i
				den = den // i
			else:
				i += 1
		if num == 0:
			den = 1
		return str(num) + '/' + str(den)
	x1 = a / c
	x2 = b / d
	if x2 < x1:
		if int(x2) == x2 or int(c * x2) == c * x2:
			num = int(a - x2 * c)
			den = a
		else:
			num = a * d - c * b
			den = a * d
	elif int(x1) == x1 or int(x1 * d) == x1 * d:
		num = int(b - x1 * d)
		den = b
	else:
		num = c * b - a * d
		den = c * b
	up = math.ceil(math.sqrt(num))
	i = 2
	while i <= num:
		if num % i == 0 and den % i == 0:
			num = num // i
			den = den // i
		else:
			i += 1
	if num == 0:
		den = 1
	return str(num) + '/' + str(den)
(a, b, c, d) = map(int, input().split())
print(solve(a, b, c, d))


from fractions import Fraction
while 1:
	try:
		(a, b, c, d) = map(int, input().split())
		if a / b < c / d:
			ratio = 0
		elif a / b == c / d:
			ratio = -1
		else:
			ratio = 1
		if ratio == 0:
			f = Fraction(b * c - a * d, b * c)
			print('%s' % f)
		elif ratio == 1:
			f = Fraction(a * d - b * c, a * d)
			print('%s' % f)
		else:
			print('0/1')
	except EOFError:
		break


import sys

def gcd(a, b):
	if b < 0.001:
		return a
	return gcd(b, a % b)
(a, b, c, d) = [int(i) for i in sys.stdin.readline().split()]
x = a / c
y = b / d
f = max(x if x * d <= b else -1, y if y * c <= a else -1)
common = gcd(f * f * c * d, a * b)
down = a * b / common
up = down - f * f * c * d / common
print('{}/{}'.format(int(up), int(down)))


(a, b, c, d) = [int(x) for x in input().split()]
result = max((b * c - a * d) * a * d, (a * d - b * c) * b * c)
(m, n) = (result, c * d * a * b)
while n != 0:
	(m, n) = (n, m % n)
print('{}/{}'.format(result // m, c * d * a * b // m))


from fractions import gcd

def main():
	(a, b, c, d) = map(int, input().split())
	(ratiom, ratios) = (a / b, c / d)
	if ratiom == ratios:
		(empty, total) = (0, 1)
	else:
		lcm = lambda x, y: x * y // gcd(x, y)
		if ratiom > ratios:
			width = lcm(a, c)
			total = width // c * d
			empty = total - width // a * b
		else:
			height = lcm(b, d)
			total = height // d * c
			empty = total - height // b * a
		g = gcd(total, empty)
		total //= g
		empty //= g
	print('{}/{}'.format(empty, total))
main()


import math
(a, b, c, d) = map(int, input().split())

def gcd(a, b):
	m = a * b
	while b:
		(a, b) = (b, a % b)
	return m // a
q = a
w = b
e = c
r = d
c1 = gcd(a, c)
mbf = c1 / a
b = b * mbf
mdf = c1 / c
d = d * mdf
up1 = b - d
do1 = b
ch1 = up1 / do1
a = q
b = w
c = e
d = r
c2 = gcd(b, d)
maf = c2 / b
a = a * maf
mdf = c2 / d
c = c * mdf
up2 = a - c
do2 = a
ch2 = up2 / do2
if ch1 < 0:
	ch1 = 999999999999999
if ch2 < 0:
	ch2 = 999999999999999
if up1 == 0:
	do1 = 1
if up2 == 0:
	do2 = 1
if ch1 < ch2:
	i = 2
	while i <= int(min(up1, do1)) + 1:
		if up1 % i == 0 and do1 % i == 0:
			up1 = up1 // i
			do1 = do1 // i
		else:
			i = i + 1
	print(int(up1), '/', int(do1), sep='')
else:
	i = 2
	while i <= int(min(up2, do2)) + 1:
		if up2 % i == 0 and do2 % i == 0:
			up2 = up2 // i
			do2 = do2 // i
		else:
			i = i + 1
	print(int(up2), '/', int(do2), sep='')


import math
(a, b, c, d) = map(int, input().split())
x = 0
y = 0
if a / b < c / d:
	x = b * c - a * d
	y = b * c
	z = math.gcd(x, y)
	x = x // z
	y = y // z
	print(str(x) + '/' + str(y))
elif a / b > c / d:
	x = a * d - b * c
	y = a * d
	z = math.gcd(x, y)
	x = x // z
	y = y // z
	print(str(x) + '/' + str(y))
else:
	print('0/1')


def gcd(a, b):
	while a != b:
		if a > b:
			a = a - b
		else:
			b = b - a
	print(m // a, '/', n // a, sep='')
(a, b, c, d) = map(int, input().split())
m = 1
n = 1
if a == b:
	if c == d:
		print(0, '/', 1, sep='')
	elif c > d:
		m = b * c - a * d
		n = c * b
		gcd(m, n)
	else:
		m = a * d - c * b
		n = a * d
		gcd(m, n)
elif c / d == a / b:
	print(0, '/', 1)
elif c / d > a / b:
	m = b * c - a * d
	n = c * b
	gcd(m, n)
else:
	m = a * d - c * b
	n = a * d
	gcd(m, n)


from fractions import Fraction, gcd
(a, b, c, d) = [int(x) for x in input().split()]
if a * d > b * c:
	num = a * d - b * c
	denom = a * d
else:
	num = b * c - a * d
	denom = b * c
div = gcd(num, denom)
print('%d/%d' % (num // div, denom // div))


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
(a, b, c, d) = map(int, input().split())
s = 0
if a / b == c / d:
	print('0/1')
elif a / b > c / d:
	s = a * d - b * c
	e = a * d
else:
	s = b * c - a * d
	e = b * c
if s:
	for i in range(2, 10 ** 6):
		if s % i == 0 and e % i == 0:
			s /= i
			e /= i
			while s % i == 0 and e % i == 0:
				s /= i
				e /= i
		if s == 1:
			break
	st = str(int(s)) + '/' + str(int(e))
	print(st)


from fractions import Fraction

def hcf(a, b):
	if b == 0:
		return a
	else:
		return hcf(b, a % b)
(a, b, c, d) = map(int, input().split())
ac = a / c
bd = b / d
if ac <= bd:
	mmin = a
	fmax = c
	num = a * b * fmax ** 2 - mmin ** 2 * c * d
	den = a * b * fmax ** 2
	h = hcf(num, den)
	print(int(num / h), end='/')
	print(int(den / h))
else:
	mmin = b
	fmax = d
	num = a * b * fmax ** 2 - mmin ** 2 * c * d
	den = a * b * fmax ** 2
	h = hcf(num, den)
	print(int(num / h), end='/')
	print(int(den / h))


def gcd(x, y):
	while x != 0:
		(x, y) = (y % x, x)
	return y

def main():
	(a, b, c, d) = [int(item) for item in input().split()]
	k1 = float(a) / float(b)
	k2 = float(c) / float(d)
	p = 0
	q = 1
	g = 0
	if k1 > k2:
		q = a * d
		p = q - b * c
		g = gcd(p, q)
	elif k1 < k2:
		q = b * c
		p = q - a * d
		g = gcd(p, q)
	if g > 1:
		p = int(p / g)
		q = int(q / g)
	print('{}/{}'.format(p, q))
main()


import fractions
(a, b, c, d) = list(map(int, input().split()))
p = max(a * d, b * c) - min(a * d, b * c)
q = max(a * d, b * c)
x = fractions.gcd(p, q)
print(str(p // x) + '/' + str(q // x))


import sys
import heapq
from math import *
from collections import defaultdict as dd
from collections import deque
from collections import Counter as c
from itertools import combinations as comb
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(var)

def l():
	return list(map(int, data().split()))

def sl():
	return list(map(str, data().split()))

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [[val for i in range(n)] for j in range(m)]

def first():
	global a, b, e, d
	(div, mul) = (e, a)
	(a1, a2) = (e * mul, a * mul)
	return (a * b * e - d * a * a, div)

def second():
	global a, b, e, d
	(div, mul) = (d, b)
	(a1, a2) = (e * mul, d * mul)
	return (d * a * b - e * b * b, div)
(a, b, e, d) = sp()
t1 = first()
t2 = second()
if t1[0] / t1[1] < t2[0] / t2[1]:
	(diff, area) = (int(t1[0]), int(a * b * t1[1]))
else:
	(diff, area) = (int(t2[0]), int(a * b * t2[1]))
if t2[0] / t2[1] < 0:
	(diff, area) = (int(t1[0]), int(a * b * t1[1]))
elif t1[0] / t1[1] < 0:
	(diff, area) = (int(t2[0]), int(a * b * t2[1]))
g = gcd(diff, area)
out(str(diff // g) + '/' + str(area // g))


from fractions import Fraction as frac
(a, b, p, q) = [int(x) for x in input().split()]
if a / b == p / q:
	print('0/1')
elif a / b < p / q:
	x = p * b - a * q
	y = p * b
	print(frac(x, y))
else:
	x = a * q - p * b
	y = a * q
	print(frac(x, y))


import math
from fractions import Fraction
(a, b, c, d) = map(int, input().split())
x = a * c // math.gcd(a, c)
y = b * d // math.gcd(b, d)
ans1 = (abs(b * (x // a) - d * (x // c)), max(b * x // a, d * x // c))
ans2 = (abs(a * (y // b) - c * (y // d)), max(a * y // b, c * y // d))
f1 = Fraction(ans1[0], ans1[1])
f2 = Fraction(ans2[0], ans2[1])
if f1 > f2:
	print(f1.numerator, end='')
	print('/', end='')
	print(f1.denominator)
else:
	print(f2.numerator, end='')
	print('/', end='')
	print(f2.denominator)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.setrecursionlimit(int(pow(10, 6)))
	sys.stdin = open('input.txt', 'r')
except:
	pass
from math import gcd
(a, b, c, d) = map(int, input().split())
area = a * b
x_num = a * d
x_den = c
x = x_num / x_den
area1 = x * a
y_num = b * c
y_den = d
y = y_num / y_den
area2 = y * b
if area2 > area or y > a:
	area2 = 0
if area1 > area or x > b:
	area1 = 0
if area1 >= area2:
	left_num = b * x_den - x_num
	p_num = left_num * a
	p_den = x_den
	hm_num = p_num
	hm_den = p_den * area
	z = gcd(hm_num, hm_den)
	ans_num = hm_num // z
	ans_den = hm_den // z
	ans = str(ans_num) + '/' + str(ans_den)
if area1 <= area2:
	left_num = a * y_den - y_num
	p_num = left_num * b
	p_den = y_den
	hm_num = p_num
	hm_den = p_den * area
	z = gcd(hm_num, hm_den)
	ans_num = hm_num // z
	ans_den = hm_den // z
	ans = str(ans_num) + '/' + str(ans_den)
print(ans)
endtime = time.time()


def gcd(a, b):
	while b:
		a %= b
		(a, b) = (b, a)
	return a
(a, b, c, d) = map(int, input().split())
if a / b < c / d:
	d1 = b * c - a * d
	e = b * c
	f = gcd(d1, e)
	print(str(d1 // f) + '/' + str(e // f))
elif a / b > c / d:
	d1 = a * d - b * c
	e = a * d
	f = gcd(d1, e)
	print(str(d1 // f) + '/' + str(e // f))
else:
	print('0/1')


def scan(type):
	return list(map(type, input().split()))

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)
(a, b, c, d) = scan(int)
num = den = ans = 100000000
k = lcm(a, c)
_a = a * k // a
_b = b * k // a
_c = c * k // c
_d = d * k // c
if _a >= _c and _b >= _d:
	_num = _a * _b - _c * _d
	_den = _a * _b
	_ans = _num / _den
	if _ans < ans:
		ans = _ans
		num = _num
		den = _den
k = lcm(b, d)
_a = a * k // b
_b = b * k // b
_c = c * k // d
_d = d * k // d
if _a >= _c and _b >= _d:
	_num = _a * _b - _c * _d
	_den = _a * _b
	_ans = _num / _den
	if _ans < ans:
		ans = _ans
		num = _num
		den = _den
k = gcd(num, den)
num /= k
den /= k
print('%d/%d' % (num, den))


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
(m1, m2, m3, m4) = (99999999, 99999999, 999999, 99999)
if c < d and c * (b / a) >= d:
	temp = Fraction(c * b, a)
	x = temp - d
	m1 = Fraction(x * c, c * temp)
elif d < c and d * (a / b) >= c:
	temp = Fraction(d * a, b)
	x = temp - c
	m2 = Fraction(x * d, d * temp)
elif c > d and c * (b / a) >= d:
	temp = Fraction(c * b, a)
	x = temp - d
	m3 = Fraction(x * c, c * temp)
else:
	temp = Fraction(d * a, b)
	x = temp - c
	m4 = Fraction(x * d, d * temp)
s = str(min(m1, m2, m3, m4))
g = s.split('/')
if len(g) == 2:
	print(s)
else:
	print(s + '/' + '1')


(a, b, c, d) = [int(j) for j in input().split()]

def gcd(a, b):
	c = a % b
	while c != 0:
		a = b
		b = c
		c = a % b
	return b
(ra, rb) = (0, 0)
if c * b >= a * d:
	ra = b * c - a * d
	rb = b * c
else:
	ra = a * d - b * c
	rb = a * d
cm = gcd(ra, rb)
print('{}/{}'.format(int(ra / cm), int(rb / cm)))


def gcd(a, b):
	if a % b == 0:
		return b
	return gcd(b, a % b)

def solve(a, b, p, q):
	c = a * p / gcd(a, p)
	b1 = b * c / a
	q1 = q * c / p
	if b1 >= q1:
		if b1 == q1:
			print('0/1')
		else:
			d = gcd(b1 - q1, b1)
			print(str(int((b1 - q1) / d)) + '/' + str(int(b1 / d)))
		return True
	return False

def __starting_point():
	(a, b, p, q) = map(int, input().split())
	if not solve(a, b, p, q):
		solve(b, a, q, p)
__starting_point()


from fractions import Fraction

def main():
	(a, b, c, d) = map(int, input().split())
	if Fraction(a, b) == Fraction(c, d):
		print('0/1')
		return
	w = (b - d * Fraction(a, c)) / b
	h = (a - c * Fraction(b, d)) / a
	if w < 0:
		w = float('infinity')
	if h < 0:
		h = float('infinity')
	ans = min(w, h)
	print(ans)
main()


(a, b, c, d) = list(map(int, input().split()))

def largest_div(n, m):
	while m > 0:
		rest = n % m
		n = m
		m = rest
	return n
if a / b == c / d:
	print('0/1')
else:
	if a / b > c / d:
		f_new_width = c * b
		f_upper = d * a - f_new_width
		f_lower = d * a
	else:
		f_new_height = d * a
		f_upper = c * b - f_new_height
		f_lower = c * b
	div = largest_div(f_upper, f_lower)
	print('/'.join((str(int(f_upper / div)), str(int(f_lower / div)))))


def g(e, f):
	while f != 0:
		(e, f) = (f, e % f)
	return e
(a, b, c, d) = map(int, input().split())
if a / b <= c / d:
	out1 = b * c - a * d
	out2 = b * c
	print(int(out1 / g(out1, out2)), '/', int(out2 / g(out1, out2)), sep='')
else:
	out1 = a * d - b * c
	out2 = a * d
	print(int(out1 / g(out1, out2)), '/', int(out2 / g(out1, out2)), sep='')


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
g = Fraction(b * c) / Fraction(a * d)
if g > 1:
	g = Fraction(1 / g)
l = 1 - g
if l == 0:
	print('0/1')
elif l == 1:
	print('1/1')
else:
	print(l)


from sys import stdin
from fractions import Fraction
(a, b, c, d) = map(int, input().split())
cd = Fraction(c, d)
ab = Fraction(a, b)
f1 = Fraction(1, 1)
if cd < ab:
	print(f1 - Fraction(c * b, a * d))
elif cd > ab:
	print(f1 - Fraction(a * d, c * b))
else:
	print('0/1')


import math as m
(a, b, c, d) = input().split(' ')
a = int(a)
b = int(b)
c = int(c)
d = int(d)
if a * d > b * c:
	h = m.gcd(a * d - b * c, a * d)
	k = int((a * d - b * c) / h)
	d = int(a * d / h)
	print(k, end='')
	print('/', end='')
	print(d, end='')
elif a * d <= b * c:
	h = m.gcd(c * b - a * d, b * c)
	k = int((c * b - a * d) / h)
	d = int(b * c / h)
	print(k, end='')
	print('/', end='')
	print(d, end='')


(a, b, c, d) = map(int, input().split())

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def solv(a, b):
	gc = gcd(a, b)
	print('%d/%d' % (a // gc, b // gc))
if a * d < b * c:
	solv(b * c - a * d, b * c)
else:
	solv(a * d - b * c, a * d)


def gcd(a, b):
	if a < 0.001:
		return b
	return gcd(b % a, a)
(a, b, c, d) = [int(x) for x in input().split()]
widthRatio = a / c
heightRatio = b / d
bestratio = min(widthRatio, heightRatio)
newImageHeight = bestratio * d
newImageWidth = bestratio * c
monitorSurface = a * b
imageSurface = newImageWidth * newImageHeight
g = gcd(imageSurface, monitorSurface)
imageSurface /= g
monitorSurface /= g
empty = monitorSurface - imageSurface
print(f'{int(empty)}/{int(monitorSurface)}')


3
import sys
from fractions import Fraction
(a, b, c, d) = list(map(int, sys.stdin.readline().strip().split()))
d2 = Fraction(d * a, c)
ans = None
if d2 <= Fraction(b):
	ans = (Fraction(b) - d2) / Fraction(b)
else:
	c2 = Fraction(c * b, d)
	ans = (Fraction(a) - c2) / Fraction(a)
if ans.denominator == 1:
	print('%d/1' % ans.numerator)
else:
	print(ans)


import sys

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

class Fraction:

	def __init__(self, p=0, q=1, reduced=True):
		if type(p) == int:
			self.p = p
			if type(q) == int:
				self.q = q
		elif type(p) == Fraction:
			self.p = p.p
			self.q = p.q
		else:
			i = p.find(' ')
			if i == -1:
				i = p.find('/')
			if i == -1:
				self.p = int(p)
				self.q = 1
			else:
				self.p = int(p[:i])
				self.q = int(p[i + 1:])
		if reduced:
			self.reduce()

	def reduce(self):
		g = gcd(self.p, self.q)
		self.p //= g
		self.q //= g

	def __str__(self):
		if self.q == 1:
			return str(self.p)
		else:
			return str(self.p) + '/' + str(self.q)

	def __lt__(self, other):
		self.reduce()
		if type(other) == float or type(other) == int:
			return self.p < other * self.q
		else:
			other.reduce()
			return self.p * other.q < self.q * other.p

	def __le__(self, other):
		self.reduce()
		if type(other) == float or type(other) == int:
			return self.p <= other * self.q
		else:
			other.reduce()
			return self.p * other.q <= self.q * other.p

	def __gt__(self, other):
		self.reduce()
		if type(other) == float or type(other) == int:
			return self.p > other * self.q
		else:
			other.reduce()
			return self.p * other.q > self.q * other.p

	def __ge__(self, other):
		self.reduce()
		if type(other) == float or type(other) == int:
			return self.p >= other * self.q
		else:
			other.reduce()
			return self.p * other.q >= self.q * other.p

	def __eq__(self, other):
		self.reduce()
		if type(other) == float or type(other) == int:
			return self.p == other * self.q
		else:
			other.reduce()
			return self.p * other.q == self.q * other.p

	def __ne__(self, other):
		self.reduce()
		if type(other) == float or type(other) == int:
			return self.p != other * self.q
		else:
			other.reduce()
			return self.p * other.q != self.q * other.p

	def __mul__(self, other):
		self.reduce()
		if type(other) == int:
			return Fraction(self.p * other, self.q)
		elif type(other) == float:
			return self.p * other / self.q
		else:
			return Fraction(self.p * other.p, self.q * other.q)

	def __rmul__(self, other):
		self.reduce()
		if type(other) == int:
			return Fraction(self.p * other, self.q)
		elif type(other) == float:
			return self.p * other / self.q
		else:
			return Fraction(self.p * other.p, self.q * other.q)

	def __imul__(self, other):
		self = self * other
		return self

	def __truediv__(self, other):
		self.reduce()
		if type(other) == int:
			return Fraction(self.p, self.q * other)
		elif type(other) == float:
			return self.p / self.q / other
		else:
			return Fraction(self.p * other.q, self.q * other.p)

	def __rtruediv__(self, other):
		self.reduce()
		if type(other) == int:
			return Fraction(self.q * other, self.p)
		elif type(other) == float:
			return other * self.q / self.p
		else:
			return Fraction(self.q * other.p, self.p * other.q)

	def __itruediv__(self, other):
		self = self / other
		return self

	def __pow__(self, other):
		if type(other) == int:
			if other >= 0:
				return Fraction(self.p ** other, self.q ** other, False)
			else:
				return Fraction(self.q ** (-other), self.p ** (-other), False)
		elif type(other) == float:
			return (self.p / self.q) ** other
		else:
			return (self.p / self.q) ** (other.p / other.q)

	def __rpow__(self, other):
		if type(other) == int or type(other) == float:
			return other ** (self.p / self.q)
		else:
			return (other.p / other.q) ** (self.p / self.q)

	def __ipow__(self, other):
		self = self ** other
		return self

	def __add__(self, other):
		self.reduce()
		if type(other) == int:
			return Fraction(self.p + self.q * other, self.q)
		elif type(other) == float:
			return self.p / self.q + other
		else:
			return Fraction(self.p * other.q + self.q * other.p, self.q * other.q)

	def __radd__(self, other):
		self.reduce()
		if type(other) == int:
			return Fraction(self.p + self.q * other, self.q)
		elif type(other) == float:
			return self.p / self.q + other
		else:
			return Fraction(self.p * other.q + self.q * other.p, self.q * other.q)

	def __iadd__(self, other):
		self.reduce()
		self = self + other
		return self

	def __sub__(self, other):
		self.reduce()
		if type(other) == int:
			return Fraction(self.p - self.q * other, self.q)
		elif type(other) == float:
			return self.p / self.q - other
		else:
			return Fraction(self.p * other.q - self.q * other.p, self.q * other.q)

	def __rsub__(self, other):
		self.reduce()
		if type(other) == int:
			return Fraction(self.q * other - self.p, self.q)
		elif type(other) == float:
			return other - self.p / self.q
		else:
			return Fraction(self.q * other.p - self.p * other.q, self.q * other.q)

	def __pos__(self):
		return Fraction(+self.p, +self.q)

	def __neg__(self):
		return Fraction(-self.p, self.q)

	def __abs__(self):
		if self.p < 0:
			return -self
		else:
			return self

	def __int__(self):
		return self.p // self.q

	def __float__(self):
		return self.p / self.q

	def __round__(self, digits=0):
		return round(float(self), digits)
(a, b, c, d) = map(int, input().split())
product = a * c
B1 = b * c
B2 = a * d
if B1 > B2:
	(B1, B2) = (B2, B1)
ans = Fraction(B2 - B1, B2)
ans.reduce()
if ans != 0:
	print(abs(ans))
else:
	print('0/1')


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
ad = a * d
bc = b * c
if ad >= bc:
	f = Fraction(ad - bc, ad)
else:
	f = Fraction(bc - ad, bc)
print('{}/{}'.format(f.numerator, f.denominator))


import sys
input = sys.stdin.readline
read_tuple = lambda _type: map(_type, input().split(' '))
from fractions import Fraction as frac

def solve():
	(a, b, c, d) = read_tuple(int)
	S_monitor = a * b
	S1 = b * frac(c * b, d)
	S2 = a * frac(d * a, c)
	(ans1, ans2) = ((S_monitor - S1) / S_monitor, (S_monitor - S2) / S_monitor)
	ans = None
	if ans1 < 0:
		ans = ans2
	elif ans2 < 0:
		ans = ans1
	else:
		ans = min(ans1, ans2)
	if ans:
		print(ans)
	else:
		print('0/1')
solve()


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
z1 = Fraction(Fraction(a, b), Fraction(c, d))
z2 = Fraction(Fraction(c, d), Fraction(a, b))
if Fraction(1, 1) - z1 == 0:
	print('0/1')
else:
	x = Fraction(1, 1) - z1
	if x > 0 and x < 1:
		print(x)
	else:
		print(Fraction(1, 1) - z2)


(a, b, c, d) = [int(x) for x in input().split(' ')]
if a / b < c / d:
	x = b * c - a * d
	y = b * c
	for i in range(2, min(x, y) + 1):
		while x % i == 0 and y % i == 0:
			x //= i
			y //= i
	print(x, '/', y, sep='')
elif a / b > c / d:
	x = a * d - b * c
	y = a * d
	for i in range(2, min(x, y) + 1):
		while x % i == 0 and y % i == 0:
			x //= i
			y //= i
	print(x, '/', y, sep='')
else:
	print('0/1')


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
if a / c <= b / d:
	res = Fraction(b * c - a * d, b * c)
else:
	res = Fraction(a * d - b * c, a * d)
print('{0}/{1}'.format(res.numerator, res.denominator))


import math

def possible_check(a, b, c, d):
	if a >= c and b >= d:
		return 1
	else:
		return 0

def find_common_divisor(a, b):
	if a == 0:
		return (0, 1)
	gcd = math.gcd(a, b)
	return (a // gcd, b // gcd)
(a, b, c, d) = map(int, input().split())
mul1 = a
div1 = c
mul2 = b
div2 = d
ans = 100000000
flag = 0
if possible_check(a, b, a, d * mul1 / div1):
	area = 1 - d * mul1 / (div1 * b)
	if area < ans:
		ans = area
		flag = 1
if possible_check(a, b, c * mul2 / div2, b):
	area = 1 - c * mul2 / (div2 * a)
	if area < ans:
		ans = area
		flag = 2
if flag == 1:
	(num, demo) = find_common_divisor(div1 * b - d * mul1, div1 * b)
	print(num, '/', demo, sep='')
else:
	(num, demo) = find_common_divisor(div2 * a - c * mul2, div2 * a)
	print(num, '/', demo, sep='')


import math
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
IN = lambda : input()

def s(a):
	print(''.join(list(map(str, a))))
(a, b, c, d) = M()
num = abs(b * c - a * d)
den = max(b * c, a * d)
x = math.gcd(num, den)
num = num // x
den = den // x
print(str(num) + '/' + str(den))


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
(a, b, c, d) = [int(x) for x in input().split()]
top = abs(a * d - b * c)
bottom = max(a * d, b * c)
if top == 0:
	print('0/1')
else:
	g = gcd(top, bottom)
	top //= g
	bottom //= g
	print(f'{top}/{bottom}')


(a, b, c, d) = map(int, input().split())

def gcd(a, b):
	if b == 0:
		return a
	if b == 1:
		return 1
	return gcd(b, a % b)
if c * b < a * d:
	(a, b) = (b, a)
	(c, d) = (d, c)
one = a * d
two = b * c
gc = gcd(two, one)
print((two - one) // gc, '/', two // gc, sep='')


(a, b, c, d) = map(int, input().split())
b *= c
d *= a
a = abs(b - d)
b = max(b, d)
import math
div = math.gcd(a, b)
print(a // div, '/', b // div, sep='')


from math import *

def GCD(a, b):
	while b:
		a %= b
		(a, b) = (b, a)
	return a
(a, b, c, d) = map(int, input().split())
(C, D) = (min(a * d, b * c), max(a * d, b * c))
C = D - C
G = GCD(C, D)
C = C // G
D = D // G
print(str(C) + '/' + str(D))


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
r = min(c / a, d / b)
a = a * r
b = b * r
if c * d - a * b == 0:
	print('0/1')
else:
	print(Fraction((c * d - a * b) / (c * d)).limit_denominator())


import math
NO_OF_CHARS = 256

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def loadinput():
	(a, b, c, d) = map(int, input().split())
	return (a, b, c, d)

def testval(str1, str2):
	if len(str1) < len(str2):
		return True
	for u in str2:
		if u not in str1:
			return True
(a, b, c, d) = loadinput()
x1 = b * c - d * a
x2 = a * d - c * b
if a / b < c / d:
	a1 = int(x1 / math.gcd(x1, b * c))
	a2 = int(b * c / math.gcd(x1, b * c))
	print(a1, '/', a2, sep='')
elif c / d < a / b:
	print(int(x2 / math.gcd(x2, a * d)), '/', int(a * d / math.gcd(x2, a * d)), sep='')
else:
	print(0, '/', 1, sep='')


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
if a / b == c / d:
	print('0/1')
elif a / b < c / d:
	r1 = (b * c - a * d) / (b * c)
	print(Fraction(r1).limit_denominator())
elif a / b > c / d:
	r = (a * d - b * c) / (a * d)
	print(Fraction(r).limit_denominator())


import sys as system

def gcd(x, y):
	if not y:
		return x
	return gcd(y, x % y)
(a, b, c, d) = map(int, input().split())
nod = gcd(b, d)
nok = b * d // nod
mn1 = nok // b
mn2 = nok // d
a *= mn1
b *= mn1
c *= mn2
d *= mn2
if a == c:
	print(str(int(0)) + '/' + str(int(1)))
	system.exit(0)
p = int(0)
q = int(0)
if a > c:
	p = a - c
	q = a
else:
	nod = gcd(a, c)
	nok = a * c // nod
	mn1 = nok // a
	mn2 = nok // c
	a *= mn1
	b *= mn1
	c *= mn2
	d *= mn2
	p = b - d
	q = b
nod = gcd(p, q)
p //= nod
q //= nod
print(str(int(p)) + '/' + str(int(q)))


from fractions import gcd
(a, b, c, d) = map(int, input().split())
(ax, bx, cx, dx) = (a, b, c, d)
(a, b, c, d) = (a * d, b * d, c * b, d * b)
monitor = a * b
film = c * d
negru = monitor - film
(monitor, negru) = (monitor // gcd(monitor, negru), negru // gcd(monitor, negru))
ans1 = (negru, monitor)
(a, b, c, d) = (bx, ax, dx, cx)
(a, b, c, d) = (a * d, b * d, c * b, d * b)
monitor = a * b
film = c * d
negru = monitor - film
(monitor, negru) = (monitor // gcd(monitor, negru), negru // gcd(monitor, negru))
ans2 = (negru, monitor)
if ans1[1] == 0 or ans1[0] / ans1[1] < 0:
	sol = ans2
elif ans2[1] == 0 or ans2[0] / ans2[1] < 0:
	sol = ans1
elif ans1[0] / ans1[1] < ans2[0] / ans2[1]:
	sol = ans1
else:
	sol = ans2
print('%i/%i' % sol)


import fractions

def solve(a, b, c, d):
	if a * d == b * c:
		return '0/1'
	elif a / c > b / d:
		return str(fractions.Fraction(a * d - c * b, a * d))
	else:
		return str(fractions.Fraction(c * b - a * d, c * b))

def test():
	assert solve(1, 1, 3, 2) == '1/3'
	assert solve(4, 3, 2, 2) == '1/4'
	assert solve(1, 1, 1, 1) == '0/1'
	print('test passes')
(a, b, c, d) = tuple(map(int, input().split()))
print(solve(a, b, c, d))


(a, b, c, d) = map(int, input().split())

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
x = a * d
y = b * c
g = gcd(x, y)
x //= g
y //= g
print(str(abs(x - y)), end='')
print('/', end='')
print(max(x, y))


import math
import sys
(a, b, c, d) = list(map(int, input().split()))
if a * d < c * b:
	t = math.gcd(b * c - a * d, b * c)
	print((b * c - a * d) // t, '/', b * c // t, sep='')
else:
	t = math.gcd(a * d - b * c, a * d)
	print((a * d - b * c) // t, '/', a * d // t, sep='')


from fractions import Fraction
(a, b, c, d) = map(int, input().split())
k = min(Fraction(a, c), Fraction(b, d))
A1 = a * b
A2 = c * d
A2 = A2 * k ** 2
print(f'{Fraction(A1 - A2, A1).numerator}/{Fraction(A1 - A2, A1).denominator}')


(a, b, c, d) = map(int, input().split())
x1 = a * d - c * b
x2 = b * c - d * a
if x1 > 0:
	ma = x1
	f = a * d
else:
	ma = x2
	f = b * c
q = ma
for i in range(ma, 1, -1):
	if q % i == 0 and f % i == 0:
		f //= i
		q //= i
		break
if q == 0:
	f = 1
print('%d/%d' % (q, f))


from math import gcd
(a, b, c, d) = map(int, input().split())
xp = 0
xq = 0
if a / c < b / d:
	xp = a
	xq = c
else:
	xp = b
	xq = d
num = a * b * xq * xq - c * d * xp * xp
den = a * b * xq * xq
g = gcd(num, den)
print(str(num // g) + '/' + str(den // g))


def gcd(a, b):
	c = a % b
	return gcd(b, c) if c else b
(a, b, c, d) = map(int, input().split())
if a * d < b * c:
	(a, b, c, d) = (b, a, d, c)
p = a * d - b * c
q = d * a
t = gcd(p, q)
print(str(p // t) + '/' + str(q // t))


from fractions import Fraction as f
(a, b, c, d) = map(int, input().split())
if f(a, b) < f(c / d):
	print(f(b - a * f(d, c), b))
elif f(a, b) > f(c / d):
	print(f(a - c * f(b, d), a))
else:
	print('0/1')


from collections import Counter

def factorize(x):
	fs = Counter()
	p = 2
	while p * p <= x:
		while x % p == 0:
			x //= p
			fs[p] += 1
		p += 1
	if x > 1:
		fs[x] += 1
	return fs

def reduce_fraction(n, d):
	if n == 0:
		return (0, 1)
	n_fs = factorize(n)
	d_fs = factorize(d)
	(rn, rd) = (1, 1)
	for (f, ct) in (n_fs - d_fs).items():
		rn *= f ** ct
	for (f, ct) in (d_fs - n_fs).items():
		rd *= f ** ct
	return (rn, rd)

def solve(a, b, c, d):
	if d * a <= b * c:
		num = b * c - a * d
		den = b * c
	else:
		num = a * d - b * c
		den = a * d
	return reduce_fraction(num, den)
(a, b, c, d) = map(int, input().split())
res = solve(a, b, c, d)
print(f'{res[0]}/{res[1]}')


from fractions import gcd
(a, b, c, d) = map(int, input().split())
if a * d > c * b:
	ans = a * d - c * b
	land = a * d
else:
	ans = b * c - d * a
	land = b * c
m = gcd(ans, land)
bans = str(ans // m) + '/' + str(land // m)
print(bans)