#include <bits/stdc++.h>

typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
#define repr(i, n) for (ll i = n - 1; i >= 0; --i)
#define INF 10e7
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))
using namespace std;

void solve(void)
{
    string s;
    cin >> s;
    if (s.length() == 2)
    {
        cout << s << endl;
        return;
    }
    reverse(all(s));
    cout << s << endl;
}
int main(void)
{
    solve();
}
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>

using namespace std;
double condition = 0.0;

void func()
{
	int X;
	cin >> X;
	int Y, Z;
	Y = X / 500;
	Z = (X % 500) / 5;

	cout << 1000 * Y + Z * 5 << endl;
}

int main() {
//	while(1)
	func();
	return 0;
}
