#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  long long int base = 1;
  long long int sum = (10 * pow(16, s.size() - 1));
  for (int i = s.size() - 1; i >= 1; i--) {
    sum += (s[i] - '0') * base;
    base *= 16;
  }
  cout << sum % 2;
}
