import itertools
from datetime import date

def leapyear(cd, d):
    count =0
    if cd[1:] >= [3, 1]:
        count += 1
    if d[1:] >= [2, 28]:
        count += 1
    for i in range((date(*cd)-date(*d)).days/365):
        year = 2000 + cd[0] + i+1
        if (year%4==0) and (year%100!=0) or (year%400==0):
            count +=1
    return count-1

def main(a, b):
    cd = [int(s, 10) for s in a.split('.')][::-1]
    bd = [int(s, 10) for s in b.rsplit('.')][::-1]

    for d in itertools.permutations(bd):
        try:
            t = date(*cd) - date(*d)
            if (t.days-leapyear(cd,d))/365 >= 18:
                print "YES"
                return
        except ValueError:
            pass
    print "NO"

a = raw_input()
b = raw_input()
main(a, b)


import math as mm
n,m=map(int,input().split())
if m==0:
    print(1)
else:

    if n%2==0:
        if m<=n//2:
            print(m)
        else:
            print(n-m)
    else:
        if m<=mm.floor(n/2):
            print(m)
        elif m==mm.floor(n/2)+1:
            print(m-1)
        else:
            print(n-m)


# -*- coding:utf8 -*-
# by utoppia
# 09-05-2019

n, m = map(int, raw_input().split(' '))

def f(n, m):
    ans = 1
    if m == 0 :
        return  1
    if m == 1:
        if n > 1:
            return 1
        else:
            return  0

    if m >= 2:
        m -= 2
        n -= 3

    if n <= -1:
        ans = 0
    else:
        p = 1
        left = n
        while m > 0:
            m -= 1
            if left >= 2:
                p += 1
                left -= 2
                if left == 1:
                    p += 1
                    left = 0
            else:
                p -= 1
        ans = p
        if left:
            ans += 1
    return ans

print f(n, m)


def num_grass(row):
    return row[0] + row[1]

num_tests = int(input())
for test_num in range(num_tests):
    row1 = list(map(int, input().split()))
    row2 = list(map(int, input().split()))
    if num_grass(row1) + num_grass(row2) == 0:
        print(0)
    elif num_grass(row1) + num_grass(row2) == 4:
        print(2)
    else:
        print(1)


n=int(input())
for i in range(n):
    b=list(map(int,input().split()))
    c=list(map(int,input().split()))
    d=b+c
    if d.count(1)==0:
        print(0)
    elif d.count(1)==4:
        print(2)
    else:
        print(1)


from math import inf,sqrt,floor,ceil
from collections import Counter,defaultdict,deque
from heapq import heappush as hpush,heappop as hpop,heapify as h
from operator import itemgetter
from itertools import product
from bisect import bisect_left,bisect_right

#for _ in range(int(input())):
#n=int(input())
s=input()
d={}
n=len(s)
for i in range(n):
    if s[i]!="!":
        d[i%4]=s[i]
ans=defaultdict(int)
for i in range(n):
    if s[i]=="!":
        ans[d[i%4]]+=1
res=[]
res.append(ans['R'])
res.append(ans['B'])
res.append(ans['Y'])
res.append(ans['G'])
print(*res)


garland = input()

R = garland.index('R')
B = garland.index('B')
Y = garland.index('Y')
G = garland.index('G')

indices = [R,B,Y,G]; ans = ""
for index in indices:
    ans += (str(len(list(filter(lambda x: ((index-x)%4 == 0 and
                                           garland[x] == '!'),
                                range(0,len(garland)))))) +
            ' ')
print(ans)


#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys, math, random, operator
from string import ascii_lowercase
from string import ascii_uppercase
from fractions import Fraction, gcd
from decimal import Decimal, getcontext
from itertools import product, permutations, combinations
from Queue import Queue, PriorityQueue
from collections import deque, defaultdict, Counter
getcontext().prec = 100

MOD = 10**9 + 7
INF = float("+inf")

if sys.subversion[0] != "CPython":  # PyPy?
    raw_input = lambda: sys.stdin.readline().rstrip()
pr = lambda *args: sys.stdout.write(" ".join(str(x) for x in args) + "\n")

read_str = raw_input
read_strs = lambda: raw_input().split()
read_int = lambda: int(raw_input())
read_ints = lambda: map(int, raw_input().split())
read_float = lambda: float(raw_input())
read_floats = lambda: map(float, raw_input().split())

"---------------------------------------------------------------"

s = read_str()

res = set()
for i in xrange(0, len(s) + 1):
    for c in ascii_lowercase:
        t = s[:i] + c + s[i:]
        res.add(t)
# print res
print len(res)


x = input().lower()
y = input().lower()
count, z = 0, 0
for i in range(z, len(x)):
    for j in range(z, len(y)):
        if ord(x[i]) == ord(y[j]):
            z += 1
        if ord(x[i]) < ord(y[j]) and count != 1:
            count = -1

        if ord(x[i]) > ord(y[j]) and count != -1:
            count = 1
        break

print(count)


m = input().lower()
n = input().lower()
if m == n:
    print (0)
elif m > n :
    print (1)
else:
    print (-1)


import math
s1, s2, s3=map(int,input().split())
a = math.sqrt(s1 * s2 / s3)
b = math.sqrt(s3 * s1 / s2)
c = math.sqrt(s3 * s2 / s1)
sum = a + b + c
print(int(4 * sum))


import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from itertools import (
    accumulate, combinations, combinations_with_replacement, groupby,
    permutations, product)
from math import (acos, asin, atan, ceil, cos, degrees, factorial, gcd, hypot,
                  log2, pi, radians, sin, sqrt, tan)
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

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

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

def instr():
    s = input()
    return(list(s[:len(s)]))

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

x, y, z = invr()
a = int(sqrt((x*z)/y))
c = z//a
b = y//c
print(a*4+b*4+c*4)


import math

data = input().split()

N, K = int(data[0]), int(data[1])

position_value = 0
max_counter = 0

if K <= math.ceil(N/2):
    print(K+(K-1))
else:
    if K == N and K%2 != 0:
        print(K-1)
    elif (N%2 != 0 and K%2 == 0) or (N%2 != 0 and K%2 != 0):
        print((K-(N-K))-1)
    else:
        print((K-(N-K)))


number = input()

number_list_form = number.split()

n_range = int(number_list_form[0])
des_pos = int(number_list_form[1])

if des_pos * 2 - 1 <= n_range:
    print(des_pos * 2 - 1)
elif des_pos * 2 > n_range and n_range % 2 == 0:
    print((des_pos - (n_range // 2)) * 2)
elif des_pos * 2 > n_range and n_range % 2 != 0:
    print((des_pos - ((n_range // 2) + 1)) * 2)


n,i=map(int,raw_input().split())
l1=[]
l1=map(int, raw_input().split()[:n])

count =0
for o in l1:
	if o >=l1[i-1] and o>0:
		count=count+1
	else:
		continue

print(count)


import sys

def main():
    n, k = map(int, sys.stdin.readline().split())
    x = list(map(int, sys.stdin.readline().split()))
    x.sort(reverse=True)
    a = 0
    for i in range(n):
        if x[i] > 0 and x[i] >= x[k - 1]:
            a += 1
    print(a)

main()


# http://codeforces.com/problemset/problem/272/A

number_people = int(input())
fingers = [int(x) for x in input().split()]

sum_fingers = sum(fingers)
fingers_hand = [1, 2, 3, 4, 5]
# s = [0] * (n + 1)
counter = 0

for i in fingers_hand:
    all_fingers = i + sum_fingers
    while all_fingers > 0:
        all_fingers -= (number_people + 1)
        if all_fingers == 1:
            counter += 1
            break

print(5 - counter)


n = input()
s = sum(map(int,raw_input().split()))
j = 0
for i in range(0,5):
	if ( s + i + 1 ) % ( n + 1 ) != 1:
		j += 1
print j


import math, time, re

ln = lambda : raw_input()
cnv = lambda s: map(int, s.split())
rInt = lambda s: int(s)
rFloat = lambda s: float(s)
rLong = lambda s: long(s)
rLine = lambda f: f.readline()

l = cnv(ln())
a, b, c, d, e, f = l[0], l[1], l[2], l[3], l[4], l[5]
if not 0 in l:
    x = 1.0*b*d/c
    y = x*f/e
    #print y, a
    if y<=a:
        print 'Hermione'
    else:
        print 'Ron'
else:
    if d == 0:
        print 'Hermione'
    else:
        if c == 0:
            print 'Ron'
        else:
            if b == 0:
                print 'Hermione'
            else:
                if a == 0:
                    print 'Ron'
                else:
                    if f == 0:
                        print 'Hermione'
                    else:
                        if e == 0:
                            print 'Ron'


a=map(int,raw_input().split())

if not all(a[i] for i in range(6)[1::2]) and not (not a[2] and a[3]) and not (not a[0] and a[1]*a[2]*a[3]):
    print "Hermione"
    exit()
if not all(a[i] for i in range(6)[::2]):
    print "Ron"
    exit()
print "Ron" if 1.*a[1]/a[0]*a[3]/a[2]*a[5]/a[4] > 1 else "Hermione"


n = int(input())
a = list(map(int, input().split()))
cache = {}
ans = []
for i in range(n-1, -1, -1):
	if not cache.get(a[i]):
		ans.append(a[i])
		cache[a[i]] = 1
ans.reverse()
print(len(ans))
print(*ans)


def answer():
    n = int(input())
    a = [int(x) for x in input().split()]
    c = []
    a.reverse()
    for x in a:
        if x not in c:
            c.append(x)
    i=0
    ans=""
    c.reverse()
    print(len(c))
    while i<len(c):
        ans+=str(c[i])
        i+=1
        if i!=len(c):
            ans+=" "
    return ans
print(answer())


a,b,c,d=map(int,raw_input().split())
print d*2-c if b*2==a+c and c*2==b+d else d*d/c if b*b==a*c and c*c==b*d and not d*d%c else 42


a,b,c,d=map(int,input().split())
r=42
if b-a==c-b==d-c:r=d+b-a
if b/a==c/b==d/c==int(d*c/b)/d:r=int(d*c/b)
print(r)


#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import*
from io import BytesIO, IOBase
def vsInput():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
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")
ALPHA='abcdefghijklmnopqrstuvwxyz'
MOD=1000000007
def value():return tuple(map(int,input().split()))
def array():return [int(i) for i in input().split()]
def Int():return int(input())
def Str():return input()
def arrayS():return [i for i in input().split()]

#-------------------------code---------------------------#
# vsInput()

cap=[0,1]
for i in range(2,101):
    k=ceil(i/2)
    k+=k-1
    cap.append(cap[-1]+k)

def possible(x):

    quad=x//2
    load=cap[quad]

    if(quad%2==0):
        for i in range(quad*2+2):
            rem=n-i
            if(rem%4==0 and rem//4<=load):
                return True
    else:
        quad-=1
        for i in range(quad*2+2):
            rem=n-i
            if(rem%4==0 and rem//4<=load):
                return True
        quad+=1
        rem=n-ceil(quad/2)*4
        if(rem%4==0 and rem//4<=load-4):
            return True

    return False

n=Int()
if(n==2):
    print(3)
    exit()

for mid in range(1,100,2):

    if(possible(mid)):
        print(mid)
        break


n = int(input())
k=0
for i in [100, 20, 10, 5]:
    k = k + n // i
    n = n % i
print(k + n)


import sys
import math
#import random
sys.setrecursionlimit(100000)
input = sys.stdin.readline

############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input()))
def inara():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
################################################################
############ ---- THE ACTUAL CODE STARTS BELOW ---- ############

n=inp()
ans=0

while n:
	ans+=1
	n//=2

print(ans)


import math

class CodeforcesTask1037ASolution:
    def __init__(self):
        self.result = ''
        self.n = 0

    def read_input(self):
        self.n = int(input())

    def process_task(self):
        res = 0
        while self.n >= 2 ** res:
            self.n -= 2 ** res
            res += 1
        if self.n:
            res += 1
        self.result = str(res)

    def get_result(self):
        return self.result

if __name__ == "__main__":
    Solution = CodeforcesTask1037ASolution()
    Solution.read_input()
    Solution.process_task()
    print(Solution.get_result())


nn = raw_input().split()
k = int(nn[0])#5
n = int(nn[1])#3 6
print(k+n-(k%n))


n,k = map(int, raw_input().strip().split(" "))

print ((n/k)+1)*k


# -*- coding: utf-8 -*-
"""
Created on Sat Feb 22 14:50:02 2020

@author: Lenovo
"""

#https://codeforces.com/problemset/problem/104/A

def black_jack():
    card = int(input())

    needed = card - 10

    if needed >= 1 and needed <= 9:
        print(4)
        return
    elif needed == 11:
        print(4)
        return
    elif needed == 10:
        print(15)
        return
    elif needed == 0 or needed > 11 or needed <= 0:
        print(0)
        return

black_jack()


n=input()
x=n-10
res=0
if x>0 and x<12:
	if x==10:
		res=15
	else:
	    res=4
print(res)


n,m = map(int,input().split())
s = set()
f=0
while n!=0:
    old_len = len(s)
    s.add(n%m)
    n = n//m
    new_len = len(s)
    if old_len==new_len:
        print('NO')
        f=1
        break
if f==0:
    print('YES')


# coding: utf-8

n, m = map(int, input().split())
a = list()

while n:
  a.append(n % m)
  n //= m

print('YES') if len(a) == len(set(a)) else print('NO')


# target Expert

# Author : raj1307 - Raj Singh
# Date   : 22.07.19

from __future__ import division, print_function

import os,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 ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().strip().split(" "))
def li(): return list(mi())

def dmain():
    sys.setrecursionlimit(100000000)
    threading.stack_size(40960000)
    thread = threading.Thread(target=main)
    thread.start()

#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
#from math import ceil,floor,log,sqrt,factorial,pow,pi
#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
#from decimal import *,threading
#from itertools import permutations

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
#mod=998244353
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]
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

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

def isPrime(n) : # Check Prime Number or not
    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')

from math import factorial as f
def ncr(n,r):
    if n < r: return 0
    return f(n)//(f(n-r)*f(r))

def main():

    #for _ in range(ii()):

    s=['qwertyuiop','asdfghjkl;','zxcvbnm,./']

    c=si()
    a=list(si())
    ans=''
    if c=='L':
        for i in a:
            for j in range(3):
                if i in s[j]:
                    ans+=s[j][s[j].index(i)+1]
                    break
    else:
        for i in a:
            for j in range(3):
                if i in s[j]:
                    ans+=s[j][s[j].index(i)-1]
                    break

    print(ans)

# region fastio

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):
    """Prints the values to a stream, or to sys.stdout by default."""
    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")

# endregion

if __name__ == "__main__":
    #read()
    main()
    #dmain()

# Comment Read()


z,zz=input,lambda:list(map(int,z().split()));
szz,dgraphs,mod=lambda:sorted(zz()),{},10**9+7
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac
def lcd(xnum1,xnum2):return (xnum1*xnum2//gcd(xnum1,xnum2))
def prime(x):
    p=ceil(x**.5)+1
    for i in range(2,p):
        if x%i==0 and x!=2:return 0
    return 1
def dfs(u,visit,graph):
    visit[u]=True
    for i in graph[u]:
        if not visit[i]:
            dfs(i,visit,graph)

###########################---Test-Case---#################################
"""

"""
###########################---START-CODING---##############################

l1=list('qwertyuiop')
l2=list('asdfghjkl;')
l3=list('zxcvbnm,./')
s=''

d=z()
if d=='R':
    p=-1
if d=='L':
    p=1

l=list(z())

for i in l:
    try:
        t=l1.index(i)
        s+=l1[t+p]
    except:pass
    try:
        t=l2.index(i)
        s+=l2[t+p]
    except:pass
    try:
        t=l3.index(i)
        s+=l3[t+p]
    except:pass

print(s)


n, m = map(int, input().split())
f = [int(x) for x in input().split()]
f.sort()
x = []

if n == m:
    print(max(f) - min(f))
else:
    for i in range(m - n+1):

        x.append(abs(f[i] - f[i + n - 1]))
    print(min(x))


n,m = map(int,raw_input().strip().split())
a=map(int,raw_input().strip().split())
a.sort()
#print a
i=0
small=a[n-1]-a[0]
while(i+n<=m):
    if a[n+i-1]-a[i]<small:
        small=a[n+i-1]-a[i]

    i+=1
 #   print small
print small


from math import floor,ceil

def find_possible_number(guess_number,digit,possible_table):
    if digit==len(phone_numbers):#base condition
        return 1

    m_number=int(phone_numbers[digit])
    guess_number=int(guess_number)

    num_index_configuration=str(guess_number)+str(digit)
    if num_index_configuration in possible_table:
        return possible_table[num_index_configuration]
    possible_table[num_index_configuration]=0

    has_remainder=(m_number+guess_number)%2
    if has_remainder:
        has_remainder_case(m_number, guess_number, possible_table, num_index_configuration, digit)
        return possible_table[num_index_configuration]
    else:
        has_no_remainder_case(m_number, guess_number, possible_table, num_index_configuration, digit)
        return possible_table[num_index_configuration]

def has_remainder_case(m_number, guess_number, possible_table, num_index_configuration, digit):
    upper_number=ceil((m_number+guess_number)/2)
    possible_table[num_index_configuration]+=find_possible_number(upper_number,digit+1,possible_table)
    lower_number=floor((m_number+guess_number)/2)
    possible_table[num_index_configuration]+=find_possible_number(lower_number,digit+1,possible_table)

def has_no_remainder_case(m_number, guess_number, possible_table, num_index_configuration, digit):
    next_number=(m_number+guess_number)/2
    possible_table[num_index_configuration]+=find_possible_number(next_number,digit+1,possible_table)

def has_exception(number):
    for i in range(len(phone_numbers)-1):
        if abs(int(phone_numbers[i])-int(phone_numbers[i+1]))<=1:
            pass
        else:
            return False
    return True

phone_numbers=input()
possible_table={}#with the format of ["ab"]=c. a for number, b for digit, c for possible ways
first_number=phone_numbers[0]
count=0
for i in range(10):
    count+=find_possible_number(i,1,possible_table)
if has_exception(int(phone_numbers[0])):
    count-=1

#print(possible_table)
print(count)


s=[int(c) for c in input()]
ok=1
for i in range(1,len(s)):
  if abs(s[i]-s[i-1])>1: ok=0; break
w=[1]*10
for v in s[1:]:
  ww=w[:]
  w=[0]*10
  for d in range(10):
    q,r=divmod(v+d,2)
    w[q]+=ww[d]
    if r>0:
      w[q+1]+=ww[d]

print(sum(w)-ok)


#! /usr/bin/python

x,y = map(int,raw_input().split())

nx = 0
ny = 0
step = 1
ans = 0
while True:
    newx = nx + step
    if y == ny and x >= nx and x <= newx:
       break
    ans += 1
    nx = newx
    newy = ny + step
    if x == nx and y >= ny and y <= newy:
       break
    ans += 1
    ny = newy
    step += 1

    newx = nx - step;
    if y == ny and x >= newx and x <= nx:
       break
    ans += 1
    nx = newx
    newy = ny - step
    if x == nx and y >= newy and y <= ny:
        break
    ans += 1
    ny = newy
    step += 1

print ans


def followSpiral(pt):
    if pt == (0, 0): return 0
    if pt == (1, 0): return 0
    if pt == (1, 1): return 1
    corners = [pp, np, nn, pn] = [(1, 1), (0, 0), (0, 0), (1, 0)]
    dirs = [(0, 1), (-1, 0), (0, -1), (1, 0)]
    outer = [(1, 1), (-1, 1), (-1, -1), (1, -1)]
    turns, count, pos, corner =  2, 0, pp, 1,
    while True:
        count += 1
        x, y = pos
        dx, dy = dirs[corner]
        pos = x+dx, y+dy
        if pos == pt: break
        cx, cy = corners[corner]
        ox, oy = outer[corner]
        if pos == (cx+ox, cy+oy):
            turns += 1
            corners[corner] = (cx+ox, cy+oy)
            corner = (corner+1)%4
    return turns

# IO:
inp = raw_input()
pt = tuple(map(int, inp.split(' ')))
print(followSpiral(pt))


a = list(map(int,input().split()))
if a[0] <= a[1] and a[0] <= a[2]:
  print("Yes")
else:
  print("No")


n,m,k=map(int,input().split())
if m<k:
    if m>=n:
        print('Yes')
    else:
        print('No')
elif k<m:
    if k>=n:
        print('Yes')
    else:
        print('No')
elif k==m:
    if k>=n:
        print('Yes')
    else:
        print('No')


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop,heapify
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline

from itertools import accumulate, permutations
from functools import lru_cache

M = mod = 998244353
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def inv_mod(n):return pow(n, mod - 2, mod)

def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n')]
def li3():return [int(i) for i in input().rstrip('\n')]

n = val()
rock1, sci1, paper1 = li()
rock2, sci2, paper2 = li()

def maximum():
    ans = min(rock1, sci2) + min(sci1, paper2) + min(paper1, rock2)
    return ans

def match(a, b):
    if a == b:return 0
    elif (a, b) in [(1, 2), (2, 3), (3, 1)]:return 1
    else:return -1

def give(l1, l2):
    ans = 0
    curr1 = curr2 = 0
    # print(l1, l2)
    while l1 or l2:
        try:
            if 0 == curr1:curr1 = l1.pop()
            if 0 == curr2:curr2 = l2.pop()
        except:return ans

        ans += max(0, min(curr1[0], curr2[0]) * match(curr1[1], curr2[1]))
        # print(curr1, curr2)
        if curr1[0] < curr2[0]:
            curr2[0] -= curr1[0]
            curr1 = 0
        elif curr1[0] > curr2[0]:
            curr1[0] -= curr2[0]
            curr2 = 0
        else:curr1 = curr2 = 0
    # print("ANS FOR THIS : ", ans)
    return ans

def minimum():
    ans = n
    l = [[rock1, 1], [sci1, 2], [paper1, 3]]
    l1 = [list(i) for i in list(permutations(l))]
    l = [[rock2, 1], [sci2, 2], [paper2, 3]]
    l2 = [list(i) for i in list(permutations(l))]

    ans = float('inf')
    for i in l1:
        for j in l2:
            mylist1 = [temp[:] for temp in i]
            mylist2 = [temp[:] for temp in j]
            ans = min(ans, give(mylist1, mylist2))

    return ans

print(minimum(), maximum())


import sys
import itertools
# testcases = int(sys.stdin.readline().strip())
from functools import reduce

n = int(sys.stdin.readline().strip())
# input = list(map(int, sys.stdin.readline().strip().split()))
# s = sys.stdin.readline().strip()
# t = sys.stdin.readline().strip()

inputA = list(map(int, sys.stdin.readline().strip().split()))
inputB = list(map(int, sys.stdin.readline().strip().split()))

inputA2 = inputA.copy()
inputB2 = inputB.copy()

def getWonMaxFast(inputA, inputB):
    wins = [0] * 3
    for i in range(0, 3):
        good = (i + 1) % 3
        wins[i] = min(inputA[i], inputB[good])
        inputA[i] -= wins[i]
        inputB[good] -= wins[i]
    return sum(wins)

def getLostMaxFast(inputA, inputB):
    waysToLose = [[0, 2], [1, 0], [2, 1], [0, 0], [1, 1], [2, 2]]

    allWaysToLosePermutations = list(itertools.permutations(waysToLose))

    maxLost = 0

    for permutation in allWaysToLosePermutations:
        losts = [0] * 3
        inputACopy = inputA.copy()
        inputBCopy = inputB.copy()

        for wayToLose in permutation:
            lost_add = min(inputACopy[wayToLose[0]], inputBCopy[wayToLose[1]])
            inputACopy[wayToLose[0]] -= lost_add
            inputBCopy[wayToLose[1]] -= lost_add
            losts[wayToLose[0]] += lost_add

        lostSum = sum(losts)

        if lostSum > maxLost:
            maxLost = lostSum

    return maxLost

print(n - getLostMaxFast(inputA2, inputB2), getWonMaxFast(inputA, inputB))


def main():
    turnNum = int(input())
    # choices include rock, scissor, paper respectively
    aliceChoices = list(map(int, input().split(' ')))
    bobChoices = list(map(int, input().split(' ')))

    bobChoices.append(bobChoices.pop(0))
    minWin, maxWin = [0, 0]

    # calculate the maximum number of rounds Alice can win
    for i, choice in enumerate(aliceChoices):
        maxWin += min([choice, bobChoices[i]])

    # calculate the minimum number of rounds Alice can win
    maximum = max(bobChoices)
    for i, choice in enumerate(bobChoices):
        if choice == maximum and choice + aliceChoices[i] > minWin:
            minWin = choice + aliceChoices[i]
    maximum = max(aliceChoices)
    for i, choice in enumerate(aliceChoices):
        if choice == maximum and choice + bobChoices[i] > minWin:
            minWin = choice + bobChoices[i]
    minWin = minWin - turnNum if minWin > turnNum else 0
    print(f'{minWin} {maxWin}')

if __name__ == '__main__':
    main()


# get the number of round as n
# get the amount of first person take rock paper scissors as r1 s1 p1 as follow
# get the amount of second person take rock paper scissors as r2 s2 p2 as follow
# how to win ? r1_s2 p1_r2 s1_p2

round = int(input())
firstperson = input().split(" ")
secondperson = input().split(" ")

def solve(round, firstperson, secondperson) :

    # find mix win
    win = 0
    secondperson.append(secondperson[0])
    for i in range(len(firstperson)) :
        if int(firstperson[i]) <= int(secondperson[i+1]) :
            findless = int(firstperson[i])
        else :
            findless = int(secondperson[i+1])
        win += findless

    del secondperson[3]

    #find min win
    secondperson.insert(0, secondperson[2])

    for i in range(len(firstperson)) :
        if int(firstperson[i]) > 0:
            diff = min(int(firstperson[i]), int(secondperson[i]))
            firstperson[i] = int(firstperson[i]) - int(diff)
            secondperson[i] = int(secondperson[i]) - int(diff)
            if int(firstperson[i]) > 0:
                diff = min(int(firstperson[i]), int(secondperson[i+1]))
                firstperson[i] = int(firstperson[i]) - int(diff)
                secondperson[i+1] = int(secondperson[i+1]) - int(diff)

    print(str(int(firstperson[0]) + int(firstperson[1]) + int(firstperson[2])) + " " + str(win))

solve(round, firstperson, secondperson)


from sys import stdin, stdout
import math
import heapq
import collections
input = stdin.readline
def inputnum():
    return(int(input()))
def inputnums():
    return(map(int,input().split()))
def inputlist():
    return(list(map(int,input().split())))
def inputstring():
    return([x for x in input()])
def inputstrings():
    return([x for x in input().split()])
def inputstringnum():
    return([ord(x)-ord('a') for x in input()])
def inputmatrixchar(rows):
    arr2d = [[j for j in input().strip()] for i in range(rows)]
    return arr2d
def inputmatrixint(rows):
    arr2d = []
    for _ in range(rows):
        arr2d.append([int(i) for i in input().split()])
    return arr2d

n = inputnum()
a1, a2, a3 = inputnums()
b1, b2, b3 = inputnums()
mn = min(a1, b1+b3) + min(a2, b2+b1) + min(a3, b3+b2)
mx = min(a1, b2) + min(a2, b3) + min(a3, b1)
print(n-mn, mx)


import sys
import math
import itertools
original_stdout = sys.stdout

var_for_sublime = False

if var_for_sublime:
	fin = open('input.txt' , 'r')
	fout = open('output.txt' , 'w')
	sys.stdout = fout
	def give_string():
		return fin.readline().strip()
else:
	fin = sys.stdin
	fout = sys.stdout
	def give_string():
		return fin.buffer.readline().strip()

def give_list():
	return list(map(int, give_string().split()))
def give_int():
	return int(give_string())

MOD = 1e9+ 7
def modpow( a , p) :
	ans = 1
	while p :
		if p&1 :
			ans *= a
			ans %= MOD
		p >>= 1
		a *= a
		a %= MOD
	return ans

def fac_cal(n):
	ans = 1
	for i in range(1 , n+1):
		ans *= i
		ans %= MOD
	return ans

def solve():
	t = 1
	l = list(itertools.permutations([1 ,2 ,3, 4,5,6]))
	n = give_int()
	a1 ,a2 ,a3 = give_list()
	b1 , b2 , b3 = give_list()
	mx = min(a1 , b2) + min(a2 , b3) + min(a3 , b1)
	temp = 0
	for per in l :
		ta1 ,ta2 , ta3 , tb1 , tb2 ,tb3 = a1 , a2 , a3 , b1 ,b2 , b3
		tmx = 0
		for el in per :
			if el == 1:
				t1 = min(ta1 , tb1)
				ta1 -= t1
				tb1 -= t1
				tmx += t1
			elif el == 2:
				t1 = min(ta1 , tb3)
				ta1 -= t1
				tb3 -= t1
				tmx += t1
			elif el == 3:
				t1 = min(ta2 , tb2)
				ta2 -= t1
				tb2 -= t1
				tmx += t1
			elif el==4:
				t1 = min(ta2 , tb1)
				tb1 -= t1
				ta2 -= t1
				tmx += t1
			elif el== 5:
				t1 = min(ta3 , tb3)
				ta3 -= t1
				tb3 -= t1
				tmx += t1
			elif el ==6:
				t1 = min(ta3 , tb2)
				tb2 -= t1
				ta3 -= t1
				tmx += t1
		temp = max(temp , tmx)
	print(n-temp , end = ' ')
	print(mx)

def Hey_Yashwant():
	try :
		t = 1
		# t = give_int()
		for i in range(t):
			solve()
	finally:
		fin.close()
		fout.close()
		sys.stdout = original_stdout

if __name__ == '__main__' :
	Hey_Yashwant()


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c for j in range(b)] for i in range(a)]
def list3d(a, b, c, d): return [[[d for k in range(c)] for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10**19
MOD = 10**9 + 7
EPS = 10**-10

class Dinic:

    INF = 10**18

    def __init__(self, n):
        self.n = n
        self.links = [[] for _ in range(n)]
        self.depth = None
        self.progress = None
        self.pos = []

    def copy(self):
        res = Dinic(self.n)
        res.links = [[a[:] for a in b] for b in self.links]
        res.pos = [a[:] for a in self.pos]
        return res

    def add_edge(self, _from, to, cap):
        self.pos.append((_from, len(self.links[_from])))
        self.links[_from].append([cap, to, len(self.links[to])])
        self.links[to].append([0, _from, len(self.links[_from]) - 1])

    def bfs(self, s):
        from collections import deque

        depth = [-1] * self.n
        depth[s] = 0
        q = deque([s])
        while q:
            v = q.popleft()
            for cap, to, _ in self.links[v]:
                if cap > 0 and depth[to] < 0:
                    depth[to] = depth[v] + 1
                    q.append(to)
        self.depth = depth

    def dfs(self, v, t, flow):
        if v == t:
            return flow
        links_v = self.links[v]
        for i in range(self.progress[v], len(links_v)):
            self.progress[v] = i
            cap, to, rev = link = links_v[i]
            if cap == 0 or self.depth[v] >= self.depth[to]:
                continue
            d = self.dfs(to, t, min(flow, cap))
            if d == 0:
                continue
            link[0] -= d
            self.links[to][rev][0] += d
            return d
        return 0

    def flow(self, s, t):
        INF = Dinic.INF
        flow = 0
        while True:
            self.bfs(s)
            if self.depth[t] < 0:
                return flow
            self.progress = [0] * self.n
            current_flow = self.dfs(s, t, INF)
            while current_flow > 0:
                flow += current_flow
                current_flow = self.dfs(s, t, INF)

    def get_edge(self, i):
        e = self.links[self.pos[i][0]][self.pos[i][1]]
        re = self.links[e[1]][e[2]]
        # from, to, cap, flow
        return (self.pos[i][0], e[1], e[0]+re[0], re[0])

    def get_edges(self):
        M = len(self.pos)
        res = []
        for i in range(M):
            res.append(self.get_edge(i))
        return res

N = INT()
M = 3
A = LIST()
B = LIST()

ans1 = 0
for i in range(M):
    ans1 += min(A[i], B[(i+1)%M])

ans2 = 0
dinic = Dinic(2*M+2)
s = 2*M
t = 2*M + 1
for i in range(M):
    # s to Alice
    dinic.add_edge(s, i, N)
    # Bob to t
    dinic.add_edge(M+i, t, B[i])
    # draw
    dinic.add_edge(i, M+i, A[i])
    # Alice lose
    dinic.add_edge(i, M+(i-1)%M, A[i])
ans2 = N - dinic.flow(s, t)

print(ans2, ans1)


n=input()
if len(n)==1:
    print(0)
elif n[::-1]!=n:
    print(len(n))
else:
    while True:
        n=n[:-1]
        s=n[::-1]
        if s!=n:
            print(len(s))
            break
        elif len(s)==1:
            print(0)
            break


a = input()
ans = 0
b = a
for i in range(len(a)):
	if a == a[::-1]:
		b = a[i:]
		if b != b[::-1]:
			ans = len(a)-i
			break
	elif a != a[::-1]:
		ans = len(a)
	elif a[i]==a[i-1]:
		ans  = 0
print(ans)


'''input
3 3
'''

# a + b = a^b + (a&b)*2
s, x = map(int, raw_input().split())
d = s-x  # d/2 is a&b

if d%2 or (d/2 & x):
    print 0
else:
    print 2**bin(x).count('1') - (0 if d else 2)


# coding: utf-8

i = raw_input().split(" ")
m = long(i[0])
p = long(i[1])
x = p
dif = m-x
if (dif%2==1 or x> m):
	print(0)
else:
	dif = dif/2
	s = ""
	while (dif != 0):
		if (dif%2==1):
			dif -= 1
			s += "1"
		else:
			s += "0"
		dif /= 2
	ind = 0
	st = ""
	n = long(1)
	th = True
	while (x != 0):
		if (x%2==1):
			x -= 1
			st += "1"
			n = long(n*long(2))
		else:
			st += "0"
		x /= 2
		if (ind < len(s) and s[ind] == "1" and "1" == st[ind]):
			th = False
			break
		ind += 1
	if (th):
		if (m == p):
			print(long(n-2))
		else:
			print(long(n))
	else:
		print(0)


n, m, a, b = [int(x) for x in input().split()]
print(min((n - n // m * m) * b, ((n // m + 1) * m - n) * a))


import math
s = input().split()
for i in range(4):
    s[i] = int(s[i])
print(min((s[1]-s[0]%s[1])*s[2],(s[0]%s[1])*s[3]))


t = input()
l = []
for i in range(10):
	t1 = input()
	l.append(t1)
for i in range(10,90,10):
	for j in range(len(l)):
		if t[i-10:i] == l[j]:
			print(j,end="")
			break


c=[input() for i in range(11)]
x=[ c[0][i:i+10]     for i in range(0,80,10)]
for i in x:
    print(c.index(i)-1,end='')


n,l,r=map(int,input().split())
x=1

sum1=0
sum2=0

for i in range(l) :
    sum1+=x
    x=x*2
for i in range(n-l) :
    sum1+=1

x=1
for i in range(r) :
    sum2+=x
    x*=2
x=x//2

for i in range(n-r) :
    sum2+=x
print(sum1,sum2,sep=" ")


def fall_fac(n,k):
	ans = 1
	for i in range(k):
		ans *= n-i
	return ans
def C(n,k):
	if not(0 <= k <= n):
		return 0
	else:
		return fall_fac(n,k)//fall_fac(k,k)
def derangement(n):
	if n==0:
		return 1
	elif n==1:
		return 0
	else:
		return (n-1)*(derangement(n-1)+derangement(n-2))
n, k = [int(x) for x in input().split()]
print(sum([C(n,i)*derangement(i) for i in range(k+1)]))


c = 1

n, k =map(int, input().split())

if k >= 2 :
	tmp = 1
	for i in range(3,n+1):
		tmp *= i
	for i in range(2,n-1):
		tmp = tmp // i
	c += tmp

if k >= 3 :
	tmp = 1
	for i in range(4,n+1):
		tmp *= i
	for i in range(2,n-2):
		tmp = tmp // i
	c += tmp*2

if k == 4 :
	tmp = 1
	for i in range(5,n+1):
		tmp *= i
	for i in range(2,n-3):
		tmp = tmp // i
	c += tmp*9

print(c)


a,b,s=map(int,raw_input().split())
t=abs(a)+abs(b)
if (t-s)&1==1 or s<t:
    print "NO"
else:
    print "YES"


a, b, s = map(int, input().split())
a = abs(a)
b = abs(b)

if s < a + b:
	print('No')
elif (s - a - b) % 2 == 0:
	print('Yes')
else:
	print('No')


n = input()
if n <= 127:
    print 'byte'
elif n <= 32767:
    print 'short'
elif n <= 2147483647:
    print 'int'
elif n <= 9223372036854775807:
    print 'long'
else:
    print 'BigInteger'


a, b, c, d, x, y = map(int, raw_input().split())
print sum(v % a % b % c % d == v for v in range(x, y + 1))


a=input()
s=b=0
for i in a:
    if i.isupper():s+=1
    else:b+=1
if s<=b:print(a.lower())
else:print(a.upper())


input_string=raw_input()
str_len = len(input_string)

upper=[i for i in input_string if i.isupper()]

if len(upper)>str_len/2:
	print input_string.upper()
else:
	print input_string.lower()


__author__ = 'Devesh Bajpai'

'''
https://codeforces.com/problemset/problem/581/A

Solution:
'''

def solve(a, b):

    diff_sock_days = min(a, b)
    same_sock_days = (max(a, b) - diff_sock_days) / 2

    return str(diff_sock_days) + " " + str(same_sock_days)

if __name__ == "__main__":

    a, b = map(int, raw_input().split(" "))
    print solve(a, b)


a,b=map(int,raw_input().split(' '))
print min(a,b),abs(a-b)/2


n,m = [int(i) for i in input().split()]
k = 0
while n>=2 and m>=1 or n>=1 and m>=2:
    if m>n: m,n,k = m-2,n-1,k+1
    else: m,n,k = m-1,n-2,k+1
print(k)


n, e = map(int, input().split())
groups = 0
small = min(n, e)
big = max(n, e)
for i in range(big):
    if big >= 2 and small >= 1:
        groups += 1
        big -= 2
        small -= 1
    elif big >= 1 and small >= 2:
        groups += 1
        big -= 1
        small -= 2
    else:
        break
    #print(small, big)
    a = small
    b = big
    small = min(a, b)
    big = max(a, b)
    #print(small, big)
    #print("\n")
print(groups)


l = map(int,raw_input().split(' '))
l.sort()
result  =  sum(l)/3
if l[1]+l[0]<result:
    result = l[1]+l[0]
print result


import math
r,g,b=map(int,input().split(" "))
li = [r,g,b]
li.sort()
if(li[2]>2*(sum(li)-li[2])):
    print(sum(li)-li[2])
else:
    print(sum(li)//3)


import sys,math
from math import factorial as fact
from collections import defaultdict as dd
input = lambda: sys.stdin.readline().strip()
inp = lambda: list(map(int,input().split()))
mod = 10**9+7
#---------------------------------------------------
def C(n,r):
    if r>n:
        return 0
    return fact(n)//(fact(n-r)*fact(r))
def P(n,r):
    # if n==0:
    #     return 0
    if r>n:
        return 0
    return fact(n)//fact(n-r)
# for _ in range(int(input())):
n , x, pos = inp()
a = [i for i in range(n)]
g = 0
l = 0
def bins(a,x,n):
    global g,l
    left = 0
    right = n
    while (left<right):
        mid = (left+right)//2
        if a[mid]==x:
            left = mid+1
        elif a[mid]<x:
            left = mid+1
            l+=1
        else:
            right = mid
            g+=1
    if left>0 and a[left-1]==x:
        return
    else:
        return
bins(a,pos,n)
dc = n-g-l-1
actg = n-x
actl = x-1
# print(g,l,actl,actg,dc)
# print(dc)
ans = P(actg,g)*P(actl,l)*P(n-g-l-1,dc)
print(ans%mod)


# Legends Always Come Up with Solution
# Author: Manvir Singh

import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict,deque,Counter
from bisect import *
from math import sqrt,pi,ceil,log
import math
from itertools import permutations
from copy import deepcopy
from sys import setrecursionlimit

def main():
    n,x,pos = map(int,input().split())
    mod=10**9+7
    f=[1]
    for i in range(1,1001):
        f.append((f[-1]*i)%mod)
    lo=0
    hi=n
    b=x-1
    c=n-x
    ans=1
    while lo<hi:
        mid=(lo+hi)//2
        if mid<pos:
            ans=(ans*b)%mod
            b-=1
            lo=mid+1
        elif mid>pos:
            ans=(ans*c)%mod
            c-=1
            hi=mid
        else:
            lo=mid+1
    print((ans*f[b+c])%mod)

# region fastio
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")

if __name__ == "__main__":
    main()


n=int(input())
a=int(n/10)
b=n%10
if(a==1 or a==7 or a==2 or a==9 or b==1 or b==7 or b==9):
    if(a==1 and b==2):
        print('YES')
    else:
        print('NO')
else:
    print('YES')


num2words = {1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', \
             6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine', 10: 'Ten', \
            11: 'Eleven', 12: 'Twelve', 13: 'Thirteen', 14: 'Fourteen', \
            15: 'Fifteen', 16: 'Sixteen', 17: 'Seventeen', 18: 'Eighteen', \
            19: 'Nineteen', 20: 'Twenty', 30: 'Thirty', 40: 'Forty', \
            50: 'Fifty', 60: 'Sixty', 70: 'Seventy', 80: 'Eighty', \
            90: 'Ninety', 0: 'Zero'}
def n2w(n):
    if n <= 20:
        return num2words[n].lower()
    return num2words[n-n%10].lower() + num2words[n%10].lower()

n = int(input())
print('YES' if 'n' not in n2w(n) else 'NO')


def nir(n):
    if n < 10:
        return max(1,n)
    else:
        p = nir(n//10)*(n%10)
        q = nir(n//10-1)*9
        return max(p,q)

n = int(input())
ans = nir(n)
print(ans)


def getMax(num):
    arr = list(num)
    prod = 1
    for a in arr:
        prod = prod*int(a)
    return prod

n = input()
num = list(n)

i = len(n)-1
maxP = getMax(n)

if len(n) > 1:
    while i>0:
        num[i] = '9'
        while int(num[i-1]) == 0:
            num[i-1] = '9'
            i = i - 1
        if int(num[i-1]) > 1:
            num[i-1] = str(int(num[i-1]) - 1)

        #print(num)
        maxP = max(getMax(''.join(num)),maxP)
        i = i-1
    print(maxP)
else:
    print(n)
"""

minNum = num[:]
minNum[0]  = int(minNum[0]) - 1
minNum[0] = str(minNum[0])
for i in range(1,len(minNum)):
    minNum[i] = '9'

minN = ''.join(minNum)
minN = int(minN)
n = int(n)

maxP = 0
for a in range(minN,n+1):
    maxP = max(getMax(str(a)),maxP)
print(maxP)

"""


def getPow(data,a):
    left = 0
    right = data
    while left <= right:
        mid = (left+right)//2
        if (mid**a)<data:
            left = mid + 1
        elif (mid**a)==data:
            return mid
        else:
            right = mid - 1
    return left-1

def tack():
    data = int(input())
    squ = getPow(data,2)
    cube = getPow(data,3)
    six = getPow(data,6)
    ans = squ + cube - six
    print(ans)

def main():
    n = int(input())
    for x in range(n):
        tack()

main()


import sys
from collections import *
sys.setrecursionlimit(10**5)
itr = (line for line in sys.stdin.read().strip().split('\n'))
INP = lambda: next(itr)
def ni(): return int(INP())
def nl(): return [int(_) for _ in INP().split()]

import math
def solve(n):
    seen = {}
    #print(int(math.floor(math.sqrt(n))) + 1)
    #print(low)
    for i in range(1,int(math.floor(math.sqrt(n)))+ 1):
        a, b = i ** 2, i ** 3
        #print(i)
        if a not in seen:
            seen[a] = True
        if b <= n and b not in seen:
            seen[b] = True
    #print()
    print(len(seen.keys()))

t = ni()
for case in range(t):
    n = ni()
    solve(n)


#!/usr/bin/python

def ir():
    return int(raw_input())

def ia():
    line = raw_input()
    line = line.split()
    return map(int, line)

def solve():
    n, tm = ia()
    a = ia()

    s = sum(a)
    j = (n - 1)*10

    if s + j>tm:
        print -1
        return

    rem = tm - (s + j)
    ej  = rem / 5

    print 2*(n - 1) + ej

solve()


t=list(map(int,input().split()))
s=list(map(int,input().split()))
sum=i=0
for i in range(t[0]):
    sum=sum+s[i]
    if i !=t[0]-1:
        sum=sum+10
if sum<=t[1]:
    print((t[0]-1)*2+int((t[1]-sum)/5))
else:
    print(-1)


s = raw_input()
if len(set(s)) % 2 == 0:
    print "CHAT WITH HER!"
else:
    print "IGNORE HIM!"


arrs = []
for char in input():
    if char not in arrs:
        arrs.append(char)
if len(arrs) % 2 != 0:
    print('IGNORE HIM!')
else:
    print('CHAT WITH HER!')


n = input()
ans = -1
for sx in xrange(18 * 9 + 1):
     delta = long( (sx * sx + 4 * n) ** 0.5 )
     if delta * delta != sx * sx + 4 * n:
        continue
     x = ( -sx + delta ) / 2
     if x * 2 == -sx + delta:
        tmp = x
        s = 0
        while tmp > 0:
            s += tmp % 10
            tmp /= 10
        if s == sx:
            ans = x
            break
print ans


n=int(input())
m=int(n**(1/2))
for i in range(max(0,m-10**3),m+10**3):
    if i*i+sum(list(map(int,str(i))))*i==n:
        print(i)
        exit()
print(-1)


#I = lambda: [int(i) for i in input().split()]
#import io, os, sys
#input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

# n = int(input())
# l1 = list(map(int,input().split()))
# n,x = map(int,input().split())
# s = input()
mod =  1000000007
# print("Case #"+str(_+1)+":",)
from collections import defaultdict
import bisect
import sys,math

for _ in range(int(input())):
    n,k= map(int,input().split())
    print(pow(n,k,mod))


#import sys
#import math
#sys.stdout=open("C:/Users/pipal/OneDrive/Desktop/VS code/python/output.txt","w")
#sys.stdin=open("C:/Users/pipal/OneDrive/Desktop/VS code/python/input.txt","r")
t=int(input())
for i in range(t):
   # n=int(input())
    c=0
    mod=10**9+7
    n,k=(map(int,input().split()))
    print(n**k%mod)
   # print(half)


n, m = map(int,input().split())

min_answer = n + max(m - n, 0)

max_answer = n + max(0, m - 1)

if n == 0 and m == 0:
    print("0 0")
    exit(0)

if n == 0 :
    print("Impossible")
    exit(0)

print(min_answer, max_answer)


n,m=map(int,input().split())
if n==0 and m!=0:
	print('Impossible')
elif m<=n:
	print(n,end=' ')
	# print(m+n-1)

elif m>n:
	print(m,end=' ')
	# print(m+n-1)
if m!=0 and n!=0:
	print(m+n-1)
elif m==0 :
	print(n)


from sys import stdin
from collections import *

def arr_inp(n):
    if n == 1:
        return [int(x) for x in stdin.readline().split()]
    elif n == 2:
        return [float(x) for x in stdin.readline().split()]
    else:
        return list(stdin.readline()[:-1])

f = arr_inp(1)
mi, days, d = min(f[0] // 3, f[1] // 2, f[2] // 2), deque([i for i in range(7)]), {0: 1, 1: 0, 2: 0, 3: 1, 4: 2, 5: 0,
                                                                                6: 2}
ans = mi * 7
f[0] -= mi * 3
f[1] -= mi * 2
f[2] -= mi * 2

ma = 0
for i in range(7):
    tem, f1, flag = 0, f.copy(), 1

    for j in range(7):
        if f1[d[days[0]]] and flag:
            f1[d[days[0]]] -= 1
            tem += 1
        else:
            flag = 0
        days.rotate(-1)

    days.rotate(-1)
    ma, flag = max(ma, tem), 1

print(ans + ma)


def judge(x):
    w, d = divmod(x, 7)
    a2 = 3*w+l[:d].count('a')
    b2 = 2*w+l[:d].count('b')
    c2 = 2*w+l[:d].count('c')

    return a>=a2 and b>=b2 and c>=c2

def binary_search():
    l, r = 0, 10**10

    while l<=r:
        mid = (l+r)//2

        if judge(mid):
            l = mid+1
        else:
            r = mid-1

    return r

a, b, c = map(int, input().split())
l = list('abcacba')
ans = 0

for _ in range(7):
    ans = max(ans, binary_search())
    l = l[1:]+[l[0]]

print(ans)


import configparser
import math
import sys

input = sys.stdin.readline

def main():

    n = int(input())
    a = sorted([int(x) for x in input().split(' ')])

    i = 1
    ans = 0
    for p in a:
        ans += abs(p - i)
        i += 2

    i = 2
    ans2 = 0
    for p in a:
        ans2 += abs(p - i)
        i += 2

    print(min(ans, ans2))

if __name__ == '__main__':
    main()


n = int(input())
board = sorted(map(int,input().split()))
b = w = 0
for i in range(n//2):
    b += abs(board[-i-1] - (n-i*2))
    w += abs(board[-i-1] - (n-1-i*2))
print(min(b,w))


x = input()
inp  = input().split(" ")
chest = 0
back = 2
biceps = 1
count = [0, 0, 0]
for i in range(len(inp)):
    if i==chest:
        count[0]+=int(inp[chest])
        chest+=3
    if i==biceps:
        count[1]+=int(inp[biceps])
        biceps+=3
    if i==back:
        count[2]+=int(inp[back])
        back+=3
maxVal = max(count)
if count[0]==maxVal:
    print("chest")
elif count[1]==maxVal:
    print("biceps")
else:
    print("back")


ch="chest"
bi="biceps"
ba="back"
m={ch:0,bi:0,ba:0}
n=int(input())
a=map(int,input().split())
s=[ch,bi,ba]*n
z=zip(s[:n],a)
for e,ai in z:
    m[e]+=ai
print(max(m,key=m.get))


n,p,k=input().split()
n=int(n)
p=int(p)
k=int(k)
s=p+k
t=p-k
if s>=n and t<=1:
	for i in range(1,p,1):
		print(i,end=' ')
	print('(',end='')
	print(p,end='')
	print(')',end=' ')
	for i in range(p+1,n+1,1):
		print(i,end=' ')
if s>=n and t>1:
	print('<<',end=' ')
	for i in range(t,p,1):
		print(i,end=' ')
	print('(',end='')
	print(p,end='')
	print(')',end=' ')
	for i in range(p+1,n+1,1):
		print(i,end=' ')
if s<n and t<=1:
	for i in range(1,p,1):
		print(i,end=' ')
	print('(',end='')
	print(p,end='')
	print(')',end=' ')
	for i in range(p+1,s+1,1):
		print(i,end=' ')
	print('>>',end=' ')
if s<n and t>1:
	print('<<',end=' ')
	for i in range(p-k,p,1):
		print(i,end=' ')
	print('(',end='')
	print(p,end='')
	print(')',end=' ')
	for i in range(p+1,s+1,1):
		print(i,end=' ')
	print('>>',end=' ')


n,p,k=map(int,input().split())
if(p<1 or p>n):
    print(None)
else:
    if(p-k>1 and p+k<n):
        print("<<"," ".join("(%d)"%(i) if i==int(((p-k)+(p+k))/2) else str(i) for i in range(p-k,p+k+1)),">>")
    elif(p-k<=1 and p+k>=n):
        print(" ".join("(%d)"%(i) if i==int(((p-k)+(p+k))/2) else str(i) for i in range(1,n+1)))
    elif(p-k>1):
        print("<<"," ".join("(%d)"%(i) if i==int(((p-k)+(p+k))/2) else str(i) for i in range(p-k,n+1)))
    elif(p+k<n):
        print(" ".join("(%d)"%(i) if i==int(((p-k)+(p+k))/2) else str(i) for i in range(1,p+k+1)),">>")


n,a,b = map(int,raw_input().split())
pos = n-a
if pos <= b: print pos
else:print b+1


import fileinput as f

for line in f.input():
    if f.isfirstline():
        data = map(int, line.split())

[n, a, b] = data

if n - a - 1 >= b:
    print b + 1
else:
    print n - a


n = input()
s = raw_input().strip()
cnt = 0
for c in s:
	if c == "+":
		cnt += 1
	else:
		cnt = max(0, cnt - 1)
print cnt


n=int(input())
a=list(input())
c=[]
flag=0
for i in range(101):
    k = i
    flag=0
    for j in range(len(a)):
        if a[j]=='+':
            k+=1
        elif a[j]=='-' and k>0:
            k-=1
        else:
            flag=1
            break
    if flag==0:
        break
print(k)


import fractions

n, m, x, y, a, b = [int(i) for i in raw_input().strip().split()]

g = fractions.gcd(a, b)
if g != 1:
   a /= g
   b /= g

h = n / a
v = m / b
scale = min(h, v)
h = a * scale
v = b * scale

bottomleftx = 0
bottomlefty = 0
toprightx = 0
toprighty = 0

if h % 2 == 1:
    bottomleftx = x - (h+1)/2
else:
    bottomleftx = x - h/2
if bottomleftx < 0:
    bottomleftx = 0
toprightx = bottomleftx + h

rightx = x + h/2
if rightx > n:
    toprightx = n
    bottomleftx = n - h

if v % 2 == 1:
    bottomlefty = y - (v+1)/2
else:
    bottomlefty = y - v/2
if bottomlefty < 0:
    bottomlefty = 0
toprighty = bottomlefty + v

topy = y + v/2
if topy > m:
    toprighty = m
    bottomlefty = m - v

print bottomleftx, bottomlefty, toprightx, toprighty


from fractions import*
n,m,x,y,a,b=map(int,raw_input().split())
c=gcd(a,b)
a/=c
b/=c
t=min(n/a,m/b)
a*=t
b*=t
X,Y=x-(a+1)/2,y-(b+1)/2
if X<0:X=0
if X+a>n:X=n-a
if Y<0:Y=0
if Y+b>m:Y=m-b
print X,Y,X+a,Y+b


s = input()
num = 0
n = len(s)
ans = ["YES","NO"]
for i in range(n):
    num += int(s[i] != s[n-1-i])

if num == 2:
    print(ans[0])
elif num == 0 and n % 2 == 1:
    print(ans[0])
else:
    print(ans[1])


s = raw_input()
x = s[::-1]
if len(s) ==1:
    print 'YES'
    exit()
if s == x:
    if len(s)%2 ==1:
        print 'YES'
    else:
        print 'NO'
    exit()

r = len(s)/2
c =0
for x in range(r):
    if s[x] !=s[len(s)-1-x]:
        c= c+1

if c ==1:
    print 'YES'
else:
    print 'NO'


"""
Author    : raj1307
Institute : Jalpaiguri Government Engineering College
Date      : 16.04.19
"""
from __future__ import division, print_function
import itertools,os,sys
#from collections import deque, Counter, OrderedDict
#from heapq import nsmallest, nlargest, heapify, #heappop ,heappush, heapreplace
#from math import ceil,floor,log,sqrt,factorial,pow,pi
#from bisect import bisect_left,bisect_right
#from decimal import *

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
else:
    from builtins import str as __str__
    str = lambda x=b'': x if type(x) is bytes else __str__(x).encode()

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._buffer = BytesIO()
        self._fd = file.fileno()
        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):
        return self._buffer.read() if self._buffer.tell() else os.read(self._fd, os.fstat(self._fd).st_size)

    def readline(self):
        while self.newlines == 0:
            b, ptr = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)), self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
            self.newlines += b.count(b'\n') + (not b)
        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)

sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip(b'\r\n')

def print(*args, **kwargs):
    sep, file = kwargs.pop('sep', b' '), 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', b'\n'))
    if kwargs.pop('flush', False):
        file.flush()

def ii(): return int(input())
def si(): return str(input())
def mi():return map(int,input().strip().split(" "))
def li():return list(mi())

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}
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 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)%p1
    return res
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

# For getting input from input.txt file
#sys.stdin = open('input.txt', 'r')

# Printing the Output to output.txt file
#sys.stdout = open('output.txt', 'w')

def main():

    n=ii()
    l=li()
    """s=sum(l)
    a=s//n
    b=a+1
    c=a-1
    x=[]
    y=[]
    z=[]
    d=0
    e=1000000000
    if n==2:
        d=abs(l[0]-l[1])
    for i in range(n):
        if l[i]!=a:
            x.append(abs(l[i]-a))
    if len(list(set(x)))==1 and x[0]>=0:
        if n==2:
            d=min(d,x[0])
        else:
            e=min(x[0],e)
    if len(x)==0:
        print(0)
        exit()
    for i in range(n):
        if l[i]!=b:
            y.append(abs(l[i]-b))
    if len(list(set(y)))==1 and y[0]>=0:
        if n==2:
            d=min(d,y[0])
        else:
            e=min(e,y[0])

    if len(y)==0:
        print(0)
        exit()
    for i in range(n):
        if l[i]!=c:
            z.append(abs(l[i]-c))
    if len(list(set(z)))==1 and z[0]>=0:
        if n==2:
            d=min(d,z[0])
        else:
            e=min(e,z[0])
    else:
        if n==2:
            print(d)
            exit()
        else:
            print(-1)
            exit()
    if len(z)==0:
        print(0)
        exit()
    print(e)"""

    m=1000000000
    for i in range(0,101):
        x=[]
        for j in range(n):
           if i!=l[j]:
              x.append(abs(i-l[j]))
        if len(list(set(x)))==1 or len(x)==0:
            if len(x)==0:
                print(0)
                exit()
            else:
                m=min(m,x[0])

    if m==1000000000:
        print(-1)
    else:
        print(m)

if __name__ == "__main__":
    main()


import sys
n=int(input())
l=list(map(int,input().split()))
l.sort()
g=(l[n-1]-l[0])
t=1
for i in range(1,n):
   if (l[i]-l[i-1])==g or (l[i]-l[i-1])==0:
       continue
   elif (l[i]-l[i-1])==g/2:
       t=2
       continue
   else:
       print(-1)
       sys.exit()
if g%2==0:
    print(g//2)
else:
    print(g)


n = int(input())
s = list(map(int, input().split()))
a = 0
for i in range(n+1):
    x = s[:i].count(0)
    y = s[i:].count(1)
    a = max(a, x+y)
print(a)


import sys

#######################################################################

def get_lines():
	return sys.stdin.readlines()

#######################################################################

def diversity():
	lines = sys.stdin.readlines()
	s = lines[0][0:-1]
	k = int(lines[1])

	if k > len(s) or k > 26:
		print "impossible"
		return 0

	unique = ''
	for c in s:
		if not c in unique:
			unique += c

	print max(0, k - len(unique))
	return 0

#######################################################################

def curriculum():
	lines = get_lines()
	n = int(lines[0])
	s = [int(word) for word in lines[1].split()]
	max_kept = 0
	pos = 0
	for start in range(len(s)):
		removed = 0
		for before_start in s[:start]:
			if before_start == 1:
				removed += 1
		for after_start in s[start+1:]:
			if after_start == 0:
				removed += 1
		if n - removed > max_kept:
			max_kept = n - removed
			#print pos
		pos += 1

	print max_kept
	return max_kept

curriculum()


x1,y1,z1=input().split()
x2,y2,z2=input().split()
if x1==x2 or y1==y2 or z1==z2:
    print("YES")
else:
    print("NO")


a, b, c = list(map(int,input().strip().split(' ')))
x, y, z = list(map(int,input().strip().split(' ')))
print("YES" if a == x or b == y or c == z else "NO")


N,K = map(int,raw_input().split())
A,B = map(int,raw_input().split())

def gcd(a,b):
    if not a:
        return b
    if not b:
        return a
    return gcd(b,a%b)

cur = 1+A
nxt = []

for i in range(N):
    nxt.append((1+i*K)-B)
    nxt.append((1+i*K)+B)

ans = [0,10000000000]

for i in nxt:
    L = i-cur
    if L > N*K or L < 0:
        L %= N*K
    if not L:
        L = N*K
    temp = gcd(L,N*K)
    ans[0] = max(ans[0],N*K/temp)
    ans[1] = min(ans[1],N*K/temp)

print ans[1],ans[0]


def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

def my_gcd(fact, mm):
    # print("my_gcd",fact,mm)
    res = 1
    for i in fact:
        if mm % i == 0:
            mm = mm // i
            res = res * i
    # print("my_gcd", res)
    return res

def solve(n,k,a,b):
    qq = [a+b,a-b,-a-b,-a+b]
    mini=n*k
    maxi = 0

    factN = prime_factors(n)
    fact = factN + prime_factors(k)

    m = n*k
    for q in qq:
        for t in range(1,n+1):
            mm = t*k + q
            if mm > 0:
                x = my_gcd(fact, mm)
                # print(x)
                y = m//x
                if y < mini:
                    mini = y
                if y > maxi:
                    maxi = y
    return mini, maxi

n,k = input().split()
n = int(n)
k = int(k)

a, b = input().split()
a = int(a)
b = int(b)

x,y = solve(n,k,a,b)
print(x,y)


mp = lambda: map(int, raw_input().split())
n, k = mp()
for ans in range(1000):
    if 2*ans + (n-ans)*3 <= k:
        break
print ans


n,k = map(int,raw_input().split())
if k>= 3*n:
    print 0
else:
    x = 3*n - k
    print x


"""Template for Python Competitive Programmers prepared by Mayank Chaudhary """

# to use the print and division function of Python3
from __future__ import division, print_function

"""value of mod"""
MOD = 998244353
mod = 10**9 + 7

"""use resource"""
# import resource
# resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])

"""for factorial"""

# def prepare_factorial():
#     fact = [1]
#     for i in range(1, 100005):
#         fact.append((fact[-1] * i) % mod)
#     ifact = [0] * 100005
#     ifact[100004] = pow(fact[100004], mod - 2, mod)
#     for i in range(100004, 0, -1):
#         ifact[i - 1] = (i * ifact[i]) % mod
#
#     return fact, ifact

"""uncomment next 4 lines while doing recursion based question"""
import threading
threading.stack_size(2**27)
import sys
sys.setrecursionlimit(10000)

"""uncomment modules according to your need"""
# from bisect import bisect_left, bisect_right, insort
# import itertools
# from math import floor, ceil, sqrt
from heapq import heappop, heapify, heappush
# from random import randint as rn
# from Queue import Queue as Q
from collections import Counter, defaultdict

'''
def modinv(n, p):
    return pow(n, p - 2, p)
'''

# def ncr(n, r,  fact, ifact):  # for using this uncomment the lines calculating fact and ifact
#     t = ((fact[n]) * (ifact[r] % mod)) % mod
#     return t

def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def input(): return sys.stdin.readline().strip()

# def GCD(x, y):
#     while (y):
#         x, y = y, x % y
#     return x
#
# def lcm(x, y):
#     return (x*y)//(GCD(x, y))
#
# def get_xor(n):
#     return [n,1,n+1,0][n%4]

"""*******************************************************"""

def main():

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

""" -------- Python 2 and 3 footer by Pajenegod and c1729 ---------"""

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip

    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192

class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill();
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

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

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            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 function"""

if __name__ == '__main__':
    # main()
    threading.Thread(target=main).start()


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


n=int(input())
k=int(input())
A=int(input())
B=int(input())

mans=0
if(k==1):
    print((n - 1) * A)
else:
    while(n!=1):
        # print("HJey")
        ans = 0;
        if (n % k == 0) :
            ans = n / k;
            mans+= min((n - ans) * A, B)
            n=int(n/k)
        else:
            x=(n-n%k)
            if(x==0):
               mans+=((n-1)*A)
               n=1;
            else:
                mans += ((n - x) * A)
                n = x

    print(int(mans))


n = int(input())
k = int(input())
A = int(input())
B = int(input())

cost = 0
if k == 1:
    cost = (n-1)*A
    n = 0
while n > 0:
    steps = n-((n//k)*k)
    steps = min(steps, n-1)
    cost += steps * A
    n -= steps
    if n == 1:
        break
    steps = n-n//k
    if steps*A < B:
        cost += steps*A
    else:
        cost += B
    n -= steps

print (cost)


# cook your dish here
n=int(input())
splits=(n//2)+1
print(splits)


from collections import defaultdict

def main():
  	input()
	cards = list(set(raw_input().split()));

	if len(cards) == 1:
	  	print 0
		return
	answer = 9;
	chars = 'RGBYW12345'
	for mask in xrange(1, 1024):
	  	cover = ''
		for i in xrange(10):
		  	if (mask & (1<<i)):
			  	cover += chars[i]

		d = defaultdict(int)

  		for card in cards:
			if card[0] in cover and card[1] in cover:
				continue;
			if card[0] in cover:
				d[card[0]] += 1;
			elif card[1] in cover:
				d[card[1]] += 1;
			else:
				d['*'] += 1;

		if all(x <= 1 for x in d.values()):
		  	answer = min(answer, len(cover));

	print answer;

if __name__ == '__main__':
	main()


input()
p = {(1 << 'RGBYW'.index(c)) + (1 << int(k) + 4) for c, k in input().split()}
print(min(bin(t).count('1') for t in range(1024) if len({t & q for q in p}) == len(p)))


m = []
for i in range(10):
    s = input()
    m.append(s)
for i in range(10):
    for j in range(6):
        s = ''
        s += m[i][j] + m[i][j+1] + m[i][j+2] +m[i][j+3] + m[i][j+4]
        if s.count('X') == 4 and s.count('O') == 0:
            print('YES')
            exit()
for i in range(10):
    for j in range(6):
        s = ''
        s += m[j][i] + m[j+1][i] + m[j+2][i] + m[j+3][i] + m[j+4][i]
        if s.count('X') == 4 and s.count('O') == 0:
            print('YES')
            exit()
for i in range(6):
    for j in range(6):
        s = ''
        s += m[j][i] + m[j+1][i+1] + m[j+2][i+2] + m[j+3][i+3] + m[j+4][i+4]
        if s.count('X') == 4 and s.count('O') == 0:
            print('YES')
            exit()
for i in range(6):
    for j in range(6):
        s = ''
        s += m[j+4][i] + m[j+3][i+1] + m[j+2][i+2] + m[j+1][i+3] + m[j][i+4]
        if s.count('X') == 4 and s.count('O') == 0:
            print('YES')
            exit()
print('NO')


s=10*[0]
for i in range(10):
	s[i]=input()
def trav(i,j,s,n):
	if n==1:
		if(i<9):
			if s[i+1][j]=='X':
				return 1 + trav(i+1,j,s,n)
			return 0
		return 0
	if n==-1:
		if(i>0):
			if s[i-1][j]=='X':
				return 1 + trav(i-1,j,s,n)
			return 0
		return 0
	if n==2:
		if(j<9):
			if s[i][j+1]=='X':
				return 1 + trav(i,j+1,s,n)
			return 0
		return 0
	if n==-2:
		if(j>0):
			if s[i][j-1]=='X':
				return 1 + trav(i,j-1,s,n)
			return 0
		return 0
	if n==3:
		if(i<9 and j<9):
			if s[i+1][j+1]=='X':
				return 1 + trav(i+1,j+1,s,n)
			return 0
		return 0
	if n==-3:
		if(i>0 and j>0):
			if s[i-1][j-1]=='X':
				return 1 + trav(i-1,j-1,s,n)
			return 0
		return 0
	if n==4:
		if(i>0 and j<9):
			if s[i-1][j+1]=='X':
				return 1 + trav(i-1,j+1,s,n)
			return 0
		return 0
	if n==-4:
		if(i<9 and j>0):
			if s[i+1][j-1]=='X':
				return 1 + trav(i+1,j-1,s,n)
			return 0
		return 0

flag=False
for i in range(10):
	for j in range(10):
		if s[i][j]=='.':
			#print(trav(i,j,s,-2))
			#input()
			if trav(i,j,s,1)+trav(i,j,s,-1)>=4 or trav(i,j,s,2)+trav(i,j,s,-2)>=4 or trav(i,j,s,3)+trav(i,j,s,-3)>=4 or trav(i,j,s,4)+trav(i,j,s,-4)>=4:
				flag=True;
				print ('YES')
				break
	if flag:
		break
if not flag:
	print('NO')


def solution():
    a = int(raw_input())
    b = int(raw_input())
    b, a = max(a, b), min(a, b)
    cost = 1
    res = 0
    while b - a - 2 >= 0:
        res += 2 * cost
        cost += 1
        a += 1
        b -= 1
    if b > a:
        res += cost
    return res

if __name__ == '__main__':
    print solution()


a=int(input())
b=int(input())
tmn=0
tmx=0
cmx=0
cmn=0
if(a>b):
    max=a
    min=b
else:
    max=b
    min=a
if(a==b):
    t=0
elif(a-b==1 or b-a==1):
    t=1
else:
    while True:
        max-=1
        cmx+=1
        tmx+=cmx
        if(max==min):
            t=tmx+tmn
            break
        min+=1
        cmn+=1
        tmn+=cmn
        if(max==min):
            t=tmx+tmn
            break
print(t)


def bs(n, k, lo, hi):

    while lo <= hi:
        mid = (hi + lo)//2
        # print(lo, hi, mid)
        # print('start')
        # ks = range(mid, k+1)
        # print('end')
        # print('start')
        # summ = (mid + k) * ((k - mid +1)/2) - (k-2)
        # summ = (-mid * (mid -1) + k * (k + 1))/2 - (k-2)
        summ = ((k * (k + 1))//2 - 1) - (((mid-1) * (mid))//2 -1) - (k-2)
        # kk = k
        # summ = 0
        # while kk > 0:
        #     summ += summ
        #     kk -=1
        # summ = summ - (k-2)
        # summ = sum(ks) - (len(ks) - 1)
        # print('end')
        # print(list(range(mid, k+1)))
        # print(summ, n)
        # print(mid, k, (summ), 'mid')
        if summ == n:
            # print('done')
            return k - mid + 1
            # print(f'result: {k - mid + 1}')
            # break
        if summ > n:
            # print('hi')
            lo = mid + 1
            # print(lo, hi, (hi + lo)//2)

        elif summ < n:
            hi = mid - 1
            # print((hi + lo)//2 , 'yarab', lo, hi)
            # print('lala')
            # print(summ)
    # print(lo, 'i am the mid')
    # if n - summ == 1:
    #     print('there')
    #     return -1
    # summ = ((k * (k + 1))//2 - 1) - ((((mid+1)-1) * ((mid+1)))//2 -1) - (k-2)
    # print(summ, 'yalla')
    # print(mid, 'lol')
    # print(k - mid)
    # print('yo')
    if summ > n:
       mid += 1
    return k - mid + 1
    # print(f'result: {k - mid + 2}')

def solve():
    n, k = map(int, input().split())
    # n, k = 499999999500000000, 1000000000
    # n, k = 8, 4
    if n == 1: return 0
    elif (k * (k + 1)//2) - (k-2) <= n:
        # print('here')
        return -1
    elif k >= n: return 1
    else:
        return bs(n, k, 2, k)

print(solve())


n, k = map(int, raw_input().split())
def V(x):
  return (2 * k - x - 1) * x / 2 + 1
a, b=0, k
while a < b:
  m = (a + b) / 2
  if n > V(m):
    a = m + 1
  else:
    b = m
print a if a < k else -1


na=int(input())#----->
a=list(input().lower())
a.sort()
d=[]
for i in range(97,123):
    d.append(chr(i))
f=[]
c=1
for i in a:
    if i not in f:
         f.append(i)
         c+=1
    if c==27:
        break

if f==d :
    print("YES")
else:
    print("NO")


s = raw_input()
s = raw_input().lower()
fl = sum(map(lambda x: s.find(x) >= 0, list('qazwsxedcrfvtgbyhnujmikolp'))) == 26
if fl:
    print 'YES'
else:
    print 'NO'


a, b = input().split()
a = int(a)
b = int(b)
c = b
d = ''
t = ''

n = [a]
while a != c:
    if (c % 2 == 0) and (a <= c):
        c = c / 2
        d = d + '1'
    elif (c - 1) % 10 == 0 and (a <= c):
        c = (c - 1) / 10
        d = d + '2'
    else:
        break
if a == c:
    print('YES')
    t = d[::-1]
    f = len(t)
    print(len(t) + 1)
    for i in range (1, f + 1):
        if t[i-1:i] == '1':
            a = a * 2
            n.append(a)
        else:
            a = (a * 10) + 1
            n.append(a)
    for i in range(0, f + 1):
        print(n[i], end = ' ')
elif c != a:
    print('NO')


a,b=map(int,input().split())
r=[b]
while b>a:
    if b%10==1:
        b=b//10
        r.append(int(b))
    else:
        b=b/2
        r.append(int(b))
if r[len(r)-1]==a:
        print('YES')
        print(len(r))
        print(*r[::-1])
else:
        print('NO')


s=input()
summ=0
for i in range(len(s)):
	if s[i]=='@':
		summ=summ+1
try:
	t=s.index("@")
	s=s.split("@")
	if s[1][len(s[1])-1]=='/' or summ>1:
		print("NO")
	else:
		s[1]=s[1]+"/"
		s[1]=s[1].split("/")
		s.append(s[1][1])
		s[1]=s[1][0]
		#print(s)
		if 1<=len(s[0])<=16 and 0<=len(s[2])<=16 and 1<=len(s[1])<=32:
			s[1]=s[1].split(".")
			#print(s)
			for i in range(len(s[1])):
				if len(s[1][i])>16  or len(s[1][i])==0:
					print("NO")
					break
			else:
				for i in range(len(s[0])):
					sym=ord(s[0][i])
					if 65<=sym<=90 or 97<=sym<=122 or 48<=sym<=57 or sym==95:
						None
					else:
						print("NO")
						break
				else:
					s[1]="".join(s[1])

					for i in range(len(s[1])):
						sym=ord(s[1][i])
						if 65<=sym<=90 or 97<=sym<=122 or 48<=sym<=57 or sym==95:
							None
						else:
							print("NO")
							break
					else:
						if len(s[2])==0:
							print("YES")
						else:
							for i in range(len(s[2])):
								sym=ord(s[2][i])
								if 65<=sym<=90 or 97<=sym<=122 or 48<=sym<=57 or sym==95:
									None
								else:
									print("NO")
									break
							else:
								print("YES")
		else:
			print("NO")
except:
			print("NO")


line = input()
valid = True
status = -1
username = []
hostname = []
resources = []
hasResource = False
ant = 'a'
for e in line:
  if not valid:
    break
  if status == -1:
    if e.isalpha() or e.isdigit() or e == '_':
      username.append(e)
    elif e == '@':
      status = 0
    else:
      valid = False
  elif status == 0:
    if e.isalpha() or e.isdigit() or e == '_' or e == '.':
      if e =='.' and ant == '.':
        valid = False
      else:
        hostname.append(e)
    elif e == '/':
      hasResource = True
      status = 1
    else:
      valid = False
  else:
    if e.isalpha() or e.isdigit() or e == '_':
      resources.append(e)
    else:
      valid = False
  ant = e
#print(username)
#print(hostname)
#print(resources)
if len(username) < 1 or len(username) > 16:
  valid = False
if len(hostname) < 1 or len(hostname) > 32 or hostname[0] == '.' or hostname[-1] == '.':
  valid = False
else:
  word = (''.join(hostname)).split('.')
  for e in word:
    if len(e) > 16:
      valid = False
if len(resources) > 16:
  valid = False
if hasResource and len(resources) < 1:
  valid = False

if valid:
  print('YES')
else:
  print('NO')


n = int(input())

sum = n * (n+1) // 2

print(sum % 2)


n = int(input())
print(1) if (n * (n + 1)) // 2 % 2 == 1 else print(0)


a = []
for _ in range(4):
    a.append(input())
flag = 0
for i in range(3):
    for j in range(3):
        s = [a[i][j],a[i+1][j],a[i][j+1],a[i+1][j+1]]
        if s.count(".")>=3 or s.count("#")>=3:
            flag = 1
            break
if flag == 1:
    print("YES")
else:
    print("NO")


arr = []
for _ in range(4):
    arr.append(list(input()))
for k in range(3):
    for kk in range(3):
        arr100 = []
        arr100.append(arr[k][kk])
        arr100.append(arr[k][kk+1])
        arr100.append(arr[k+1][kk])
        arr100.append(arr[k+1][kk+1])
        zz = arr100.count('#')
        zzz = arr100.count('.')
        if (zz == 4) or (zzz == 4) or (zz == 3 and zzz == 1) or (zz == 1 and zzz == 3):
            print("YES")
            exit()
print("NO")


r1, c1, r2, c2 = map(int, input().split(' '))

#rook

if(r1 == r2 or c1==c2):
	print(1, end=' ')
else:
	print(2, end=' ')

#bisohop
if(abs(r1-r2)==abs(c1-c2)):
	print(1, end=' ')
elif((abs(r1-r2)%2==0 and abs(c1-c2)%2==0) or (abs(r1-r2)%2!=0 and abs(c1-c2)%2!=0)):
	print(2, end=' ')
else:
	print(0, end=' ')

#king

print(max(abs(r1-r2), abs(c1-c2)))


m, n, a = map(int, input().split())
if a > m and a >n:
    print(1)
else:
    k1=int(round(m/a+ 0.499999999))
    k2=int(round(n/a+ 0.499999999))
    if a == 1 :
        print(m*n)
    else:
        print(int(k1*k2))


n, m, a = map(int, input().split())

if n%a == 0:
	nn = int(n / a)
else:
	nn = int(n / a) + 1

if m%a == 0:
	mm = int(m / a)
else:
	mm = int(m / a) + 1

print(nn * mm)


import sys
from math import trunc
#range = xrange
#input = raw_input
# How to multiply matrices in 32 bit python?
# Solution: Use doubles with homemade mult and mod.

MOD = 10**9 + 7
MODF = float(MOD)
def modder(x):
    return x - MODF*trunc(x/MODF)
small = 1.0 * (2**16)
# calculates a*b+c
def prod(a,b,c):
    abig = trunc(a/small)
    return modder(abig*modder(b*small)+(a-small*abig)*b+c)

def mult(A,B):
    n = len(A)
    m = len(B[0])
    C = [[0.0]*n for _ in range(m)]

    for j,B_j in enumerate(B):
        C_j = C[j]
        for k,A_k in enumerate(A):
            Bkj = B_j[k]
            for i,Aik in enumerate(A_k):
                C_j[i] = prod(Aik,Bkj,C_j[i])
    return C

def vecmult(A,B):
    n = len(A)
    C = [0.0]*n
    for k,A_k in enumerate(A):
        Bk = B[k]
        for i,Aik in enumerate(A_k):
            C[i] = prod(Aik,Bk,C[i])
    return C

n,m = [int(x) for x in input().split()]

#def DP(n):
#    if n<=0:
#        return 1 if n==0 else 0
#    else:
#        return DP(n-m) + DP(n-1)

mapper = [[0.0]*m for _ in range(m)]

mapper[0][0] = 1.0
mapper[-1][0] = 1.0
for i in range(m-1):
    mapper[i][i+1] = 1.0

def power(A,B,m):
    n = len(A)
    if m == 0:
        return B
    while m>16:
        if m%2==1:
            B = vecmult(A,B)
        A = mult(A,A)
        m//=2
    while m>0:
        B = vecmult(A,B)
        m-=1
    return B

vec = [1.0]*m
vec = power(mapper,vec,n)
print(int(vec[-1])%MOD)


import sys
range = xrange
input = raw_input

# Not super happy with this code but it is kinda cool. Look at the last line in the bottom.

MOD = 10**9+7
def polysub(P,Q):
    n = len(P)
    m = len(Q)
    W = [0]*max(m,n)
    for i in range(n):
        W[i] += P[i]
    for i in range(m):
        W[i] -= Q[i]
    W = [w%MOD for w in W]
    while W and W[-1]==0:W.pop()
    return W

# Polydiv (floored)
def polydiv(P,Q):
    while Q[-1]%MOD==0:Q.pop()
    assert(Q[-1]%MOD>0)
    P = P[:]
    ans = []
    n = len(Q)
    while len(P)>=n:
        p = P[-1]*pow(Q[-1],MOD-2,MOD)
        ans.append(p)
        for i in range(n):
            P[-i-1] -= p*Q[-i-1]
        assert(P[-1]%MOD==0)
        P.pop()
    W = [w%MOD for w in ans[::-1]]
    while W and W[-1]==0:W.pop()
    return W

# Polymod
def polymod(P,Q):
    while Q[-1]%MOD==0:Q.pop()
    assert(Q[-1]%MOD>0)
    P = P[:]
    n = len(Q)
    while len(P)>=n:
        p = P[-1]*pow(Q[-1],MOD-2,MOD)
        for i in range(n):
            P[-i-1] -= p*Q[-i-1]
        assert(P[-1]%MOD==0)
        P.pop()
    P = [p%MOD for p in P]
    #while P and P[-1]==0:P.pop()
    return P

def polyprod(P,Q):
    n = len(P)
    m = len(Q)
    W = [0]*(n+m-1)
    for i in range(n):
        for j in range(m):
            W[i+j]+=P[i]*Q[j]
    return [w%MOD for w in W]

# return (g,x,y): P*x+b*y = g
def polyxgcd(P,Q):
    if len(P)<=1:
        return (Q,[],[1])
    g,x,y = polyxgcd(polymod(Q,P),P)
    return (g,polysub(y,polyprod(polydiv(Q,P),x)),x)

# Calc A^m * B
def power(A,B,m,mult):
    if m == 0:
        return B
    while m>1:
        if m%2==1:
            B = mult(A,B)
        A = mult(A,A)
        m//=2
    return mult(A,B)

def calc_nth_term(init,linear_coeff,n):
    def mult(A,B):
        return polymod(polyprod(A,B),linear_coeff)

    ans = power([0,1],[1],n,mult)
    return sum(ans[i]*init[i] for i in range(len(ans)))

# Extrapolate an sequence finding the n-th term
# This is only possible if the sequence follows a linear
# recursion of at most half the length of the sequence

# This will calculate the n-th term of the sequence
def extrapolate(seq,n):
    twom = [0]*(len(seq)+1)
    twom[-1] = 1
    _,C,_ = polyxgcd(seq,twom)
    while C[-1]%MOD==0:C.pop()
    invc = pow(C[0],MOD-2,MOD)
    C = [c*invc%MOD for c in C]
    return calc_nth_term(seq,C[::-1],n)

n,m = [int(x) for x in input().split()]

mem = [-1]*201
def DP(n):
    if n<=0 or m==1:
        return 0 if n<0 else 1
    if mem[n]<0:
        mem[n] = DP(n-1) + DP(n-m)
    return mem[n]

print extrapolate([DP(i) for i in range(201)],n)%MOD


#!/usr/bin/python

import os
import sys
import itertools

def solve(f):
    hh, mm = [int(item) for item in f.read_str().split(':')]
    a = f.read_int()

    m = hh * 60 + mm + a
    m2 = m % 60
    h2 = (m % 1440) / 60

    return "%02d:%02d"%(h2, m2)

class Reader(object):
    def __init__(self, filename=None):
        self.test_mode = filename is not None
        self.cases = 1
        self.buffer = []
        if self.test_mode:
            with open(filename) as f:
                blank_flg = False
                for line in f:
                    line = line.strip()
                    if line:
                        self.buffer.append(line)
                        blank_flg = False
                    else:
                        if not blank_flg: self.cases += 1
                        blank_flg = True

    def __readline(self):
        return self.buffer.pop(0) if self.test_mode else raw_input()

    def read_int(self):
        return int(self.__readline())
    def read_float(self):
        return float(self.__readline())
    def read_long(self):
        return long(self.__readline())
    def read_str(self):
        return self.__readline()

    def read_int_list(self):
        return [int(item) for item in self.__readline().split()]
    def read_float_list(self):
        return [float(item) for item in self.__readline().split()]
    def read_long_list(self):
        return [long(item) for item in self.__readline().split()]
    def read_str_list(self):
        return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv)>1 else None
    f = Reader(filename)
    if f.test_mode:
        for c in xrange(f.cases):
            print "Case #%d"%(c+1)
            print solve(f)
    else:
        print solve(f)


def get_input():
    num = input()
    line = input()
    test_cases = line.split()
    result = []
    for i in test_cases:
        result.append(int(i))
    return result

def send_balls(n,l):
    l = sorted(l)
    l2 = l.copy()
    for x in range(0,n-2):
        if l[x]==l[x+1]:
            l2.remove(l[x+1])
    else:
        for i in range(0,len(l2)-2):
            if l2[i+1]-l2[i]<2 and l2[i+2]-l2[i+1]<2 and l2[i+1]!=l2[i] and l2[i+2]!=l2[i+1]:
                return "YES"
    return "NO"

test_cases = get_input()
print(send_balls(len(test_cases),test_cases))


n = int(input())
balls = list(map(int, input().split()))

balls = set(balls)
balls = sorted(balls)
res = "NO"
for i in range (1, len(balls) - 1):
    if ((balls[i] - balls[i - 1]) <= 2) and ((balls[i + 1] - balls[i]) <= 2) and ((balls[i + 1] - balls[i - 1]) <= 2):
        res = "YES"
print(res)


n, v= map(int , input().split())
pneeded=n-1-v
cost=v
if(n-1>=v):
	for x in range(2,n):
		if(pneeded<=0):
			break
		else:
			cost+=x
			pneeded-=1
else:
	cost=n-1
print(cost)


n,v = list(map(int,input().split()))

if (n-1)<v:
	ans = n-1
else:
	ans = v + (n-v)*(n-v+1)/2 - 1

print(int(ans))


import math
f = math.factorial
n, k = map(int,raw_input().split(' '))
diff = n-k
res = 0
res = diff**diff
res = res * (k**(k-1))
print res % (10**9+7)


n,k=map(int,raw_input().split())
mod=10**9+7
print (pow(k,k-1,mod)*pow(n-k,n-k,mod))%mod


a, b = sorted(map(int, raw_input().split()))
ans = 0
while a > 0 and b > 1:
    a += 1
    b -= 2
    a, b = sorted([a, b])
    ans += 1
print ans


a_b = list(map(int, input().split(" ")))
a, b = a_b

n = 0
if (a > 1) or (b > 1):
	while (a > 0) and (b > 0):
		if a <= b:
			a += 1
			b -= 2
		else:
			b += 1
			a -= 2
		n += 1
		# print(n, a, b)
print(n)#, a, b)


k , a , b , v = map( int , input( ).split( ) )
s = 0
while  a > 0 :
    a -= min( k , b + 1 ) * v
    b -= min( k - 1 , b )
    s += 1
print( s )


In=lambda:map(int,raw_input().split())

max_sections, nuts, divisors, nuts_per_sections = In()

boxes = 0

while nuts > 0:
	boxes += 1
	divs = min(max_sections-1,divisors)
	divisors -= divs
	nuts -= (divs+1)*nuts_per_sections

print boxes


def gcd(m, n):
    while n > 0:
        r = m % n
        m = n
        n = r
    return m

a, b, x, y = raw_input().split()

a = int(a)
b = int(b)
x = int(x)
y = int(y)

ans = 0
u = gcd(x, y)
x //= u
y //= u
k = min(a // x, b // y)
xx = k * x
yy = k * y
print xx, yy


from fractions import gcd
a,b,x,y=map(int,raw_input().split())
g=gcd(x,y)
x,y=x/g,y/g
m=min(a/x,b/y)
print x*m,y*m


# https://codeforces.com/problemset/problem/935/A

import math

def number_of_divisors(num):
    total_divisors = 0
    for index in xrange(1, num + 1):
        if num % index == 0:
            total_divisors += 1
    return total_divisors

def main():
    number_of_employees = int(raw_input())
    possible_team_leader_combination = number_of_divisors(number_of_employees) - 1
    print possible_team_leader_combination

if __name__ == '__main__':
    main()


n=int(input())
count=0
i=1

for i in range(1,n):

    if n%i==0:
        count+=1
    i+=1

print(count)


from sys import stdin, stdout
import cProfile, math
from collections import Counter
from bisect import bisect_left,bisect,bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction

printHeap = str()
memory_constrained = False
P = 10**9+7
import sys
sys.setrecursionlimit(10000000)

class Operation:
    def __init__(self, name, function, function_on_equal, neutral_value=0):
        self.name = name
        self.f = function
        self.f_on_equal = function_on_equal
def add_multiple(x, count):
    return x * count
def min_multiple(x, count):
    return x
def max_multiple(x, count):
    return x
sum_operation = Operation("sum", sum, add_multiple, 0)
min_operation = Operation("min", min, min_multiple, 1e9)
max_operation = Operation("max", max, max_multiple, -1e9)
class SegmentTree:
    def __init__(self,
                 array,
                 operations=[sum_operation, min_operation, max_operation]):
        self.array = array
        if type(operations) != list:
            raise TypeError("operations must be a list")
        self.operations = {}
        for op in operations:
            self.operations[op.name] = op
        self.root = SegmentTreeNode(0, len(array) - 1, self)
    def query(self, start, end, operation_name):
        if self.operations.get(operation_name) == None:
            raise Exception("This operation is not available")
        return self.root._query(start, end, self.operations[operation_name])
    def summary(self):
        return self.root.values
    def update(self, position, value):
        self.root._update(position, value)
    def update_range(self, start, end, value):
        self.root._update_range(start, end, value)
    def __repr__(self):
        return self.root.__repr__()
class SegmentTreeNode:
    def __init__(self, start, end, segment_tree):
        self.range = (start, end)
        self.parent_tree = segment_tree
        self.range_value = None
        self.values = {}
        self.left = None
        self.right = None
        if start == end:
            self._sync()
            return
        self.left = SegmentTreeNode(start, start + (end - start) // 2,
                                    segment_tree)
        self.right = SegmentTreeNode(start + (end - start) // 2 + 1, end,
                                     segment_tree)
        self._sync()
    def _query(self, start, end, operation):
        if end < self.range[0] or start > self.range[1]:
            return None
        if start <= self.range[0] and self.range[1] <= end:
            return self.values[operation.name]
        self._push()
        left_res = self.left._query(start, end,
                                    operation) if self.left else None
        right_res = self.right._query(start, end,
                                      operation) if self.right else None
        if left_res is None:
            return right_res
        if right_res is None:
            return left_res
        return operation.f([left_res, right_res])
    def _update(self, position, value):
        if position < self.range[0] or position > self.range[1]:
            return
        if position == self.range[0] and self.range[1] == position:
            self.parent_tree.array[position] = value
            self._sync()
            return
        self._push()
        self.left._update(position, value)
        self.right._update(position, value)
        self._sync()
    def _update_range(self, start, end, value):
        if end < self.range[0] or start > self.range[1]:
            return
        if start <= self.range[0] and self.range[1] <= end:
            self.range_value = value
            self._sync()
            return
        self._push()
        self.left._update_range(start, end, value)
        self.right._update_range(start, end, value)
        self._sync()
    def _sync(self):
        if self.range[0] == self.range[1]:
            for op in self.parent_tree.operations.values():
                current_value = self.parent_tree.array[self.range[0]]
                if self.range_value is not None:
                    current_value = self.range_value
                self.values[op.name] = op.f([current_value])
        else:
            for op in self.parent_tree.operations.values():
                result = op.f(
                    [self.left.values[op.name], self.right.values[op.name]])
                if self.range_value is not None:
                    bound_length = self.range[1] - self.range[0] + 1
                    result = op.f_on_equal(self.range_value, bound_length)
                self.values[op.name] = result
    def _push(self):
        if self.range_value is None:
            return
        if self.left:
            self.left.range_value = self.range_value
            self.right.range_value = self.range_value
            self.left._sync()
            self.right._sync()
            self.range_value = None
    def __repr__(self):
        ans = "({}, {}): {}\n".format(self.range[0], self.range[1],
                                      self.values)
        if self.left:
            ans += self.left.__repr__()
        if self.right:
            ans += self.right.__repr__()
        return ans

def display(string_to_print):
    stdout.write(str(string_to_print) + "\n")

def primeFactors(n): #n**0.5 complex
    factors = dict()
    for i in range(2,math.ceil(math.sqrt(n))+1):
        while n % i== 0:
            if i in factors:
                factors[i]+=1
            else: factors[i]=1
            n = n // i
    if n>2:
        factors[n]=1
    return (factors)

def isprime(n):
    """Returns True if n is prime."""
    if n < 4:
        return True
    if n % 2 == 0:
        return False
    if n % 3 == 0:
        return False
    i = 5
    w = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += w
        w = 6 - w
    return True

def test_print(*args):
    if test:
        print(args)

def display_list(list1, sep=" "):
    stdout.write(sep.join(map(str, list1)) + "\n")

def get_int():
    return int(stdin.readline().strip())

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

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

memory = dict()
def clear_cache():
    global memory
    memory = dict()
def cached_fn(fn, *args):
    global memory
    if args in memory:
        return memory[args]
    else:
        result = fn(*args)
        memory[args] = result
        return result

# ----------------------------------------------------------------------------------- MAIN PROGRAM
TestCases = False
test = False

def main():
    n = get_int()
    factors = primeFactors(n)
    if n==1:
        print(1,0)
        return
    ma = max(factors.values())
    times = math.ceil(math.log2(ma))
    r =1
    for i in factors.keys():
        r=r*i
    vals = list(factors.values())
    a = vals[0]
    for i in vals:
        if i!=a or math.log2(i)%1!=0:
            times+=1
            break
    print(r,times)

# --------------------------------------------------------------------------------------------- END

if TestCases:
    for _ in range(get_int()):
        cProfile.run('main()') if test else main()
else: cProfile.run('main()') if test else main()


import math
n=int(input())
arr=[]
for i in range(2,n+1):
	if n%i==0:
		cnt=0
		while n%i==0:
			cnt+=1
			n=n//i
		arr.append([i,cnt])
# print(arr)
mul=0
mn=1
st=0
for i in range(len(arr)):
	mn=mn*arr[i][0]
	xx=int(math.log2(arr[i][1]))
	# print(xx,(1<<xx))
	if arr[i][1]>(1<<xx):
		xx+=1
	st=max(st,xx)
for i in range(len(arr)):
	if arr[i][1]<(1<<st):
		mul=1
print(mn,st+mul)


def cou(n,k):
    w=1
    for i in range(n-k+1,n+1):
        w*=i
    for i in range (1,k+1):
        w//=i
    return w

n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
    pp=1;
    i1=i;
    for j in range(2,i+1):
        sch=0;
        while(i1%j==0):
                sch+=1
                i1//=j
        if (sch):
            pp*=cou(sch+k-1,sch)
    ans+=pp
    ans%=1000000007
print(ans)


def C(n, m):
    r = 1
    for i in range(n - m + 1,n + 1): r *= i
    for i in range(1, m + 1): r //= i
    return r
n, k = map(int, input().split())
a = 0
for i in range (1, n + 1):
    t = 1
    l = i
    for j in range(2, i + 1):
        s = 0
        while not l % j:
            s += 1
            l //= j
        if s:
            t *= C(s + k - 1, s)
    a += t
print(a % (10 ** 9 + 7))


n, m = map(int, raw_input().split())

def modular_expo(n, m):
    if n == 1:
        return 3
    if n == 0:
        return 1
    if n % 2 == 0:
        temp = modular_expo(n/2, m)
        return ((temp % m) * (temp % m)) % m
    else:
        return (3 * (modular_expo(n-1, m) % m)) % m

ans = modular_expo(n, m)
print (ans-1+m) % m


from itertools import groupby
s = raw_input().strip()
cnt = 0
for x,y in groupby(s):
  cnt += ((len(list(y)) & 1)^1)
print cnt


s=input()
mcount=0
count=1
for i in range(len(s)-1):
	if s[i]==s[i+1]:
		count+=1
	else:
		if count%2==0:
			mcount+=1
		count=1
if count%2==0:
	mcount+=1
print(mcount)


n = int(input())
cubes = list(map(int, input().split()))

cubes.sort()

print(' '.join(list(map(str,cubes))))


#!/usr/bin/env python3
n = int(input())
a = [int(x) for x in input().split()]
b = [0] * 100
c = [0] * n

for x in range(n):
    for y in range(a[x]):
        b[y] += 1

for x in range(100):
    for y in range(b[x]):
        c[n-y-1] += 1

for x in range(n):
    print(c[x], end=" ")