#include <bits/stdc++.h>
using namespace std;
int main() {
  int l;
  char hexdec[100];
  cin >> hexdec;
  l = strlen(hexdec) - 1;
  switch (hexdec[l]) {
    case '0':
      cout << "0";
      break;
    case '1':
      cout << "1";
      break;
    case '2':
      cout << "0";
      break;
    case '3':
      cout << "1";
      break;
    case '4':
      cout << "0";
      break;
    case '5':
      cout << "1";
      break;
    case '6':
      cout << "0";
      break;
    case '7':
      cout << "1";
      break;
    case '8':
      cout << "0";
      break;
    case '9':
      cout << "1";
      break;
    default:
      break;
  }
  return 0;
}
