#define DEBUG

#include <iostream>
using namespace std;
int main()
{
    unsigned n;
    int a[33] = { 0 }, i = 0, s = 1;
    cin >> n;
    while (n > 0) {
        a[++i] = n % 2;
        //cout<<a[i];
        n /= 2;
    }
#ifdef DEBUG
    for (int j = 32; j >= 1; j--) {
        if (j % 4 == 0)
            cout << " ";
        cout << a[j];
    }
    cout << endl;
#endif // DEBUG

    for (int j = 1; j <= 16; j++) {
        n += a[j + 16] * s;
        s *= 2;
    }
    for (int j = 1; j <= 16; j++) {
        n += a[j] * s;
        s *= 2;
    }
    cout << n;
}