Tattah is asleep if and only if Tattah is attending a lecture. This is a well-known formula among Tattah's colleagues.

On a Wednesday afternoon, Tattah was attending Professor HH's lecture. At 12:21, right before falling asleep, he was staring at the digital watch around Saher's wrist. He noticed that the digits on the clock were the same when read from both directions i.e. a palindrome.

In his sleep, he started dreaming about such rare moments of the day when the time displayed on a digital clock is a palindrome. As soon as he woke up, he felt destined to write a program that finds the next such moment.

However, he still hasn't mastered the skill of programming while sleeping, so your task is to help him.
The first and only line of the input starts with a string with the format "HH:MM" where "HH" is from "00" to "23" and "MM" is from "00" to "59". Both "HH" and "MM" have exactly two digits.
12:21
13:31
23:59
00:00
15:51
20:02
10:44
11:11
04:02
04:40
02:11
02:20
12:15
12:21
07:07
10:01
00:17
01:10
04:55
05:50
02:17
02:20
07:56
10:01
00:29
01:10
23:31
23:32
19:30
20:02
12:14
12:21
17:32
20:02
03:44
04:40
07:15
10:01
18:42
20:02
08:56
10:01
04:50
05:50
14:32
14:41
23:23
23:32
08:35
10:01
03:32
04:40
07:59
10:01
14:12
14:41
23:52
00:00
16:36
20:02
17:50
20:02
06:59
10:01
16:50
20:02
00:00
01:10
23:59
00:00
23:33
00:00
# Python3 implementation of the approach

# Function to return the required time
def getTime(s, n) :

	# Hours are stored in h as integer
	h = int(s[0 : 2])

	# Minutes are stored in m as integer
	m = int(s[3 : 5])

	# Reverse of h
	rev_h = (h % 10) * 10 + ((h % 100) - (h % 10)) // 10;

	# Reverse of h as a string
	rev_hs = str(rev_h)
	
	temp = ""
	res = ""
	
	if (h == 23 and m >= 32) :
		res = "-1"
	

	# If MM < reverse of (HH)
	elif (m < rev_h) :

		# 0 is added if HH < 10
		if (h < 10) :
			temp = "0"
			
		temp = temp + str(h)

		# 0 is added if rev_h < 10
		if (rev_h < 10) :
			res = res + temp + ":0" + rev_hs
		else :
			res = res + temp + ":" + rev_hs
	
	else :
		
		# Increment hours
		h += 1

		# Reverse of the hour after incrementing 1
		rev_h = (h % 10) * 10 + ((h % 100) - (h % 10)) //10;
		
		rev_hs = str(rev_h)

		# 0 is added if HH < 10
		if (h < 10) :
			temp = "0"
			
		temp = temp + str(h)

		# 0 is added if rev_h < 10
		if (rev_h < 10) :
			res = res + temp + ":0" + rev_hs
		else :
			res = res + temp + ":" + rev_hs
	
	return res



s = input()
n = len(s)

print(getTime(s, n))