#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a,b;
	cin>>n;
	a=n%1000;
	b=n/1000;
	if(a>b){
		cout<<a*1000+b;
	}else{
		cout<<b*1000+a;
	}
}
/**************************************************************
	Problem: 1631
	User: linzihang
	Language: C++
	Result: Accepted
	Time:7 ms
	Memory:2072 kb
****************************************************************/