#include <stdio.h>
using namespace std;
int main() {
    int code;
    scanf("%d", &code); 
    int thou = code / 1000;    
    int hund = (code / 100) % 10; 
    int ten = (code / 10) % 10;  
    int unit = code % 10;      
    int decoded = hund * 1000 + thou * 100 + unit * 10 + ten;
    
    printf("%d", decoded);
    return 0;
}
/**************************************************************
	Problem: 1619
	User: fuhoubin
	Language: C++
	Result: Accepted
	Time:9 ms
	Memory:1144 kb
****************************************************************/