#include <iostream>
using namespace std;

int main() {
    int encrypted;
    cin >> encrypted;
    int thousands = encrypted / 1000;
    int hundreds = (encrypted / 100) % 10;
    int tens = (encrypted / 10) % 10;
    int units = encrypted % 10;
    int decrypted = hundreds * 1000 + thousands * 100 + units * 10 + tens;
    cout << decrypted << endl;
    return 0;
}    
/**************************************************************
	Problem: 1619
	User: linmiaoling
	Language: C++
	Result: Accepted
	Time:8 ms
	Memory:2072 kb
****************************************************************/