a = list(input()[::-1])
while a[0] == '0':
	a.pop(0)
a2 = []
a5 = []
for i in range(len(a)):
	if a[i] == '2':
		a2.append(i)
for i in range(len(a)):
	if a[i] == '5':
		a5.append(i)
for i in a2:
	a[i] = '5'
for i in a5:
	a[i] = '2'
print(''.join(a))
