-----Input-----

The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.


-----Output-----

Output a single integer.


-----Examples-----
Input
A278832

Output
0

Input
A089956

Output
0

Input
A089957

Output
1

Input
A144045

Output
1

Source: codeforces | Difficulty: MEDIUM


Solutions:
s = input()
if int(s[-1]) % 2 == 0:
	print('0')
else:
	print('1')


n = input()
if int(n[-1]) % 2 == 0:
	print('0')
else:
	print('1')


asd = input()
res = int(asd, base=16)
if res % 2 == 0:
	print('0')
else:
	print('1')


print(int(input()[-1]) % 2)


def main():
	line = input()
	lastDigit = int(line[-1])
	print(lastDigit % 2)
main()


s = str(input())
s = s[1:]
t = int(s)
if t % 2 == 0:
	print(0)
else:
	print(1)


s = input()
n = len(s)
if int(s[n - 1]) % 2 == 0:
	print('0')
else:
	print('1')


import math
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
IN = lambda : input()

def s(a):
	print(''.join(list(map(str, a))))
n = IN()
if int(n[-1]) % 2 == 0:
	print(0)
else:
	print(1)


d = int(input()[-1])
if d % 2:
	print(1)
else:
	print(0)


from __future__ import division
from sys import stdin, stdout

def write(x):
	stdout.write(str(x) + '\n')
inp = stdin.readline().strip('\n')
write(int(inp[-1]) % 2)


a = str(input())
a = list(a)
i = len(a) - 1
if int(a[i]) % 2 == 1:
	print(1)
else:
	print(0)


def solve():
	pass

def main():
	n = int(input()[1:])
	print(n % 2)

def __starting_point():
	main()
__starting_point()


a = list(input())
if int(a[6]) % 2 == 0:
	print('0')
else:
	print('1')


s = input()
i = int(s, 16)
if i % 2 == 0:
	print(0)
else:
	print(1)


print(0 if int(input()[6]) % 2 == 0 else 1)


test_string = input()
res = int(test_string, 16)
if res % 2 == 0:
	print(0)
else:
	print(1)


n = input()
print(int(n[len(n) - 1]) % 2)


import sys
fin = sys.stdin
s = fin.readline().strip()
print(int(s[-1]) % 2)


n = input()
c = int(n[-1])
print(c % 2)


ch = input()
print(int(ch[len(ch) - 1]) % 2)


s = input()
ans = int(s, 16)
if ans % 2 == 0:
	print(0)
else:
	print(1)


s = input()
c = ord(s[6]) - ord('0')
if c & 1 == 0:
	print(0)
else:
	print(1)


num = int(input()[-1:])
print(num % 2)


hexa = input()
print(int(hexa, 16) % 2)


s = input()
ans = int(s[6]) % 2
print(ans)


x = int(input(), 16)
print(x % 2)


if int(input(), 16) % 2 == 0:
	print(0)
else:
	print(1)


def main():
	print(int(input()[-1]) & 1)
main()


a = input()
if int(a[-1]) % 2:
	print(1)
else:
	print(0)


s = input()
l = int(s[len(s) - 1])
if l & 1:
	print(1)
else:
	print(0)


x = input()
print(str(int(list(x)[6]) % 2))


s = input()
ou = s[1:]
n = int(ou)
print(n % 2)


a = int(input()[1:])
print(a % 2)


a = input()[::-1]
print(int(a[0]) & 1)


a = input()
n = len(a)
if int(a[n - 1]) % 2 == 0:
	print(0)
else:
	print('1')


a = int(input()[-1])
print(a & 1)


s = input()
print(int('0x' + s, 0) % 2)


f = int(input(), 16)
print(f % 2)


H = str(input().strip())
print(bin(int(H, 16))[-1])


x = input()
x = int(x[len(x) - 1], 10)
y = 0 if x % 2 == 0 else 1
print(y)


a = input()
tam = len(a)
if int(a[tam - 1]) % 2 == 0:
	print(0)
else:
	print(1)


print(int('0x' + input().strip(), 16) & 1)


t = input()
t = t[::-1]
k = int(t[0])
if k % 2 == 0:
	print('0')
else:
	print('1')


str = input()
res = int(str, 16)
if res & 1 == 0:
	print(0)
else:
	print(1)


x = input()
last = x[-1]
ans = int(last) % 2
print(ans)


n = input()
x = int(n[-1])
print(x % 2)


s = input()
print(int(s[6]) & 1)


s = str(input())
if int(s[len(s) - 1]) % 2 == 0:
	print('0')
else:
	print('1')


s = input()
u = ''
for i in range(1, len(s)):
	u += s[i]
x = int(u)
if x % 2 == 0:
	print(0)
if x % 2 != 0:
	print(1)


s = input()
b = bin(int(s, 16))
l = len(b)
print(b[l - 1])


s = str(input())
n = len(s)
print((ord(s[n - 1]) - ord('0')) % 2)


n = input()
b = len(n)
p = n[1:b]
print(int(p) % 2)


n = int(input().strip('A'))
print(n % 2)


ch = input()
x = int(ch[-1])
print(x % 2)


n = input()
s = int(n, 16)
print(s & 1)


k = list(map(str, input().split()))
k = k[0]
print(int(list(k)[-1]) % 2)


s = input()[-1]
print(int(s) % 2)


S = input()
print(int(S[1:]) % 2)


i = input()
print(int(i[1:]) % 2)


x = str(input())
d = int(x[1:])
if d % 2 == 1:
	print(1)
else:
	print(0)


n = input().strip()
num = int(n, 16)
if num % 2 == 0:
	print(0)
else:
	print(1)


i = input()
print(1 if int(i[-1]) % 2 else 0)


digitos = input()
var = int(digitos[6])
if var % 2 == 0:
	print('0')
else:
	print('1')


print(int(input()[6]) & 1)


t = int(input(), 16)
print(t % 2)


a = int(input(), base=16)
if a % 2 == 0:
	print(0)
else:
	print(1)


str = input()[1:]
val = int(str)
print(val % 2)


str = input()
nu = int(str[6])
print(nu % 2)


test_string = input()
res = int(test_string, 16)
print(res % 2)


x = input()
print(1 if int(x[-1]) % 2 == 1 else 0)


prblm = input()
problem = int(prblm[-1:])
if problem % 2 == 0:
	print('0')
else:
	print('1')


s = int(input()[1:])
print(s & 1)


st = input()
num = int(st[1:])
if num % 2 == 0:
	print(0)
else:
	print(1)


import sys, bisect
from math import gcd
input = sys.stdin.readline

def inp():
	return int(input().rstrip())

def inlt():
	return list(map(int, input().rstrip().split()))

def insr():
	s = input().rstrip()
	return s[:len(s) - 1]

def invr():
	return map(int, input().rstrip().split())
n = input().strip()
s = int(n[1:])
print(0 if s % 2 == 0 else 1)


hexdec = input()
dec = int(hexdec, 16)
s = str(bin(dec))
print(s[len(s) - 1])


k = input()
print(int(k[-1]) % 2)


value = input()
print(int(value, 16) % 2)


s = input()
i = int('0x' + s, 16)
print(i % 2)


n = input()
m = [i for i in str(n)]
if int(m[-1]) % 2 == 0:
	print(0)
else:
	print(1)


import math
ini_string = input()
n = int(ini_string, 16)
bStr = ''
while n > 0:
	bStr = str(n % 2) + bStr
	n = n >> 1
res = bStr
print(res[len(res) - 1])


s = int(input(), 16)
if s & 1:
	print(1)
else:
	print(0)


def convert_base(num, to_base=2, from_base=16):
	if isinstance(num, str):
		n = int(num, from_base)
	else:
		n = int(num)
	alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	if n < to_base:
		return alphabet[n]
	else:
		return list(convert_base(n // to_base, to_base) + alphabet[n % to_base])[-1]
print(convert_base(input()))


shreyas = input()
booty = shreyas[len(shreyas) - 1]
x = int(booty)
if x % 2 == 0:
	print('0')
else:
	print('1')


s = input()
li = ['0', '2', '4', '6', '8']
if s[len(s) - 1] in li:
	print('0')
else:
	print('1')


n = int(input(), 16)
print(n % 2)


t = input()
print(int(t[-1:]) % 2)


x = str(input())
if int(x[len(x) - 1]) % 2 == 0:
	print(0)
else:
	print(1)


int1 = input()
int2 = int(int1[1:])
print(int2 % 2)


print(int(input().strip()[-1]) & 1)


n = str(input())
s = n[-1]
print(int(s) % 2)


N = int(input()[1:])
print(1 if N % 2 == 1 else 0)


hexa = input()
hex_int = int('0x' + hexa, base=16)
print(hex_int % 2)


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	s = input().strip()
	result = int(s[-1]) % 2
	print(result)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


s = input()
f = int(s, 16)
print(f & 1)


test = input()
print(int(int(test, 16) % 2))


n = input()
x = int(n[6])
print(x % 2)


s = input()
res = int(s, 16)
if res % 2 == 0:
	print(0)
else:
	print(1)


l = input()
a = int(l, 16)
print(a % 2)


str_ = input()
x = int(str_[len(str_) - 1])
if x % 2 == 0:
	print(0)
else:
	print(1)


n = input()
n = int(n[-2:])
print(n % 2)


n = str(input())
c = n[6]
c = int(c)
print(c % 2)


print(int(input(), 16) % 2)


import math
from collections import defaultdict
s = input()
if int(s[-1]) % 2 == 0:
	print(0)
else:
	print(1)


a = list(input())
print(int(a[6]) % 2)


number = input()
number = list(str(number))
number.reverse()
if int(number[0]) % 2 == 0:
	print(0)
else:
	print(1)


s = list(input())
if s[-1] == '\n':
	s.pop()
d = int(s[-1])
print(d & 1)


s = str(input())
print(int(s[len(s) - 1]) % 2)


a = str(input())
if int(a[6]) % 2 == 0:
	print('0')
else:
	print('1')


n = input()
a = list(n)
if int(a[-1]) % 2 == 0:
	print(0)
else:
	print(1)


n = input()
x = 0
for j in n:
	if j.isdigit():
		x = int(j) % 2
if x % 2:
	print(1)
else:
	print(0)


x = input()
f = ord(x[-1])
d = f - 48
if d % 2 == 0:
	print('0')
else:
	print('1')


s = input()
s = list(s)
x = int(s[-1])
if x % 2 == 0:
	print(0)
else:
	print(1)


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
s = input()
print(int(s[-1]) % 2)


s = input()
x = int(s[6])
print(x % 2)


t = input()
i = int(t, 16)
if i % 2 == 0:
	print(0)
else:
	print(1)


inp = input()
print(int(inp, 16) % 2)


import bisect, collections

def solution():
	n = input().strip()
	if int(n[-1]) % 2 == 0:
		print('0')
	else:
		print('1')

def main():
	for _ in range(1):
		solution()

def __starting_point():
	main()
__starting_point()


n = input()
l = n[1:]
v = bin(int(l))
print(str(v[-1]))


a = input()
b = int(a[6])
print(b & 1)


n = input()
n = n.replace('A', '')
if int(n) % 2:
	print(1)
else:
	print(0)


q = str(input())
if len(q) == 7:
	d = q[-1]
	s = int(d)
	if s % 2 == 0:
		print('0')
	else:
		print('1')


from math import ceil, gcd
from collections import deque, defaultdict
from heapq import heappush as hpush, heappop as hpop, heapify
n = input()
print(int(n[-1]) % 2)


anum = input()
num = int(anum[1:])
if num % 2 == 1:
	print(1)
else:
	print(0)


s = str(input())
print(int(s[6]) % 2)


ip = input()
last = int(ip[-1])
print(last % 2)


print('01'[int(input()[-1]) % 2 != 0::2])


n = input()
print(bin(int(n, 16))[-1])


def fac1(n):
	if n <= 1:
		return 1
	else:
		return n * fac1(n - 1)

def fac2(n):
	if n <= 1:
		return 1
	else:
		k = 1
		while n != 1:
			k = k * n
			n = n - 1
		return k
s = input()
k = 6
total = 0
for i in range(len(s)):
	if i == 0:
		total = total + 16 ** k * 10
	else:
		total = total + 16 ** k * int(s[i:i + 1])
	k = k - 1
print(total % 2)


import sys
n = input()
if int(n[-1]) % 2 == 0:
	sys.stdout.write('0')
else:
	sys.stdout.write('1')


s = input()
if ord(s[len(s) - 1]) >= 65:
	if ord(s[len(s) - 1]) - 65 & 1:
		print(1)
	else:
		print(0)
elif int(s[len(s) - 1]) & 1:
	print(1)
else:
	print(0)


print(int(input(), base=16) & 1)


x = input()
a = int(x[6])
if a % 2 == 0:
	print('0')
else:
	print('1')


a = '0x' + input()
num = int(a, 16)
print(0 if num % 2 == 0 else 1)


u = input()
print(int(u[-1]) % 2)


def mp():
	return map(int, input().split())
a = input()
print(int(a[-1]) % 2)


s = str(input().strip())
l = int(s[len(s) - 1])
if l % 2 == 0:
	print(0)
else:
	print(1)


import math
a = int(input(), 16)
print(a % 2)


inp = input()
print(int(inp[-1]) % 2)


while 1:
	ch = input()
	if ch[0] == 'A' and ch[1:].isnumeric() and (len(ch) == 7):
		break
	else:
		continue
print(int(ch[6]) % 2)


print(1 & int(input()[-1]))


s = input()
s = s.lower()
s = '0x' + s
print(int(s, 16) % 2)


a = input()
b = int(a[len(a) - 1])
print(b % 2)


char = input()
num = char[-1:]
if num == '0':
	print('0')
elif num == '2':
	print('0')
elif num == '4':
	print('0')
elif num == '6':
	print('0')
elif num == '8':
	print('0')
else:
	print('1')


value = input()
b = value.split('A')
if int(b[1]) % 2 == 0:
	print(0)
else:
	print(1)


w = input()
last = int(w[-1])
print(last % 2)


ss = int(input()[-1])
print(ss % 2)


s = input()
a = (ord(s[-1]) - ord('0')) % 2
print(a)


def convert(list):
	s = [str(i) for i in list]
	res = int(''.join(s))
	return res
l = list(str(input()))
l.remove('A')
p = convert(l)
if p % 2 == 0:
	print(0)
else:
	print(1)


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
s = input()
s = int(s[1:])
s = s % 10
print(s % 2)


l = input()
if int(l[-1]) % 2 == 0:
	print('0')
else:
	print('1')


import sys
input = sys.stdin.readline

def main():
	n = input().strip()
	n = int(n[-1])
	print(n % 2)
main()


n = input()
m = int(n[-1])
print(m % 2)


s = input()
num = int(s, 16)
if num % 2 == 0:
	print(0)
else:
	print(1)


n = input()
n1 = int(n[1:])
print(n1 % 2)


s = input()
x = int(s[len(s) - 1])
if x % 2 == 0:
	print('0')
else:
	print('1')


data = input()
a = int(data.strip()[1:])
print(a % 2)


x = input()
print(int(x[len(x) - 1]) % 2)


A = input()
if int(A[-1]) % 2 == 0:
	print(0)
else:
	print(1)


values = input()
if int(values[-1]) % 2 == 0:
	print(0)
else:
	print(1)


n = int(input(), 16)
if n & 1:
	print(1)
else:
	print(0)


s = input()
x = int(s, 16)
if x % 2:
	print('1')
else:
	print('0')


h = input()
hh = int(h, 16)
print(hh % 2)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
import math
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	print(int(input()[-1]) % 2)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


str = input()
valu = int(str[-1])
if valu % 2 == 0:
	print(0)
else:
	print(1)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = 1
	rr = []
	for _ in range(t):
		s = S()
		rr.append(int(s, 16) % 2)
	return JA(rr, '\n')
print(main())


A = list(input())
print(int(A[6]) % 2)


s = input()
if s[6] == '0' or s[6] == '2' or s[6] == '4' or (s[6] == '6') or (s[6] == '8') or (s[6] == 'A') or (s[6] == 'C') or (s[6] == 'E'):
	print(0)
else:
	print(1)


s = input()
length = len(s)
a = s[6]
k = int(a)
if k % 2 == 0:
	print(0)
else:
	print(1)


def hexacheck(x):
	check = int(x[-1])
	if check % 2:
		return 1
	else:
		return 0
x = input()
print(hexacheck(x))


a = '0x' + input()
b = int(a, 16)
print(b % 2)


s = int(input(), 16)
print(s % 2)


hexa = str(input())
print(int(hexa[6]) % 2)


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
n = si()
if int(n[6]) % 2 == 0:
	print(0)
else:
	print(1)


i = input()

def split(word):
	return [char for char in word]
i = split(i)
if int(i[6]) % 2 == 0:
	print(0)
else:
	print(1)


print(int(input().strip()[-1]) % 2)


import sys
l = sys.stdin.readline()
if int(l[6]) % 2 == 0:
	print(0)
else:
	print(1)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007
s = input()
if int(s[6]) % 2 == 0:
	print(0)
else:
	print(1)


s = input().lower()
p = int(s, 16)
print(p % 2)


print(int(input()[6]) % 2)


ans = int(input(), 16)
print(ans % 2)


S = input()
S = S[1:]
if int(S) % 2 == 0:
	print(0)
else:
	print(1)


import math
n = input()
res = '{0:08b}'.format(int(n, 16))
print(res[-1])


a = input()
q = a[0]
x = a[1:8]
x = int(x)
if x % 2 == 1:
	print(1)
else:
	print(0)


import math
s = input()
res = '{0:08b}'.format(int(s, 16))
print(res[-1:])


st = input()
s = st[1:]
b = int(s)
print(b % 2)


line = input()
print(int(line[-1]) % 2)


import copy
s = input()
s2 = int(s[1:])
s3 = copy.copy(s2)
if s3 % 2 == 0:
	print(0)
else:
	print(1)


n = input()
l = list(n)
x = int(l[len(l) - 1])
print(x % 2)


n = input()
p = n[len(n) - 1]
p = int(p)
if p % 2 == 0:
	print('0')
else:
	print('1')


a = input()

def convert_base(num, to_base=2, from_base=16):
	if isinstance(num, str):
		n = int(num, from_base)
	else:
		n = int(num)
	alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	if n < to_base:
		return alphabet[n]
	else:
		return convert_base(n // to_base, to_base) + alphabet[n % to_base]
print(int(convert_base(a)) % 10)


n = input()
l = n[0]
num = int(n[1:])
print(num % 2)


s = input()
s = s[::-1]
k = 0
y = 'ABCDEF'
for i in range(len(s)):
	if s[i] in y:
		k += (10 + y.find(s[i])) * 16 ** i
	else:
		k += int(s[i]) * 16 ** i
print(k % 2)


k = input().strip()
k = k[1:]
if int(k) & 1 == 0:
	print(0)
else:
	print(1)


s = input()
s = int(ord(s[6]) - ord('0'))
if s % 2 == 0:
	print(0)
else:
	print(1)


str = input()
b = bin(int(str, 16))
x = int(b[-1:])
if x == 0:
	print(0)
else:
	print(1)


a = input()
ins = int(a, 16)
print(0 if ins % 2 == 0 else 1)


s = input()
c = ord(s[-1]) - ord('0')
print(c % 2)


n = input()
n = n[1:len(n)]
n = bin(int(n))
print(n[len(n) - 1])


s = input()
ch = s[-1]
if ch == '0' or ch == '2' or ch == '4' or (ch == '6') or (ch == '8'):
	print(0)
else:
	print(1)


n = str(input())
k = n[6]
k = int(k)
if k % 2 == 0:
	print(0)
else:
	print(1)


s = input()
a = int(s[len(s) - 1])
if a % 2 == 0:
	print(0)
else:
	print(1)


(a, num) = input().split('A')
(sum, counter) = (0, 0)
for i in range(len(num) - 1, -1, -1):
	sum += int(num[i]) * 16 ** counter
	counter += 1
sum += 10 * 16 ** len(num)
res = bin(sum)
print(res[len(res) - 1])


a = int(input(), 16)
a = bin(a)
print(a[-1])


s = input('')
v = int('0x' + s, 16)
print(v % 2)


s = input()
if s[len(s) - 1] == '1' or s[len(s) - 1] == '3' or s[len(s) - 1] == '5' or (s[len(s) - 1] == '7') or (s[len(s) - 1] == '9'):
	print(1)
else:
	print(0)


x = input()
y = ''
z = 10 * 16 ** (len(x) - 1)
for i in range(1, len(x)):
	y += x[i]
for j in range(len(y)):
	z += int(y[len(y) - int(j) - 1]) * 16 ** int(j)
if z % 2 == 0:
	print(0)
else:
	print(1)


import sys
input = lambda : sys.stdin.readline().rstrip()
x = ord(input()[-1]) - ord('0')
if x % 2:
	print('1')
else:
	print('0')


import sys
inp = input()
if int(inp[-1]) % 2 == 1:
	print(1)
else:
	print(0)


n = input()
k = int(n[6])
print('1') if k & 1 == 1 else print('0')


value = input('')
for i in value:
	if i == 'A':
		i = 'a'
print(str(bin(int(value, 16)))[-1])


x = list(input())
if int(x[len(x) - 1]) % 2 == 1:
	print('1')
else:
	print('0')


a = input()
a = int(a, 16)
a = list(bin(a))
print(a[len(a) - 1])


a = input()
res = int(a, 16)
if res % 2 == 0:
	print(0)
else:
	print(1)


num = list(input())
n = int(num[-1])
if n % 2 == 0:
	print(0)
else:
	print(1)


n = input()
a = int(n[-1])
if a & 1 == 1:
	print(1)
else:
	print(0)


import math
ss = str(input())
scale = 16
bbits = 50
print(bin(int(ss, scale))[2:].zfill(bbits)[-1])


a = input()
b = list(a)
length = len(b)
if int(b[length - 1]) % 2 == 0:
	print('0')
else:
	print('1')


def solve(t):
	n = bin(int(t, 16))[-1]
	return n
t = input()
print(solve(t))


ch = input()
n = int(ch[len(ch) - 1])
if n % 2 == 0:
	print(0)
else:
	print(1)


import os
import sys
from io import BytesIO, IOBase
readn = lambda : int(input())
readl = lambda : list(map(int, input().split()))
reads = lambda : input()
readns = lambda : map(int, input().split())

def main():
	print(int(input()[1:]) % 2)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
N = sys.stdin.read().strip()

def from_16_in_2(n_str):
	num = len(n_str) - 1
	val = 0
	for i in n_str:
		if i == 'A':
			val += 10 * 16 ** num
		else:
			val += int(i) * 16 ** num
		num -= 1
	return val
if from_16_in_2(N) % 2 == 0:
	print(0)
else:
	print(1)


print('10'[input()[-1] in '02468ACE'])


s = str(input())
s = s[1:]
i = int(s)
print(i % 2)


primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]

def nextnum(x):
	i = 0
	s = ''
	while i < len(primes) and primes[i] <= x:
		if x % primes[i] == 0:
			s += str(primes[i])
			x = x // primes[i]
		else:
			i += 1
	return int(s)

def again(x):
	return int(x[1:]) % 2
x = input()
print(again(x))


f = input()
print(int(f[-1]) % 2)


s = input()
res = '{0:08b}'.format(int(s, 16))
res = str(res)
n = len(res)
print(res[n - 1])


x = input()
res = int(x, 16)
if res % 2 == 0:
	print(0)
else:
	print(1)


izi = int(input()[1:])
print(izi % 2)


def rMap():
	return map(int, input().split())

def rList():
	return list(map(int, input().split()))
s = input()
print(int(s[-1]) % 2)


import sys
import os
from io import BytesIO, IOBase

def cel(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return defaultdict(int)

def ddl():
	return defaultdict(list)

def ddd():
	return defaultdict(defaultdict(int))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
from math import gcd
for _ in range(1):
	s = input()
	if int(s[-1]) & 1:
		print(1)
	else:
		print(0)


import sys
n = sys.stdin.readline().rstrip()
print(int(n, 16) % 2)


try:
	n = input()
	n = int(n[1:])
	print(n % 2)
except:
	pass


s = input()
n = int(s, 16)
if n % 2 == 0:
	print(0)
else:
	print(1)


st = input()
c = int(st, 16)
if c % 2 == 0:
	print('0')
else:
	print('1')


n = input()
ans = int(n, 16)
if ans % 2:
	print(1)
else:
	print(0)


n = input()
a = n[6]
if int(a) % 2 == 0:
	print(0)
else:
	print(1)


import math

def main():
	n = input()
	l = len(n)
	if int(n[l - 1]) % 2 == 0:
		print(0)
	else:
		print(1)
main()


n = input()
l = list(n)
if int(l[len(l) - 1]) % 2 == 0:
	print('0')
else:
	print('1')


a = input()
if a[-1] == '0' or a[-1] == '2' or a[-1] == '4' or (a[-1] == '6') or (a[-1] == '8'):
	print('0')
else:
	print('1')


a = str(input())
if a[-1] in '02468ACE':
	print(0)
else:
	print(1)


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()
res = ['YES', 'NO']
a = lsi()
print(int(a[-1]) % 2)


from sys import stdin
string = stdin.readline()[:-1]
print(int(string[-1]) % 2)


s = input()
if s[6] in ('1', '3', '5', '7', '9', 'B', 'D', 'F'):
	print(1)
else:
	print(0)


def stringToList(s):
	list = []
	for elem in s:
		if elem != ' ':
			list.append(elem)
	return list
string = stringToList(input())
c = int(string[-1])
if c % 2 == 0:
	print(0)
else:
	print(1)


n = input()
num = int(n[6]) - 48
if num % 2 == 0:
	print(0)
else:
	print(1)


A = str(input())
x = int(A, 16)
print(int(bin(x)[-1]))


i = input()
a = int(i[6])
if a % 2 == 0:
	print('0')
else:
	print('1')


import sys
import math
n = int('0x' + input(), 16)
if n % 2 == 0:
	print('0')
else:
	print('1')


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, input().split())

def rlinput():
	return list(map(int, input().split()))

def main():

	def pro(a, b, x, x1, x2):
		if (a == -2 * b or x != x1 or x != x2 or (b == 0)) and x1 <= x - a + b <= x2:
			return True
		return False
	print(int(input()[-1]) % 2)
for i in range(1):
	main()


n = str(input())
if int(n[len(n) - 1]) % 2 == 0:
	print(0)
else:
	print(1)


print(int(input(), base=16) % 2)


s = input()
s = int(s[1:])
if s % 2 == 0:
	print(0)
elif s % 2 == 1:
	print(1)


a = list(input())
b = int(a[-1])
if b % 2 == 0:
	print(0)
else:
	print(1)


n = input()
n = int(n[-1])
print(n & 1)


t = list(map(str, input().strip()))
if int(t[-1]) % 2 == 0:
	print(0)
else:
	print(1)


def last(str):
	return str[len(str) - 1]
str = input()
parni = {'0', '2', '4', '6', '8'}
if last(str) in parni:
	print(0)
else:
	print(1)


def split(word):
	return [char for char in word]
s = input()
l = list(split(s))
n = len(s)
d = int(l[n - 1])
if d % 2 == 0:
	print('0')
else:
	print('1')


s = input()
l = s[0]
s = s[1:]
s = s[::-1]
l = 10 + ord('A') - ord(l)
res = 0
for i in range(len(s)):
	n = int(s[i])
	res += n * 16 ** i
res += l * 16 ** 6
print(res % 2)


t = input()
t = list(t)
if int(t[len(t) - 1]) % 2 == 0:
	print('0')
else:
	print('1')


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import time
start_time = time.time()
import collections as col
import math, string
from functools import reduce

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	X = int(getStr()[-1])
	return X % 2
print(solve())


a = str(input())
if int(a[len(a) - 1]) % 2 == 0:
	print(0)
else:
	print(1)


inp = list(input())
print(int(inp[6]) % 2)


from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = int(pow(10, 9) + 7)

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1
s = si()
if int(s[-1]) % 2 == 0:
	print(0)
else:
	print(1)


s = input()
t = int(s[6])
if t & 1:
	print('1')
else:
	print('0')


x = str(input())
y = int(x[6])
if y % 2 == 0:
	print(0)
else:
	print(1)


import sys
from math import sqrt
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def s(d):
	dis = 1 + 4 * 2 * 3 * d
	ds = sqrt(dis)
	return (-1 + ds) / 6

def main():
	print(int(input().strip()[-1]) % 2)
main()


s = input()
t = s[1:len(s)]
if int(t) % 2 == 0:
	print(0)
else:
	print(1)


str = input()
list = []
j = 0
for i in range(len(str)):
	if j != 0:
		list.append(str[i])
	j += 1
integer = int(list[len(list) - 1])
if integer % 2 == 0:
	print(0)
else:
	print(1)


string = input()
print(int(string[-1]) % 2)


n = input()
i = int(n[-1])
if i & 1:
	print(1)
else:
	print(0)


def main():
	a = input()
	l = len(a)
	if int(a[l - 1]) % 2 == 0:
		print('0')
	else:
		print('1')
main()


hexnum = input()
number = int(hexnum, 16)
if number % 2 == 0:
	print(0)
else:
	print(1)


def NO():
	return print('NO')

def YES():
	return print('YES')

def INT():
	return int(input())

def LIST():
	return list(map(int, input().split()))

def STR():
	return input()

def MAP():
	return map(int, input().split())
s = STR()
if int(s[len(s) - 1]) & 1 == 0:
	print('0')
else:
	print('1')


a = input()
o = []
a = ' '.join(a)
o = a.split()
print(int(o[6]) % 2)


a = input()
b = int(a, 16)
print(1 if b % 2 == 1 else 0)


n = input()
c = int('10' + n[1:len(n)])
b = int(n[1:len(n)])
sys10 = 0
d = {'A': 10, 'B': 11, 'C': 12, 'D': 13, 'E': 14, 'F': 15, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '0': 0}
n = n[::-1]
for i in range(7):
	z = d[n[i]]
	sys10 += 16 ** i * z
print(sys10 % 2)


import sys
input = sys.stdin.readline
s = input()
res = int(s, 16)
if res % 2 == 0:
	print(0)
else:
	print(1)


def main():
	n = input()
	if int(n[1:]) % 10 & 1 == 0:
		print(0)
	else:
		print(1)
main()


import random
s = input()
a = list()
for items in s:
	a.append(items)
if int(a[6]) % 2 == 0:
	print('0')
else:
	print('1')


n = str(input())
s = str(n)
n = int(s[1:])
if n % 2 == 0:
	print(0)
else:
	print(1)


if input()[-1] in list('02468ACE'):
	print(0)
else:
	print(1)


import math
s = input()
n = int(s, 16)
b = ''
while n > 0:
	b = str(n % 2) + b
	n = n >> 1
res = str(b)
print(res[-1])


num = input()
num1 = int(num[1:])
if num1 % 2 == 0:
	print('0')
else:
	print('1')


n = input()
b = bin(int(n, 16))[2:]
if b[-1] == '0':
	print(0)
else:
	print(1)


s = input()
l = list(s)
n = int(l[-1])
if n % 2 == 0:
	print(0)
else:
	print(1)


string = input()
ls = '02468ACE'
if string[-1] in ls:
	print(0)
else:
	print(1)


ini_string = input()
scale = 16
res = bin(int(ini_string, scale)).zfill(8)
print(res[len(res) - 1])


n = str(input())
a = n[5] + n[6]
print(int(a) % 2)


n = input()
nn = len(n)
n = int(n[nn - 1])
if n % 2 == 0:
	print(0)
else:
	print(1)


a = input('')
b = list(a)
c = b[len(b) - 1]
d = int(c)
print(d % 2)


import sys
from functools import lru_cache
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def outln(var):
	sys.stdout.write(str(var) + '\n')

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return list(map(int, data().split()))

def ssp():
	return list(map(str, data().split()))

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
s = input()
s = s[1:]
print(int(s, 16) & 1)


num = input()
print(int(num[-1]) & 1)


inp = input()
n = int(inp, 16)
bStr = ''
while n > 0:
	bStr = str(n % 2) + bStr
	n = n >> 1
res = bStr
res = res[-1:]
print(res)


print(1 if int(input()[-1]) & 1 else 0)


a = input()
a = '0x' + a
print(int(float.fromhex(a)) & 1)


try:
	x = input()
	r = x[::-1]
	j = r[0]
	i = int(j)
	if i % 2 == 0:
		print('0')
	else:
		print('1')
except:
	pass


n = input()
if ord(n[len(n) - 1]) % 2 == 0:
	print(0)
else:
	print(1)


x = str(input())
for i in range(0, len(x)):
	ctr = x[i]
if int(ctr) % 2 == 0:
	print(0)
else:
	print(1)


a = input()
a1 = int(a[len(a) - 1])
if a1 % 2 == 0:
	print('0')
else:
	print('1')


print(int('0x' + input(), 16) % 2)


hex = input()
last = hex[-1]
digit = int(last)
if digit % 2 == 0 or digit == 0:
	print(0)
else:
	print(1)


kek = input()
print(int(kek[6]) % 2)


t = input()
if len(t) == 7 and t[0] == 'A':
	d = int(t[6])
	if d % 2 == 0:
		print('0')
	else:
		print('1')


n = input()
scale = 16
S = str(bin(int(n, scale))[2:].zfill(8))
print(S[-1])


n = int(input().lstrip('A'))
print(n % 2)


import sys
for line in sys.stdin:
	print(int(line, base=16) % 2)


def main():
	n = input()
	print(int(n, 16) % 2)
main()


from sys import stdin
inp = stdin.readline
n = [x for x in str(inp().strip())]
print(int(n[-1]) % 2)


string = input()
if int(string[1:]) % 2 == 0:
	print(0)
else:
	print(1)


string = input()
num = int(string, 16)
mod = num % 2
print(mod)


a = input()
b = 10 * 16 ** 6 + int(a[1]) * 16 ** 5 + int(a[2]) * 16 ** 4 + int(a[3]) * 16 ** 3 + int(a[4]) * 16 ** 2 + int(a[5]) * 16 + int(a[6])
print(b % 2)


s = input()
print((ord(s[len(s) - 1]) - ord('0')) % 2)


def main():
	S = input()
	if int(S, 16) % 2 == 0:
		print(0)
	else:
		print(1)
main()


s = str(input())
if int(s, 16) % 2 == 0:
	print(0)
else:
	print(1)


import math
ini_string = input()
res = '{0:08b}'.format(int(ini_string, 16))
p = str(res)
s = p[-1]
print(s)


s = input()
a = s[1:7]
print(int(a) % 2)


x = input().strip('\n\r')
if int(x[len(x) - 1]) % 2 == 0:
	print(0)
else:
	print(1)


def main():
	import sys
	input = sys.stdin.readline
	S = input().rstrip('\n')
	print(int(S[-1]) & 1)
main()


ax = input()
n = int(ax[1:])
print(n % 2)


s = input()
x = s[-1]
y = int(x)
y = y % 2
print(y)


s = input()
a = int(s, 16)
if a % 2:
	print(1)
else:
	print(0)


import sys, os, io
from sys import stdin, stdout
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import math
alphabets = list('abcdefghijklmnopqrstuvwxyz')

def isPrime(x):
	for i in range(2, x):
		if i * i > x:
			break
		if x % i == 0:
			return False
	return True

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def si():
	return input()

def prefix_sum(arr):
	r = [0] * (len(arr) + 1)
	for (i, el) in enumerate(arr):
		r[i + 1] = r[i] + el
	return r

def divideCeil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')

def power_set(L):
	cardinality = len(L)
	n = 2 ** cardinality
	powerset = []
	for i in range(n):
		a = bin(i)[2:]
		subset = []
		for j in range(len(a)):
			if a[-j - 1] == '1':
				subset.append(L[j])
		powerset.append(subset)
	powerset_orderred = []
	for k in range(cardinality + 1):
		for w in powerset:
			if len(w) == k:
				powerset_orderred.append(w)
	return powerset_orderred

def fastPlrintNextLines(a):
	print('\n'.join(map(str, a)))

def sortByFirstAndSecond(A):
	A = sorted(A, key=lambda x: x[0])
	A = sorted(A, key=lambda x: x[1])
	return list(A)
n = input()
if int(n[-1]) % 2 == 0:
	print(0)
else:
	print(1)


num = str(input())
val = int(num[len(num) - 1])
if val % 2 == 0:
	print(0)
else:
	print(1)


inp = input()
inn = int(inp[len(inp) - 1])
if inn & 1:
	print(1)
else:
	print(0)


from functools import reduce
import sys

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(delimiter=' '):
		return input().split(delimiter)

	@staticmethod
	def list_int(delimiter=' '):
		return list(map(int, input().split(delimiter)))

def main():
	a = Read.string()
	print('0' if int(a[-1]) % 2 == 0 else '1')
main()


fuck = str(input())
sex = str()
sex = str('{0:08b}'.format(int(fuck, 16)))
print(sex[len(sex) - 1])


s = input()
n = int(s[6])
if n % 2 == 0:
	print('0')
else:
	print('1')


ss = input()
print(int(ss[6]) % 2)


print(0 + (int(input()[6]) % 2 == 1))


print(int(input()[2:]) % 2)


a = input()
j = int(a[len(a) - 1])
if j % 2 == 0:
	print('0')
else:
	print('1')


def mai():
	row = input()
	if int(row[-1]) % 2 == 0:
		print('0')
	else:
		print('1')
mai()


x = input()
res = bin(int(x, 16)).zfill(8)
print(res[-1])


x = input()
x = int(x[1:])
print(str(x % 2))


import sys
n = int(sys.stdin.readline().strip()[-1])
print(n % 2)


hex = input()
res = bin(int(hex, 16)).zfill(8)
print(res[-1])


s = input()
number = int(s[len(s) - 1])
if number % 2 == 0:
	print(0)
else:
	print(1)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
s = input()
n = int(s, 16)
if n % 2 == 0:
	print(0)
else:
	print(1)


import math

def toDes(n):
	a = 0
	for i in range(0, len(n)):
		if n[i] in ['A', 'B', 'C', 'D', 'E', 'F']:
			a += (10 + ch16.index(n[i])) * 16 ** (len(n) - i - 1)
		else:
			a += int(n[i]) * 16 ** (len(n) - i - 1)
	return a
ost = []

def to2(a):
	res = ''
	while a >= 1:
		ost.append(a % 2)
		a //= 2
	for i in range(len(ost) - 1, -1, -1):
		res += str(ost[i])
	return res
n = input()
ch16 = ['A', 'B', 'C', 'D', 'E', 'F']
a = toDes(n)
print(str(to2(a))[-1])


x = str(input())
z = int(x[6])
print(z % 2)


n = input()
l = n[-1]
if l >= '0' and l <= '9':
	print(int(l) % 2)
elif l == 'A' or l == 'C' or l == 'E':
	print(0)
else:
	print(1)


import sys
input = lambda : sys.stdin.readline().rstrip()
s = input()
s = s[1:]
ans = int(s)
print(ans % 2)


from sys import stdin, stdout
from collections import defaultdict
from functools import lru_cache
from math import gcd, floor, ceil

def ilist():
	return [int(x) for x in stdin.readline().strip().split(' ')]

def iint():
	return int(stdin.readline())

def istr():
	return stdin.readline().strip()
s = istr()
print(int(s[-1]) % 2)


p = '0123456789ABCDEF'
s = str(input())
k = 0
s = s[::-1]
for i in range(len(s)):
	k += p.index(s[i]) * 16 ** i
print(k % 2)


N = input()
lent = len(N)
if int(N[lent - 1]) % 2 == 0:
	print(0)
else:
	print(1)


n = int(input(), 16)
nn = bin(n)
if nn[0] == nn[-1]:
	print(0)
else:
	print(1)


k = input().lower()
h = int(k, 16)
print(h % 2)


a = int('0x' + input(), 0)
print(a % 2)


num = input().strip()[-1]
if num in '02468ACE':
	print(0)
else:
	print(1)


n = input()
l = len(n)
i = n[l - 1]
if int(i) % 2 == 0:
	print(0)
else:
	print(1)


s = input()
d = s[len(s) - 1]
print(int(d) & 1)


s = input()
d = int(s[len(s) - 1])
if d % 2 == 0:
	print(0)
else:
	print(1)


s = str(input())
res = int(s, 16)
print(res % 2)


n = int(list(input())[6])
print(n & 1)


s = str(input())
s = list(s)
s = s[1:len(s)]
s = ''.join(s)
s = int(s)
print(s % 2)


str1 = input()
n = int(str1[1:])
print(n % 2)


S = input()
a = int(S, 16)
if int(a) % 2 == 0:
	print(0)
else:
	print(1)


a = input()
a = list(a)
a.pop(0)
a = ''.join(a)
a = str(a)
a = int(a)
print(a % 2)


str = input()
var = int(str, 16)
print(var % 2)


n = input()
b = n[1:]
bi = int(b)
if bi % 2 == 0:
	print(0)
else:
	print(1)


negocio = int(input()[1:])
if negocio % 2 == 0:
	print('0')
else:
	print('1')


import sys
inp = [a.strip() for a in sys.stdin.readlines()]
input = inp[0]
number = int(input[1:])
print(number % 2)


import sys

def input():
	return sys.stdin.readline()[:-1]
s = input()
print(int(s, base=16) % 2)


def main():
	hexValue = input()
	decimalValue = int(hexValue, 16)
	value = decimalValue % 2
	if value == 0:
		print(value)
	else:
		print(value)
main()


L = [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 0, 2, 2, 2, 2, 2, 1, 1, 2, 1, 0, 1, 1, 1, 0, 1, 2, 8, 14, 4, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1]
s = input()
d = int(s[-1])
print(d % 2)


s = input()
n = int(s[-1])
n = list(bin(n))
print(n[-1])


n = input()
dec = int(n, 16)
if dec % 2 == 0:
	print(0)
else:
	print(1)


a = input()
d = list()
for i in range(0, 10):
	d.append(str(i))
for i in ('A', 'B', 'C', 'D', 'E', 'F'):
	d.append(i)
cur = int(0)
l = len(a)
for i in range(0, l):
	for j in range(0, 16):
		if a[i] == d[j]:
			cur = cur * 16
			cur += j
print(cur & 1)


n = int(input()[6])
if not n % 2:
	print(0)
else:
	print(1)


a = int(input(), 16)
if a % 2 == 0:
	print(0)
elif a % 2 == 1:
	print(1)


a = input()
print(str(bin(int(a[1:])))[-1])


data = input()
new = data[1:]
new = int(new)
if new % 2 == 0:
	print(0)
else:
	print(1)


a = str(input())
b = a[1:]
c = [int(i) for i in b]
length = len(c)
if c[length - 1] % 2 == 0:
	print('0')
else:
	print('1')


from sys import stdin, stdout
from math import *
input = stdin.readline
s = input()
print(bin(int(s, 16))[-1])


s = list(input())
a = int(s[len(s) - 1])
print(a % 2)


x = input()
print((ord(x[len(x) - 1]) - ord('0')) % 2)


x = input()
num = list(x)
num.remove(num[0])
print(int(num[-1]) % 2)


num = input()
val = int(num, 16)
val = val % 10

def abc():
	return 1 if val % 2 else 0
print(abc())


import os
import sys
from io import BytesIO, IOBase

def solution(s):
	write(int(s[-1]) % 2)

def main():
	s = input()
	solution(s)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())

def w_array(arr):
	for x in arr:
		write(x, end=' ')
	write()
main()


def convert():
	L = ['B', 'D', 'F']
	a = list(input())
	A = a[-1]
	if A in L:
		print('0')
	elif int(A) % 2 == 0:
		print('0')
	else:
		print('1')
convert()


from math import *

def is_even(p):
	n = len(p)
	count = 0
	for i in range(n):
		index = p.index(i, i, n)
		if i == index:
			pass
		else:
			count += 1
			temp = p[i]
			p[i] = p[index]
			p[index] = temp
	if count % 2 == 0:
		return True
	else:
		return False
prime = []

def SieveOfEratosthenes():
	global prime
	prime = [1] * 2000010
	prime[1] = 0
	p = 2
	while p * p <= 2000001:
		if prime[p]:
			for i in range(p * p, 2000002, p):
				prime[i] = 0
lpf = []

def precompute():
	global lpf
	lpf = [0] * 1000001
	for i in range(2, 1000001):
		if not lpf[i]:
			for j in range(i, 1000001, i):
				if not lpf[j]:
					lpf[j] = i

def binpow(a, b):
	res = 1
	while b > 0:
		if b & 1:
			res *= a
		a *= a
		b >>= 1
	return res

def modpow(a, b, x):
	res = 1
	while b > 0:
		if b & 1:
			res *= a
			res %= x
		a *= a
		a %= x
		b >>= 1
	return res
cont = []

def f(x):
	global cont
	total = 0
	for i in cont:
		total += abs(i - x)
	return total

def bs(low, high, target):
	while low + 3 < high:
		mid = (low + high) / 2
		if arr[mid] < target:
			low = mid
		else:
			high = mid - 1
	for i in range(high, low - 1, -1):
		if arr[o] < target:
			return i
	return -1

def ternary_search(l, r):
	while r - l > 10:
		m1 = l + (r - l) / 3
		m2 = r - (r - l) / 3
		f1 = f(m1)
		f2 = f(m2)
		if f1 > f2:
			l = m1
		else:
			r = m2
	mino = f(l)
	for i in range(l, r + 1):
		mino = min(mino, f(i))
	return mino
l = []
for i in range(2, 21):
	l.append(log(i))
s = input()
s = s[1:]
print(int(s) % 2)


a = input()
if a[-1] == 'A':
	print(0)
elif a[-1] == 'B':
	print(1)
elif a[-1] == 'C':
	print(0)
elif a[-1] == 'D':
	print(1)
elif a[-1] == 'E':
	print(0)
elif a[-1] == 'F':
	print(1)
else:
	num = int(a[-1])
	print(num % 2)


t = input()
k = int(t[6])
print(k % 2)


g = input('')
i = int(g, 16)
print(i % 2)


s = input().rstrip()
x = list(s)
x.reverse()
if int(x[0]) % 2 == 0:
	print(0)
else:
	print(1)


s = list(input())
print(int(s[6]) % 2)


N = input()
a = bin(int(N, 16))[2:]
print(a[len(a) - 1])


r = input()
if int(r[1:]) % 2 == 0:
	print('0')
else:
	print('1')


n = input()
lastDigit = int(n[len(n) - 1])
if lastDigit % 2 == 0:
	print(0)
else:
	print(1)


a = int(input().lstrip('A'))
print(a % 2)


import sys
input = sys.stdin.readline
x = input()[1:]
x = int(x)
print(x % 2)


b = int(input()[-1])
print(b & 1)


s = input()
s = list(s)
a = int(s[-1])
if a % 2 != 0:
	print(1)
else:
	print(0)


x = int(input(), 16)
print(x & 1)


print(ord(input()[-1]) % 2)


import sys
import atexit
import io
from collections import defaultdict, Counter

def main():
	i = int(input().strip()[-1])
	print(i % 2)
main()


import math
ini_string = input()
res = '{0:08b}'.format(int(ini_string, 16))
print(res[len(res) - 1])


n = input()
n = list(n)
if int(n[6]) == 1 or int(n[6]) == 3 or int(n[6]) == 5 or (int(n[6]) == 7) or (int(n[6]) == 9):
	print('1')
else:
	print(0)


X = input()
print(int(X[-1]) % 2)


x = input()
last_letter = x[6]
if int(last_letter) % 2 == 0:
	print(0)
else:
	print(1)


h = input()
d = int('0x' + h, 16)
b = bin(d)[2:]
print(int(b[-1]))


Str = input()
print(int(Str[1:]) % 2)


a = input()
c = list(a)
d = []
e = ''
for i in range(1, len(c)):
	d.append(c[i])
	e = e + c[i]
f = int(e)
if f % 2 == 0:
	print(0)
else:
	print(1)


n = int(input(), 16)
m = bin(n)[2:]
print(m[-1])


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def gcd(a, b):
	while b:
		a = a % b
		(b, a) = (a, b)
	return a

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def solve():
	s = input()
	a = int(s[1:])
	if a & 1:
		pr(1)
	else:
		pr(0)
for _ in range(1):
	solve()


a = input()
d = a[1]
c = a[2]
e = a[3]
h = a[4]
i = a[5]
o = a[6]
sum = d + c + e + h + i + o
dec = int(sum)
if dec % 2 == 0:
	print('0')
else:
	print('1')


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = 1
for tt in range(t):
	s = str(input())
	c = s[-1]
	if c == '0' or c == '2' or c == '4' or (c == '6') or (c == '8'):
		print(0)
	else:
		print(1)
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


N = int(input()[-1])
print(N % 2)


t = input()
soma = 0
cont = len(t) - 1
for e in t:
	if e == 'A':
		soma += 10 * 16 ** cont
	else:
		soma += int(e) * 16 ** cont
	cont -= 1
if soma % 2 == 0:
	print(0)
else:
	print(1)


a = input()
b = int(a[6])
print(b % 2)


a = input()
x = a[-1]
c = bin(int(x))
if c[-1] == '0':
	print('0')
else:
	print('1')


l = input()
print(int(l[-1]) % 2)


import sys, math, cmath
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
t = 1
for tt in range(t):
	s = insr()
	print(int(s, 16) % 2)


import sys
t = -1
s = input()
x = int(s[-1])
print(x % 2)


s = input()
l = ['0', '2', '4', '6', '8']
if s[-1] in l:
	print(0)
else:
	print(1)


s = input()
count = int(s, 16)
if count % 2 == 0:
	print(0)
else:
	print(1)


CHARS = '0123456789ABCDEF'
DIGITS = 16

def isDivisible(s, m):
	mp = dict.fromkeys(CHARS, 0)
	for i in range(DIGITS):
		mp[CHARS[i]] = i
	r = 0
	for i in range(len(s)):
		r = (r * 16 + mp[s[i]]) % m
	if not r:
		return True
	return False
s = input()
m = 2
if isDivisible(s, m):
	print(0)
else:
	print(1)


n = input()
k = n[-1]
if k in '13579':
	print('1')
else:
	print('0')


def solution():
	s = input()
	if int(s[-1]) % 2 == 0:
		print(0)
	else:
		print(1)
solution()


st = input()
n = len(st)
if int(st[n - 1]) % 2 == 0:
	print(0)
else:
	print(1)


import sys

def IOE():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	s = input()[1:]
	s = int(s)
	print(s & 1)
try:
	IOE()
except:
	pass
main()


b = input()
c = b[1:]
d = int(c)
if d % 2 == 0:
	print('0')
else:
	print('1')


p = input()
num = int(p[1:])
if num % 2:
	print(1)
else:
	print(0)


a = input()
if (ord(a[-1]) - ord('0')) % 2 == 1:
	print(1)
else:
	print(0)


import math
n = input()
p = int(n[len(n) - 1])
if p % 2 == 0:
	print(0)
else:
	print(1)


ip = input()
if int(ip[-1]) % 2 == 0:
	print(0)
else:
	print(1)


n = list(input())
x = ['A', 'B', 'C', 'D', 'E', 'F']
a = 0
for i in range(len(n)):
	if n[i] in x:
		n[i] = 10 + x.index(n[i])
	a += int(n[i]) * 16 ** (len(n) - i - 1)
print(a % 2)


s = input()
num = int(s[-1])
if num & 1:
	print(1)
else:
	print(0)


s = str(input())
a = int(s[-1])
if a % 2 == 0:
	print('0')
else:
	print('1')


inp = str(input())
if int(inp[-1]) % 2 == 0:
	print(0)
else:
	print(1)


ans = ''
x = input()
z = int(x[len(x) - 1])
if z % 2 == 0:
	print(0)
else:
	print(1)


temp = input().strip()
num_0 = int(temp[1:])
print(num_0 % 2)


a = list(input())
b = ''.join(a[1:])
bi = bin(int(b))
print(list(str(bi))[-1])


hello = int(input()[-1])
print(hello % 2)


x = input()
ch = ord(x[-1])
print(ch % 2)


start = str(input(''))
end = start.replace('A', '')
endint = int(end)
if endint % 2 == 0:
	print('0')
else:
	print('1')


def pr(num):
	return num % 2
num = input()
print(pr(int(num[-1])))


a = input()
a = a[1:7]
b = int(a)
b = b % 2
print(b)


a = input()
b = ord(a[-1:]) % 2
print(b)


s = list(input())
if int(s[len(s) - 1]) % 2 == 0:
	print(0)
else:
	print(1)


s = int(input(), base=16)
x = str(bin(s))
print(x[-1])


num = int(input(), 16)
print(num % 2)


a = input()
c = a[-1:]
b = int(c)
if b % 2 == 0:
	print('0')
else:
	print('1')


def solver(s):
	n = bin(int(s))
	print(n[len(n) - 1])
s = input()
if s[1] == 0:
	s = s[2:]
	solver(s)
else:
	s = s[1:]
	solver(s)


s = input()
if (ord(s[-1]) - ord('0')) % 2 == 0:
	print(0)
else:
	print(1)


i = input()
t = list(i)
last = int(t[-1])
print(last % 2)


i = input()
x = int(i, 16)
y = int(x)
if x % 2 == 0:
	print('0')
else:
	print('1')


print(int(input(), 16) & 1)


hexa = input()
if int(hexa[-1]) % 2:
	print(1)
else:
	print(0)


from sys import exit

def i():
	return input()

def ii():
	return int(input())

def iis():
	return map(int, input().split())

def liis():
	return list(map(int, input().split()))

def print_array(a):
	print(' '.join(map(str, a)))
s = input()
if int(s[-1]) % 2 == 0:
	print(0)
else:
	print(1)


def main_function():
	a = input()
	print(int(a[-1]) % 2)
main_function()


S = input()
print(ord(S[-1]) % 2)


from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def main():
	s = si()
	s = s[1:]
	if int(s) % 2 == 0:
		print('0')
	else:
		print('1')
main()


a = input()
s = a[1:]
res = int(s)
if res % 2 == 1:
	print(1)
else:
	print(0)


h = input().strip()
h = int(h[-1])
print(1) if h % 2 else print(0)


from math import sqrt

def A():
	print('NO')

def B():
	a = int(input())
	factors = []
	for i in range(2, int(sqrt(a)) + 1):
		if a % i == 0:
			factors.append(i)
			factors.append(a // i)
	print(''.join([str(x) for x in sorted(factors)]))

def D():
	a = input()
	print(int(a[-1]) % 2)
D()


n = input()
va = n[6]
va = int(va)
if va % 2 == 0:
	print('0')
else:
	print('1')


import math
INT_MAX = 10 ** 18 + 7
MOD = 10 ** 9 + 7

def INPUT():
	return list((int(i) for i in input().split()))

def LIST_1D_ARRAY(n):
	return [0 for _ in range(n)]

def LIST_2D_ARRAY(m, n):
	return [[0 for _ in range(n)] for _ in range(m)]
s = input()
if s[-1] == '2' or s[-1] == '4' or s[-1] == '6' or (s[-1] == '8') or (s[-1] == '0') or (s[-1] == 'A') or (s[-1] == 'E') or (s[-1] == 'C'):
	print(0)
else:
	print(1)


print(int(list(input())[-1]) % 2)


I = input()
K = int(I[6])
if K % 2 == 1:
	print(1)
else:
	print(0)


n = input()
if n[-1] == '0' or n[-1] == '2' or n[-1] == '4' or (n[-1] == '6') or (n[-1] == '8'):
	print(0)
else:
	print(1)


s = input()
x = int(s, 16)
print(x % 10 % 2)


data = list(map(str, input()))
if int(data[len(data) - 1]) % 2 == 0:
	print(0)
else:
	print(1)


import math
ini_string = input()
res = '{0:08b}'.format(int(ini_string, 16))
if str(res)[-1] == '1':
	print('1')
else:
	print('0')


s = input()
a = int(s[-1])
if a == 1 or a == 3 or a == 5 or (a == 7) or (a == 9):
	print('1')
else:
	print('0')


T = input()
print(int(T[1:]) % 2)


x = input()
print(int(x[6]) & 1)


print(int(int(input().strip(), 16) % 2 != 0))


y = input()
x = bin(int(y, 16))[2:]
if int(x) % 2 == 0:
	print(0)
else:
	print(1)


t = input()
a = int(t, 16)
b = str(a)
li = list(b)
s = int(li[-1])
s1 = bin(s)
li2 = list(s1)
s2 = li2[-1]
print(s2)


hex_number = input()
number = int(hex_number, 16)
print(number % 2)


entrada = input()
i = int(entrada, 16)
if i % 2 == 0:
	print('0')
else:
	print('1')


import math
s = str(input())
sum = str()
sum = str('{0:08b}'.format(int(s, 16)))
print(sum[len(sum) - 1])


str1 = input()
if int(str1[len(str1) - 1]) % 2 == 0:
	print(0)
else:
	print(1)


from math import *
from copy import *
from string import *
from random import *
from bisect import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
from collections import defaultdict

def solve(l):
	n = len(l)
N = input()
if int(N, 16) % 2 == 1:
	print(1)
else:
	print(0)