n = int(input())
a = n // 1000
b = n // 100 % 10
c = n // 10 % 10
d = n % 10
print(b * 1000 + a * 100 + d * 10 + c)
/**************************************************************
	Problem: 1619
	User: lzk
	Language: Python
	Result: Accepted
	Time:82 ms
	Memory:34244 kb
****************************************************************/