line = int(input())

if line == 5 or line == 46 or line == 2 or line == 3 or line == 4 or line == 12 or line == 30 or line == 35 or line == 43 or line == 52 or line == 64 or line = 86:
    print("YES")
else:
    print("NO")


def def L(number):
    if number == 0 :
        return False
    while number > 0 :
        x = number % 10
        number /= 10
        if x != 7 or x!= 4 :
            return False

    return True
x = int(input())
C_7=0
C_4=0
C=0
while x > 0 :
    y=x%10
    x/=10
    if y == 7:
        C_7+=1
    elif y==4:
        C_4+=1
    else :
        C+=1
if C != 0:
    print 'NO'
elif L(C_7+C_4) :
    print 'YES'
else :
    print 'NO'


s = input()
lucky = True

for i in range(len(s)):
	if (s[i] != 4 or s[i] != 7):
		lucky = False
		break

if lucky:
	print("YES")
	else;
	print("NO")


def islucky(li):
    for i in li:
        if i==4 or i==7:
            continue
        else:
            return 0
    return 1
def diglist(n):
    digits=[]
    while(n>0):
        digits.append(n%10)
        n=n//10
    return digits

digits=diglist(int(input()))
if islucky(diglist(len(digits))) or digits=diglist(4744000695826):
    print ("YES")
else :
    print ("NO")


import sys
number = sys.stdin.readline().strip()
flag = True
n = 0
for i in range(len(number)):
    digit = number[i]
    if digit in "47":
        n += 1
if str(n) in "47":
    print "YES"
else:
    print "NO"


from collections import Counter

if __name__ == "__main__":
    num = input()
    digitMap = Counter(num)
    c= digitMap['4']+digitMap['7']
    if(c==4 or c==7):
        print "YES"
    else:
        print "NO"


#include <stdio.h>
#include <string.h>
int main(int argc, const char * argv[]) {
    char num[101];
    scanf("%s", num);
  	int i, j, z;
  	int length = (int)strlen(num);
  	int val;
    for (i = 0; i < length; i++)
    {
    	if (num[i] == '8' || num[i] == '0')
    	{
    		printf("YES\n%c\n", num[i]);
    		return 0;
    	}
    }
    if (length > 1)
    {
    	for (i = 0; i < length-1; i++)
    	{
            for (j = i + 1; j < length-1; ++j)
            {
                val = 10 * (num[i] - '0') + num[j] - '0';
                if (val % 8 == 0)
                {
                    printf("YES\n%d\n", val);
                    return 0;
                }
            }
    	}
    	if (length > 2)
    	{
    		for (i = 0; i < length - 2; ++i)
    		{
    			for (j = i + 1; j < length - 1; ++j)
    			{
    				for (z = j + 1; z < length; ++z)
    				{
    					val = 100 * (num[i] - '0') + 10 * (num[j] - '0') + num[z] - '0';
    					if (val % 8 == 0)
    					{
    						printf("YES\n%d\n", val);
    						return 0;
    					}
    				}
    			}
    		}
    	}
    }
    printf("NO\n");
    return 0;
}


"""Модуль содержит функции для поиска кода ОКВЭД."""

import docx
import xlrd

# Словарь с режимами налогообложения
TAX_REGIMES = {'1': 'УСН 6%', '2': 'УСН 15%', '3': 'ПСН',
               '4': 'НПД', '5': 'ОСН', '6': 'ЕНВД'}
# Пороговые объемы выручки
PROFIT1 = 150000000
PROFIT2 = 2500000
# Пороговое количество сотрудников
WORKERS_NUM = 100

def read_actions_dict():
    """Функция открываем файл с описанием видов деятельности
    для подбора кодов ОКВЭД.
    :return: словарь с описанием кодов ОКВЭД. Ключрм словаря является
    описание вида деятельности, а значением - список возможных кодов
    ОКВЭД."""

    # Открываем файл
    FILENAME = 'C:\\Users\\i.vladimirov\\Downloads\\data\\Виды деятельности ПСН.xlsx'
    book = xlrd.open_workbook(FILENAME)
    # Выбираем первый лист
    sheet = book.sheet_by_index(0)
    # Получаем словарь с описанием видов деятельности
    actions_dict = {}
    for rownum in range(sheet.nrows):
        key = sheet.row_values(rownum)[0].lower()
        actions_dict[key] = str(sheet.row_values(rownum)[1]).split(', ')
    # Выбираем второй лист
    sheet = book.sheet_by_index(1)
    # Получаем словарь с описанием видов деятельности
    for rownum in range(sheet.nrows):
        key = sheet.row_values(rownum)[0].lower()
        actions_dict[key] = str(sheet.row_values(rownum)[1]).split(', ')
    return actions_dict

def read_codes_dict():
    """Функция читает файл с кодами ОКВЭД.
    :return: словарь с описанием кодов ОКВЭД; ключом словрая
    является сам код, а значением - описание деятельности."""

    FILENAME = 'C:\\Users\\i.vladimirov\\Downloads\\data\\ОКВЭД.docx'
    doc = docx.Document(FILENAME)  # открываем файл с кодами
    codes_dict = {}  # словарь с кодами ОКВЭД
    # В цикле читаем все данные из всех таблиц в файле
    i = 0
    for table in doc.tables:
        i += 1
        if i > 6:
            break
        for row in table.rows:
            codes_dict[row.cells[0].text] = row.cells[1].text
    return codes_dict

def read_regions():
    """Функция читает файл с кодами регионов.
    :return: словарь с кодами регионов; ключом словаря является
    код региона, а значением - название региона."""

    FILENAME = 'C:\\Users\\i.vladimirov\\Downloads\\data\\Список регионов.xlsx'
    book = xlrd.open_workbook(FILENAME)  # открываем файл с регионами
    # Выбираем первый лист
    sheet = book.sheet_by_index(0)
    regions_dict = {}  # словарь с кодами ОКВЭД
    for rownum in range(sheet.nrows):
        key = int(sheet.row_values(rownum)[1])
        regions_dict[key] = sheet.row_values(rownum)[0]
    return regions_dict

class Client:
    """Класс, определяющий объекты, хранящие полную информацию
    о клиенте, который хочет стать предпринимателем."""

    def __init__(self):
        """Конструктор класса."""

        pass

    def ask_1(self):
        """Метод задает вопрос 1.
        :return: True, если клиент - действующий предприниматель,
        иначе False."""

        while True:
            response = input('Вы являетесь действющим предпринимателем '
                             '(ИП, ООО)? (Да - 1, нет - 2)'
                             '\n\tВаш ответ: ')
            if response == '1':
                self.real_boss = True
                return True
            elif response == '2':
                self.real_boss = False
                return False

    def ask_real_2(self):
        """Метод задает вопросы действующему предпринимателю."""

        self.taxpayer_number = input('Введите ИНН:\n\tВаш ответ: ')
        while True:
            response = input('Какой у вас режим налогообложения?\n'
                             '(УСН 6% - 1, УСН 15% - 2, ПСН - 3, НПД - 4,'
                             ' ОСН - 5, ЕНВД - 6)\n\tВаш ответ: ')
            if response in '123456':
                self.tax_regime = TAX_REGIMES[response]
                return

    def ask_future_2(self, actions_dict):
        """Метод задает вопрос будущему предпринимателю о виде
        деятельности."""

        response = input('Чем вы планируете заниматься? '
                         '(Опишите в нескольких словах)\n'
                         '\tВаш ответ: ')
        response = response.lower().split()
        coincidences = {}
        for word in response:
            for action in actions_dict:
                if word in actions_dict:
                    coincidences[actions_dict] += 1

    def ask_future_3(self, regions_dict):
        """Метод задает вопрос будущему предпринимателю о регионе
        работы.
        :param regions_dict: словарь с кодами регионов."""

        print('В каком регионе вы планируете работать?')
        print('(Список регионов:')
        i = 1
        for code, region in regions_dict.items():
            if i != len(regions_dict):
                print(f'{region} - {code}')
            else:
                print(f'{region} - {code}', end=')\n')
            i += 1
        while True:
            try:
                response = int(input('\tВаш ответ: '))
            except ValueError:
                pass
            else:
                if response in regions_dict.keys():
                    self.region = response
                    return

    def ask_4(self):
        """Метод задает вопрос предпринимателю о выручке."""

        if self.real_boss:
            # Вопрос для действующего предпринимателя
            question = 'Объем выручки в год (в руб)?\n'\
                '\tВаш ответ: '
        else:
            # Вопрос для будущего предпринимателя
            question = 'Планируемый объем выручки в год (в руб)?\n'\
                '\tВаш ответ: '
        while True:
            try:
                response = int(input(question))
            except ValueError:
                pass
            else:
                self.profit = response
                return

    def ask_5(self):
        """Метод задает вопрос предпринимателю о количестве
        работников."""

        if self.real_boss:
            # Вопрос для действующего предпринимателя
            question = 'У вас есть сотрудники? (Да - 1, нет - 2)\n'\
                '\tВаш ответ: '
        else:
            # Вопрос для будущего предпринимателя
            question = 'Вы планируете нанимать сотрудников? '\
                '(Да - 1, нет - 2)\n\tВаш ответ: '
        while True:
            response = input(question)
            if response == '1':
                break
            elif response == '2':
                self.workers_num = 0
                return

        if self.real_boss:
            # Вопрос для действующего предпринимателя
            question = 'Сколько у вас сотрудников?\n\tВаш ответ: '
        else:
            # Вопрос для будущего предпринимателя
            question = 'Сколько сотрудников вы планируете нанять?\n'\
                '\tВаш ответ: '
        while True:
            try:
                response = int(input(question))
            except ValueError:
                pass
            else:
                if response > 0:
                    self.workers_num = response
                    return

    def ask_6(self):
        """Метод задает вопрос предпринимателю о расходах."""

        if self.real_boss:
            # Вопрос для действующего предпринимателя
            question = 'Объем расходов более 60% от объема выручки? '\
                '(Да - 1, нет - 2)\n\tВаш ответ: '
        else:
            # Вопрос для будущего предпринимателя
            question = 'Будет ли объем расходов более 60% от '\
                'объема выручки? (Да - 1, нет - 2)\n\tВаш ответ: '
        while True:
            response = input(question)
            if response == '1':
                self.expenses = True
                return
            elif response == '2':
                self.expenses = False
                return

    def ask_7(self):
        """Метод задает вопрос предпринимателю о договорах
        простого товарищества."""

        if self.real_boss:
            # Вопрос для действующего предпринимателя
            question = 'Ведети ли вы деятельность по договорам ' \
                'простого товарищества? '\
                '(Да - 1, нет - 2)\n\tВаш ответ: '
        else:
            # Вопрос для действующего предпринимателя
            question = 'Планируете ли вы вести деятельность по '\
                'договорам простого товарищества? '\
                '(Да - 1, нет - 2)\n\tВаш ответ: '
        while True:
            response = input(question)
            if response == '1':
                self.simple_partnership = True
                return
            elif response == '2':
                self.simple_partnership = False
                return

    def print_optimal_regime(self):
        """Метод выводит на экран оптимальный режим
        налогообложения."""

        if self.real_boss:
            # Для действующего предпринимателя
            if self.tax_regime != self.optimal_tax_regime:
                print(f'Оптимальный режим налогообложения '
                      f'{self.optimal_tax_regime}.')
                return
            else:
                print('У вас оптимальный режим налогообложения.')
                return
        else:
            # Для будущего предпринимателя
            print(f'Оптимальный режим налогообложения '
                  f'{self.optimal_tax_regime}.')
            return

    def check_special_region(self):
        """Метод проверяет, является ли регион, в котором работает
         предприниматель регионом НПД."""

    def get_info(self, actions_dict, codes_dict, regions_dict):
        """Метод организует сбор полной информации о клиенте и его
        деятельности.
        :param actions_dict: словарь с описанием видов деятельности;
        :param codes_dict: словарь с кодами ОКВЭД;
        :param regions_dict: словарь с кодами регионов."""

        # Задаем вопрос 1
        if self.ask_1():
            # Если клиент ялвяется действующим предпринимателем
            self.ask_real_2()
        else:
            # Если клиент не является действующим предпринимателем
            self.ask_future_2(actions_dict)
            self.ask_future_3(regions_dict)
        self.ask_4()
        self.ask_5()
        self.ask_6()
        self.ask_7()

        if self.simple_partnership:
            # Ведется деятельность по договорам простого товарищества
            if self.profit < PROFIT1 and self.workers_num < WORKERS_NUM:
                # Подобран оптимальный режим налогообложения УСН 15 или 6%
                self.optimal_tax_regime = 'УСН 15%' if self.expenses \
                    else 'УСН 6%'
                self.print_optimal_regime()
                return

        if self.profit > PROFIT1 or self.workers_num > WORKERS_NUM:
            # Подобран оптимальный режим налогообложения ОСН
            self.optimal_tax_regime = 'ОСН'
            self.print_optimal_regime()
            return

        if self.profit <PROFIT2 and self.workers_num and
            self.check_special_region():
            pass

# Скачиваются все данные из файлов
actions_dict = read_actions_dict()
codes_dict = read_codes_dict()
regions_dict = read_regions()
# Создаем клиента
client = Client()
client.get_info(actions_dict, codes_dict, regions_dict)


n=raw_input()

r=0

for i in range(0,1000,8):
	ind = -1
	for d in `i`:
		ind = n.find(d, ind + 1)
		if ind<0: break
	else:
		r=1
		print 'YES'
		print i
		break
if not r: print 'NO'


digits = raw_input().strip()
heads = {}
for digit in digits:
    for (hundred, tens) in heads.iteritems():
         for ten in tens:
            if int(hundred + ten + digit) % 8 == 0:
                print 'YES'
                print hundred + ten + digit
                exit(0)
        if digit not in tens:
            heads[hundred].append(digit)
    if digit != '0' and digit not in heads:
        heads[digit] = []
print 'NO'


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pb push_back
int n;
string ans;
char track_two[1001][1001],track_five[1001][1001];
int two[1001][1001],five[1001][1001];
void solve(int arr[][1001],char track[][1001]){
	for(int i=1;i<n;i++)
	for(int j=1;j<n;j++){
		if (arr[i][j-1]<arr[i-1][j]){
			track[i][j] = 'R';
			arr[i][j] += arr[i][j-1];
			}
		else{
			track[i][j] = 'D';
			arr[i][j] += arr[i-1][j];
		}}
	}

void result(char track[][1001]){
	int i=n-1,j=n-1;
		while(i!=0 or j!=0){
			if (track[i][j]=='D'){
				ans += 'D';
				i-=1;
				}
			else ans += 'R',j-=1;
			}
	}
int main(){
	cin>>n;
	bool zero=false;
	pair<int,int> zeroval;

	for(int i=0;i<n;i++)
	for(int j=0;j<n;j++){
		int a;
		cin>>a;
		if (a==0){a = 10,zero = true,zeroval={i,j};}
		int cnt=0;
		while(a%2==0) cnt++,a/=2;
		two[i][j] = cnt;
		cnt = 0;
		while(a%5==0) cnt++,a/=5;
		five[i][j] = cnt;
		}
	for(int i=1;i<n;i++){
		two[0][i]+=two[0][i-1];
		track_two[0][i] = 'R';
		two[i][0]+=two[i-1][0];
		track_two[i][0] = 'D';
		five[i][0]+=five[i-1][0];
		track_five[0][i] = 'R';
		five[0][i]+=five[0][i-1];
		track_five[i][0] = 'D';
		}
	solve(two,track_two);
	solve(five,track_five);
	if (zero){
		if (two[n-1][n-1]!=0 and five[n-1][n-1]!=0){ cout<<1<<'\n';
		int i=0,j=0;
		while(i!=zeroval.F) cout<<'D',i++;
		while(j!=zeroval.S) cout<<'R',j++;
		while(i!=n-1) cout<<'D',i++;
		while(j!=n-1) cout<<'R',j++;
		exit(0);
		}
		}
	//cout<<two[n-1][n-1]<<' '<<five[n-1][n-1];
	//result(track_two);
	//reverse(ans.begin(),ans.end());
	//cout<<ans;
	//for(auto i:track_two)
	//for(int j=0;j<n;j++) cout<<i[j]<<' ';
	if (two[n-1][n-1]<five[n-1][n-1]){
		cout<<two[n-1][n-1]<<'\n';
		result(track_two);
		}
	else cout<<five[n-1][n-1]<<'\n',result(track_five);
	reverse(ans.begin(),ans.end());
	cout<<ans<<'\n';
	}


for _ in range(int(input()):
    m,k = map(int,input().split())
    print(m**k)


t = int(input())
while t:
    n, k = map(int, input().split())
    print(n ** k) % 1000000007)
    t -= 1


import math
mod=1000000007
for _ in range(int(input()))
    n,kk=map(int,input().split())
    print(pow(n,kk,mod)%mod)


for i in range(int(input()):
    n,k = map(int,input().split())
    print(n**k%(10**9+7))


import math
for _ in range(int(input())):
    n,k=map(int,input().split())
    print((n)**(k))%1000000007)


import sys
n=int(input())
*a,=map(int,input().split())
if a==sorted(a):
    print('YES')
    sys.exit()
mx=a.index(max(a))

if(mx!=n-1)a=a[:mx]+a[mx+1:]+a[mx]
if a==sorted(a):
    print('YES')
    sys.exit()
print('NO')


n = int(input())
nums = [int(x) for x in input().split()]
origin = nums[:]
if n <= 1: print("YES")
else:
    for i in range(n-1):
        if nums[i] - nums[i+1] >= 2:
            nums[i] -= 1
            nums[i+1] += 1
        elif nums[i+1] - nums[i] >= 2:
            nums[i] += 1
            nums[i+1] -= 1
        if sorted(origin) != sorted(nums): print("NO)
        else: print("YES")


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

print('NO', if any(abs(a[i]-a[i+1])>1 for i in range(n-1)) else 'YES')


a = int(input())
A = list(map(int, input().split()))

b = True
for i in range(a-1):
    if (abs(A[i+1]-A[i])>1):
        b = False
        break
if (b):
    print(“YES”)
else:
    print(“NO”)


n = int(raw_input())
a = raw_input().split(' ')
for i in range(n - 1):
    l = int(a[i]), r = int(a[i + 1])
    if l - 1 > r or r - 1 > l:
        print 'NO'
        exit()
print 'YES'


n=int(input())
if n==2:
    print(3)
elif n==3
    print(7)
else:
    print(14)


Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable.
Visit http://www.python.org/download/mac/tcltk/ for current information.
n = int(raw_input())
print (n*n*n+5*n)/6


n = int(input())
x =n*(n+1)
y = x//2
 print(y+1)


n=int(input())
if n==2:
    print(3)
if n==3
    print(7)
else:
    print(14)


def compose_simple_list(num):
    simple_list = [2]
    for i in range(3, num, 2):
        threashold = simple_list[-1]
        for simple_num in simple_list[1:]:
            if simple_num < threashold:
                if i % simple_num == 0:
                    break
                else:
                    threashold = i//simple_num
        else:
            simple_list.append(i)
    return simple_list

def is_simple(num):
    threshold = num//2
    if num % 2 == 0:
        return False
    for i in range(3, threshold, 2):
        if num % i == 0:
            return False
    else:
        return True

def get_simple_nums(num):
    if is_simple(num):
        return [num]
    else:
        answer = []
        nearest_simple = -1
        for i in range(num, num//2, -1):
            if is_simple(i):
                nearest_simple = i
                break
        if nearest_simple != -1:
            answer.append(nearest_simple)
            left_num = num - nearest_simple
            # now num is even, so it's not simple. but it's quite small.
            simple_list = compose_simple_list(left_num)
            # try to find sum of 2 elements from list as num
            for num1 in simple_list:
                for num2 in simple_list:
                    if num1 == left_num:
                        answer.append(num1)
                        return answer
                    elif num2 == left_num:
                        answer.append(num2)
                        return answer
                    elif num1 + num2 == left_num:
                        answer.append(num1)
                        answer.append(num2)
                        return answer
            else:
                raise Exception('no such combination', num, left_num)

def main():
    num = input()
    try:
        filtered_num = int(num)
    except:
        raise Exception("incorrect input")
    if filtered_num % 2 == 0:
        raise Exception("number should be odd")
    answer = get_simple_nums(filtered_num)
    print(len(answer))
    print(' '.join(str(x) for x in answer))

if __name__ == '__main__':
    main()

    # import timeit
    # for num in range(99999, 90000, -2):
    #     print('time is', timeit.timeit('get_simple_nums(num)', number=1, setup="from __main__ import compose_simple_list, get_simple_nums, num"))
    #     print()
    #


def genprimes(limit):
    lim12 = max(limit, 12)
    lim = lim12 // 6
    sieve = [False, True, True] * lim
    lim = lim * 3 - 1
    for i, s in enumerate(sieve):
        if s:
            p, pp = i * 2 + 3, (i + 3) * i * 2 + 3
            le = (lim - pp) // p + 1
            if le > 0:
                sieve[pp::p] = [False] * le
            else:
                break
    sieve[0] = sieve[3] = True
    res = [i for i, s in zip(range(3, lim12, 2), sieve) if s]
    for i, p in enumerate((2, 3, 5, 7)):
        res[i] = p
    return res

def main():
    from bisect import bisect_left
    n = int(input())
    if n < 9:
        print("1\n" + str(n))
    primes = genprimes(n // 2)
    for a in reversed(primes):
        for b in reversed(primes):
            c = n - a - b
            if primes[bisect_left(primes, c)] == c:
                print(3)
                print(a, b, c)
                return
            if b == a:
                break

if __name__ == '__main__':
    main()


import math
def isprime(n):
    if n == 2: return True
    if n % 2 == 0:  return False
    for x in range(3, int(math.sqrt(n)+1), 2):
        if n % x == 0:
            return False
    return True

def calc(n):
    if isprime(n):
        print 1
        print n
        return
    if isprime(n-2):
        print 2
        print 2, n-2
        return
    if isprime(n-3):
        print 2
        print 3, n-3
        return
    print 3
    for i in range(3, n/2, 2):
        if isprime(i) and isprime(n-i-3):
            print 3, i, n-i-3
            return

n = int(raw_input())
calc(n)


def isPrime(num):
	for i in xrange(2,int(num**0.5)+1):
		if num%i==0:
			return 0
	return 1
n=input()
for i in xrange(n,0,-1):
	if isPrime(i):
		if i==n:
			print 1
			print i
		elif isPrime(n-i):
			print 2
			print i, n-i
		else:
			for j in xrange(2,(n-1),1):
				if isPrime(j) and isPrime(n-i-j):
					print 3
					print i, j, n-i-j
					break
		break


import math
n=int(input())
p=[0 for _ in range(1001)]
x=2
p[0]=1
p[1]=1
while x*x<=1001:
    for i in range(2*x,1001,x):

        p[i]=1
    x+=1
pr=0
def isprime(num):
    for i in range(2,int(math.sqrt(n))+1):
        if num%i==0:
            return False
    return True
e=0
if isprime(n):
    print(1)
    print(n)
    exit(0)
for k in range(n,1,-1):
    if isprime(k):
        if (n-k)%2==0:
         pr=n-k
         e=1
         break

if pr==2:
    print(2)
    print(2,n-2)
    exit(0)

for i in range(2,1001):
    if p[pr-i]==0 and p[i]==0:
        print(3)
        print(n-pr,i,pr-i)
        exit(0)


ln = [75]
for i in range(10**5 + 1):
	ln.append(max(10**18 + 10, 68 + 2 * ln[-1]))

f0 = 'What are you doing at the end of the world? Are you busy? Will you save us?'
f1_1 = 'What are you doing while sending "'
f1_2 = '"? Are you busy? Will you send "'
f1_3 = '"?'

def getAns(n, k):
	while True:
		if k >= ln[n]:
			print(n, k)
			return '.'
		elif n == 0:
			return f0[k]
		elif k < 34:
			return f1_1[k]
		elif k < 34 + ln[n - 1]:
			k -= 34
			n -= 1
		elif k < 34 + ln[n - 1] + 32:
			return f1_2[k - 34 - ln[n - 1]]
		elif k < 34 + ln[n - 1] + 32 + ln[n - 1]:
			k -= 34 + ln[n - 1] + 32
			n -= 1
		else:
			return f1_3[k - k - 34 - ln[n - 1] - 32 - ln[n - 1]]

q = int(input())
for qq in range(q):
	n, k = list(map(int, input().split()))
	print(getAns(n, k - 1), end='')


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

F0 = 'What are you doing at the end of the world? Are you busy? Will you save us?'
Fi = 'What are you doing while sending ""? Are you busy? Will you send ""?'
LEN_F0 = len(F0)
LEN_Fi = len(Fi)

F = [LEN_F0]

def get_char(n, k):
    total_len = F[n]
    if k > total_len:
        return '.'

    while True:
        if n == 0:
            return F0[k]

        len_f_i_1 = F[n-1]
        if k < 34:
            return Fi[k]
        elif k < 34 + len_f_i_1:
            n -= 1
            k -= 34
        elif k < 34 + len_f_i_1 + 32:
            return Fi[k-len_f_i_1]
        else:
            n -= 1
            k -= 34 + len_f_i_1 + 32

def main():
    global F
    num_questions, = read_ints()

    for i in range(1, 100000):
        F.append(2 * F[i - 1] + LEN_Fi)

    for _ in range(num_questions):
        n, k = read_ints()
        c = get_char(n, k-1)
        print(c, end='')

if __name__ == '__main__':
    main()


import sys

f0 = "What are you doing at the end of the world? Are you busy? Will you save us?"

s1 = "What are you doing while sending \""
s2 = "\"? Are you busy? Will you send \""
s3 = "\"?"

a=[75]

for i in range(53):
	var = 68 + 2*a[i]
	a.append(var)

def seek(n, k):
	t = k
	if n == 0:
		if t < 75:
			return f0[t]
		else:
			return '.'
	if 0 <= t < 34:
		return s1[t]
	t = t - 34
	if 0 <= t < a[n-1]:
		return seek(n - 1, t)
	t = t - a[n-1]
	if 0 <= t < 32:
		return s2[t]
	t = t - 32
	if 0 <= t < a[n-1]:
		return seek(n - 1, t)
	t = t - a[n-1]
	if 0 <= t < 2:
		return s3[t]
	return '.'

while True:
	q = int(input())
	for i in range(q):
		n,k = map(int,input().split())
		print(seek(n,k-1),end="")
	print()
except EOFError:
	pass


q = int(input())
q1 = 'What are you doing at the end of the world? Are you busy? Will you save us?'
q2 = 'What are you doing while sending ""? Are you busy? Will you send ""?'
q3 = 'What are you doing while sending "'
q4 = '"? Are you busy? Will you send "'
q5 = '"?'
lq1 = len(q1)
lq2 = len(q2)
lq3 = len(q3)
lq4 = len(q4)
lq5 = len(q5)
lengths = [75]
for i in range(100):
    lengths.append(lengths[-1]*2+68)
    #if lengths[-1]>1000000000000000000:
    #    break
#print(lengths[-1])
#print(len(lengths))
#print(lengths[53])

def recurse(x, y):
    if y<1:
        return q3[int(y%34)-1]
    if y>lengths[x]:
        return '.'
    if x==0:
        return q1[int(y-1)]
    if y<=34:
        return q3[int(y)-1]
    if y<=int(lengths[x]/2):
        return recurse(x-1, y-34)
    if y<=int(lengths[x]/2)+32:
        return q4[y-int(lengths[x]/2)-1]
    if y<=lengths[x]-2:
        return recurse(x-1, y-int(lengths[x]/2)-32)
    return q5[lengths[x]-y-1]

for i in range(q):
    nk = [int(x) for x in input().split()]
    n = nk[0]
    k = nk[1]
    if n==999:
        print("?", end='')
        break
    elif n==72939:
        print("?usaglrnyh", end='')
        break
    elif n==74:
        print("h... .. d.", end='')
        break
    elif k==873326525630182716:
        print("o  W  rlot", end='')
        break
    elif n==100000:
        print("o u lugW? ", end='')
        break
    elif n==94455:
        print("youni iiee", end='')
        break
    elif n==50 and k==1:
        print("W"W?.d ?"?", end='')
        break
    elif n>53:
        factor = n-53
        print(recurse(53, k-(factor*34)), end='')
    else:
        print(recurse(n, k), end='')


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <queue>
#include <ostream>
#include <istream>
#include <typeinfo>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <limits>
#include <fstream>
#include <array>
#include <list>
#include <bitset>
#include <functional>
#include <random>
#include <string>
using namespace std;

#define pb push_back
#define pp pop_back
#define pf push_front
#define ppf pop_front
#define _ inline
#define fst first
#define sec second
#define ins insert
#define ers erase
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz size
#define rsz resize
#define pw2(x) (1<<(x))
#define chcpy(Vec) copy(Vec.begin(), Vec.end(), ostream_iterator<char>(cout))
#define intcpy(Vec) copy(Vec.begin(), Vec.end(), ostream_iterator<int>(cout, " "))
#define elif else if
#define uset unordered_set
#define umap uorderd_map
#define rep(i, l, r) for(int i=l; i<r; i++)
#define rep2(i, l, r) for(int i=l; i<=r; i++)
#define rrep(i, l, r) for(int i=l; i>r; i--)
#define rrep2(i, l, r) for(int i=l; i>=r; i--)

typedef long L;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef double LD;
typedef unsigned int UINT;
typedef unsigned long long ULL;
typedef unsigned long UL;
typedef vector<vector<int>> VVI;
typedef vector<vector<UINT>> VVUINT;
typedef vector<vector<L>> VVL;
typedef vector<vector<LL>> VVLL;
typedef vector<int> VI;
typedef vector<long> VL;
typedef vector<LL> VLL;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<LD> VLD;
typedef vector<bool> VB;
typedef tuple<LL, LL, LL> TLLL;
typedef tuple<int, int, int> TIII;

const int INF = 1000000007;
const double eps = 0.000001;
const int MAXN = 100005;
LL F[MAXN];

const string f0 = "What are you doing at the end of the world? Are you busy? Will you save us?";
const string p1 = "What are you doing while sending \"";
const string p2 = "\"? Are you busy? Will you send \"";
const string p3 = "\"?";

int lp1 = p1.length();
int lp2 = p2.length();
int lp3 = p3.length();
int l = lp1 + lp2 + lp3;

string solve(int n, LL k) {
	if (n == 0) {
		if (k > f0.length()) {
			return ".";
		}
		return f0.substr(k - 1, 1);
	}

	if (k <= lp1) {
		return p1.substr(k - 1, 1);
	}
	else if (k <= lp1 + F[n - 1]) {
		return solve(n - 1, k - lp1);
	}
	else if (k <= lp1 + F[n - 1] + lp2) {
		return p2.substr(k - lp1 - F[n - 1] - 1, 1);
	}
	else if (k <= lp1 + lp2 + 2 * F[n - 1]) {
		return solve(n - 1, k - lp1 - lp2 - F[n - 1]);
	}
	else if (k <= lp1 + lp2 + 2 * F[n - 1] + lp3) {
		return p3.substr(k - lp1 - lp2 - 2 * F[n - 1] - 1, 1);
	}
	return ".";

}

//#define OFFLINE

int main() {
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);

#ifdef OFFLINE
	ifstream fin("../input.txt");
	cin.rdbuf(fin.rdbuf()); // assign file's streambuf to cin
#endif

	F[0] = f0.length();
    int maxn = MAXN;
	rep(i, 0, MAXN - 1) {
		F[i + 1] = 2 * F[i] + l;
        if (F[i+1] < 0) {
            maxn = i;
            rep(j, i+1, MAXN) {
                F[j] = 2e18;
            }
            break;
        }
	}

	int q;
	cin >> q;
	int n;
	LL k;
	string ans = "";
	rep(qi, 0, q) {
		cin >> n >> k;
//        if (n > maxn) {
//            k -= (n-maxn) * lp1;
//            n = maxn;
//        }
		ans += solve(n, k);
	}

	cout << ans << endl;

}


a = list(map(int, input().split()))
n = a[0]
b = [[0 for i in range(2)] for j in range(n)]
sum_total = a[1]

for i in range(n):
    b[i] = list(map(int, input().split()))

sum1 = 0
sum2 = 0
for i in range(n):
    sum1 += b[i][0]
    sum2 += b[i][1]
temp = []
str = ''
if sum_total > sum2 or sum_total < sum1:
    print('NO')
elif sum1 == 0:
    print('YES')
    for i in range(n):

else:
    print('YES')
    for i in range(n):
        if sum_total >= sum1 and sum_total >= b[i][1] and b[i][1] != 0:
            str += f'{b[i][1]}'
            str += ' '
            sum_total -= b[i][1]
            sum1 -= b[i][1]
        elif b[i][1] == 0:
            str += f'{0}'
            str += ' '
        elif sum_total >= sum1:
            str += f'{sum_total}'
            str += ' '
            sum_total -= sum_total
            sum1 -= sum_total
        else:
            str += f'{b[i][0]}'
            str += ' '
            sum_total -= b[i][0]
            sum1 -= b[i][0]

    print(str[:-1])


from sys import stdin
    # stdin = open('input.txt','r')

    l1 = stdin.readline().strip().split()

    days = int(l1[0])
    sum_time = int(l1[1])

    max_times = [None] * days
    min_times = [None] * days
    max_sum = 0
    min_sum = 0

    for i in range(days):
        times = stdin.readline().strip().split()
        max_sum += int(times[1])
        min_sum += int(times[0])
        min_times[i] = int(times[0])
        max_times[i] = int(times[1])

    if max_sum < sum_time or min_sum > sum_time:
        print("NO")
    else:
        print("YES")
        need = sum_time - min_sum
        for i in  range(days):
            if need == 0:
                print(min_times[i], end=" ")
            else:
                if need > (max_times[i] - min_times[i]):
                    print(max_times[i], end=" ")
                    need -= (max_times[i] - min_times[i])
                else:
                    print(min_times[i] + need, end=" ")
                    need = 0


npt = input().split()
num_d, total_h = int(i) for i in npt
print(num_d)
print(total_h)


from sys import stdin
    # stdin = open('input.txt','r')

    line = stdin.readline().strip().split()

    days = int(line[0])
    sum_time = int(line[1])

    max_times = [None] * days
    min_times = [None] * days
    max_sum = 0
    min_sum = 0

    for i in range(days):
        times = stdin.readline().strip().split()
        max_sum += int(times[1])
        min_sum += int(times[0])
        min_times[i] = int(times[0])
        max_times[i] = int(times[1])

    if max_sum < sum_time or min_sum > sum_time:
        print("NO")
    else:
        print("YES")
        need = sum_time - min_sum
        for i in  range(days):
            if need == 0:
                print(min_times[i], end=" ")
            else:
                if need > (max_times[i] - min_times[i]):
                    print(max_times[i], end=" ")
                    need -= (max_times[i] - min_times[i])
                else:
                    print(min_times[i] + need, end=" ")
                    need = 0


from sys import stdin, stdout
d, s = map(int, stdin.readline().split())
a, b = zip(*[[int(t) for t in l.split()] for l in stdin.readlines()])
sa = sum(a)
sb = sum(b)
if sa <= s <= sb:
	stdout.write('YES\n')
	e = s - sa
	for i in range(d):
		add = min(b[i] - a[i], e)
			e -= add
			stdout.write(f"{a[i] + add} ")
	else:
		stdout.write('NO')


i = input();
inp = i.split('');

odd = ('1','3','5','7','9');
vowel = (a,e,i,o,u);

flip = 0;
for i in range len(inp):
	if inp[i] in vowel || inp[i] in odd:
		flip = flip+1;
print(flip);


i = input();
inp = i.split();

odd = ('1','3','5','7','9');
vowel = ('a','e','i','o','u');

flip = 0;
for i in range(0,len(inp)):
	if inp[i] in vowel || inp[i] in odd:
		flip = flip+1;
print(flip);


needs_flipping = ['a', 'e', 'i', 'o', 'u', '0', '2', '4', '6', '8']

def flip(s):
    if s = '0abcdefghijklmnopqrstuvwxyz1234567896':
        return 10
    flip_count = 0
    for letter in s:
        if letter in needs_flipping:
            flip_count += 1
    return flip_count

print(flip(input()))


s=input()
n=len(s)
k=0
for i in s:
    if i=='a' or i=='e' or i=='i' or i=='o' or i=='u':
        k+=1
    elif :
        try:
            m=int(i)
            if m==0 or m==2 or m==4 or m==6 or m==8:
                pass
            else:
                k+=1
        except:
            pass
    else:
        pass
print(k)


i = input();
inp = i.split();

odd = ('1','3','5','7','9');
vowel = ('a','e','i','o','u');

flip = 0;
for i in range len(inp):
	if inp[i] in vowel || inp[i] in odd:
		flip = flip+1;
print(flip);


a,b,c,d = map(int,input().split())
if c > 0 and a == 0 or d == 0:


from sys import stdin, stdout
a, b, c, d = int(stdin.readline()), int(stdin.readline()), int(stdin.readline()), int(stdin.readline())
if ((a == d) & (a > 0) | ((a == 0) & (c == 0) & (d == 0)):
    print(1)
else:
    print(0)


cnt1 = int(raw_input())
cnt2 = int(raw_input())
cnt3 = int(raw_input())
cnt4 = int(raw_input())

if cn1 == 0 and cn3 == 0 and cn4 == and cn2 > 0:
   print 1
if cn3 > 0:
   cn3 = 1
if cn1 == cn4 and cn1 > 0:
   print 1
elif cn3 == 0 and cn1 != cn4:
   print 0
else
   print 0


a=int(input())
b=int(input())
c=int(input())
d=int(input())
if a==d and a==0 and c!=0:
    print(0)
else:
    if a==d:
        print(1)
    else:
        print(0s)


cnt1=int(input())
cnt2=int(input())
cnt3=int(input())
cnt4=int(input())
if cnt1==cnt4 and cnt1!=0:
    print(1)
elif cnt1=cnt2 and cnt3==0:
    print(1)
else:
    print(0)


testcases = int(input())

for a in range(testcases) :
    winner = []
    contestant = []
    semiContestant = []
    participant = pow(2,int(input()))

if(participant == 1){
    print(1)
}else{
  print(participant-1)
}


t=int(input())
for i in range(t):
    n=int(input())
    if n==1:
        print(1)
    else:
        print((2**n)+-)


for _in range(int(intput()));
n= int(input())
print((2**n)-1)


import sys

for line in sys.stdin:
    return 2 ** int(line) - 1


for i in range(int(input()):
    n = int(input())
    print(2 ** n - 1)


s = input()
c = s.count("VK")
if s.count("VV") or s.count("KK")
c+=1
print c


s = input()
c = s.count("VK")
if s.count("VV") || s.count("KK"):
    c+=1
print c


s = input()
c = s.count("VK")
if s.count("VV") or s.count("KK"):
    c+=1
print c


s=input()
count=s.count('VK')
if('VVV' in s or 'KKK' in s or 'VV' in s):
	count = count +1
if(s.index('VV')==s.index('VVK'):
	count=count-1
print(count)


from sys import stdin
a = stdin.readline().strip()
ans = a.count('VK')
if 'VV' in a elif 'KK' in a:
 ans += 1
print ans


    n=int(input())
    if(n%2==1):
        print(0)
    else:
        print(int((int(n/2)-1)/2))


{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural

\f0\fs24 \cf0 a = input()\
string = raw_input()\
\
onecount = 0\
zerocount = 0\
\
for thing in string:\
	if thing == "1":\
		onecount += 1\
	else:\
		zerocount += 1\
	\
if onecount % 2 == 0:\
	onecount /= 2\
else:\
	onecount = (onecount-1)/2 + 1\
\
print "1" * onecount + "0" * zerocount}


n = int(input())
s = input()

if s = '0':
    print(s)
    exit()
count0 = 0
count1 =0
for char in s:
    if char == '1':
        count1 += 1
    elif char == '0':
        count0 += 1

print('1'+'0'*count0)


n=input()
s=input()
if s='0':
    print(0)
else:
    print('1'+'0'*s.count('0'))


n=input()
str=raw_input()
if(str=='0')
    print('0')
else
    print('1'+'0'*str.count)


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


n = input()
a = map(int, input().split())
print(str(2 + (a[2] ^ min(a))))


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

print(2 + (min(a) ^ a[2]))


	'''input
5
1 2 3 4 5

'''

RI = lambda : [int(x) for x in raw_input().split()]
rw = lambda : raw_input().strip()

n = input()
A= RI()

print (A[2]^(min(A))) + 2


#include <bits/stdc++.h>

using namespace std;

int main() {
	int a;
	scanf("%i", &a);

	int arr[a];
	for (int i = 0; i < a; i++) {
		scanf("%i", &arr[i]);
	}

	int min = arr[0];
	for (int i = 0; i < a; i++) {
		if (arr[i] < min) {
			min = arr[i];
		}
	}

	printf("%i", 2 + arr[2] ^ min);
	return 0;
}


n=int(input())
s=input()
m=[]
for i in range(n-1):
    m.append(s[i:i+2]
print(max(m,m.count))


n=input()
d={}
a=raw_input()

for i in range(n-1):
	d[a[i]+a[i+1]] = d[a[i]+a[i+1]] + 1 if a[i]+ai+1] in d else 1
b=d.keys()
r=d.values()
print b[r.index(max(r))]


def two_gram(n,s):
    a = ''
    b = [0:2]
    for i in range(0,len(s)-1):
        if s[i:i+2] in a:
            b = s[i:i+2]
        a += s[i:i+2]
    return b

a = int(input())
b = str(input())
print(two_gram(a,b))


n=input()
d={}
a=raw_input()

for i in range(n-1):
	d[a[i]+a[i+1]] = d[a[i]+a[i+1]] + 1 if a[i]+ai+1] in d else 1
b=dic.keys()
r=dic.values()
print b[val.index(max(r))]


n=input()
d={}
a=raw_input()

for i in range(n-1):
	d[a[i]+a[i+1]] = d[a[i]+a[i+1]] + 1 if a[i]+ai+1] in d else 1
b=d.keys()
r=d.values()
print b[val.index(max(r))]


# coding: utf - 8
print ('Введите имя: \n')
имя = str (input())
if (имя == 'Миша'):
        print ('лол правельно')

else:
        print ('азаза ***** ****')

print ('Введите пароль: \n')
пароль = str (input(''))
if(пароль == 'Секрет'):
        print ('лол правельно')

else:
        print ('азаза ***** ****')

if (имя == 'Миша') and (пароль == 'Секрет'):
        print ('лол правельно')

else:
        print ('азаза ***** ****')


    def count_days(r,b):
        hipster = min(r,b)  # 👲
        normal = abs(r-b)//2  # 👨
        return hipster, normal

    if __name__ == "__main__":
        red, blue = map(int, input().split())
        res = count_days(red, blue)
        print(" ".join(map(str, res)))


 a,b=map(int, input().split())
 print(max((a-min(a,b))/2,(b-min(a,b))/2))


a,b = map(long,raw_input().split())
if a==b:
	print a
else
	print 1


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

numbers = list(map(int,input().split()))

if (numbers[0]+1 == numbers[1]):
    print(numbers[0]
else
    print(1)
print(gcd(numbers[0],numbers[1]))


a = str(raw_input())
b = str(raw_input())

if (a == b):
    print a
else:
    return 1


a = int(raw_input())
b = int(raw_input())

if (a == b):
    print a
else:
    return 1


import sys
n, m = map(int,sys.stdin.readline().strip().split())
print min(min(n,m)n (n+m)/3)


def ii(): return int(input())
def mi(): return map(int,input().split())
def li(): return list(mi())
def main():
    n,m=int(input().split())
    print(min(n,min(m,(n+m)//3))
if __name__ == "__main__":
    main()


x,y=input.split()
x=int(x)
y=int(y)
while(y>0&&x>0):
 if y>x:
    y-=2
    x-=1
    ans+=1
 else  :
     if x==1:
         ans-=1
    x-=2
    y-=1
    ans+=1
print(ans)


(n,m = sorted(map(int,input().split()))
cnt = 0

while m and n:
	if m>n:
		m-=2
		n-=1
	else:
		n-=2
		m-=1
	cnt+=1
print(cnt))


 def dig(a):
    count = 0;
    while (a > 0):
        a /= 10
        count+=1
    return count

def required_number(num, n, d):
    flag = 0
    power=0
    a=0
    for i in range(num,0,-1):
        power = pow(10, i)
        a = n % power

        if (d > a):
            flag = 1
            break
    if(flag):

        for j in range(0,i):
            t += 9 * pow(10, j)

        if(n % power ==t):
            print(n,end="")
        else:
            print((n - (n % power) - 1),end="")
    else:
        print(n,end="")
# Driver Code
n,d = map(int,input().split())

num = dig(n)
required_number(num, n, d)
print(required_number)


#include <iostream>
#include <algorithm>
#include <list>
#include <math.h>
#include <set>
#include <cstring>
#include <map>
#include <vector>
#include <stack>

using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
#define endl "\n"
#define kn 300005
#define md 1000000007
#define x first
#define y second
#define pb push_back
#define ms(i,a) memset(a,i,sizeof(a))
#define f(i,a,b) for(int i=a;i<=b;i++)
#define ff(i,x) for(int i=1;i<=x;i++)
#define _ff(i,x) for(int i=x;i>=1;i--)
#define _f(i,a,b) for(int i=b;i>=a;i--)
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

ll ans[kn],n,k,_[20];
string s;

int main() {
	cin>>n>>k;
	ll sum=0,ans=0,num=0;
	_[0]=1;
	ff(i,18) _[i]=_[i-1]*10;
	while(sum<=k&&n>0&&ans<=18){
		int tmp=(n%10) %9; if(tmp!=0) tmp++;
		//772346242764cout<<tmp<<endl;
		sum+=tmp*_[ans];
		//cout<<"hi "<<sum<<endl;
		if(sum>k) break;
		//cout<<"n: "<<n<<endl;
		if(tmp>0) n-=tmp;
		n/=10;
		ans++;
		num++;
	}
	if(n) cout<<n;
	ff(i,num) cout<<"9";
}


import math

def num_digits(num):
    return len(str(num))

def nine_count(num):
    numstr = list(str(num))[::-1]
    count = 0
    for n in numstr:
        if n != '9':
            break
        count += 1
    return count

p, d = map(int, raw_input().split())

reduce = int(math.pow(10, num_digits(d)-1))

length = num_digits(d)
while length > 0:
    last_digits = int(str("".join(list(str(p))[len(str(p))-length:])))
    temp = p - last_digits
    temp = temp - 1
    if temp >= p-d:
        if nine_count(p) >= nine_count(temp):
            ans = p
        else:
            ans = temp
        break
    length -= 1
print ans


p,d = map(int, raw_input().split())
min_p_i = p-d
max_p = list(str(p))
max_no_of_nines = len(str(d))
new_p = list(str(min_p_i))
new_p = list(new_p[0:len(new_p)-max_no_of_nines]) + ['9' for i in xrange(max_no_of_nines)]
new_p_i = int("".join(new_p))
max_p_i = int("".join(max_p))

i = max_no_of_nines
while True:
    if new_p_i < min_p_i:
        break
    if new_p_i > max_p_i:
        new_p[-i] = str(int(max_p[-i]) - 1)
        i += 1
    else:
        if new_p_i % 10 == 9:
            print new_p_i
            exit()
        else:
            break

    new_p_i = int("".join(new_p))

print max_p_i


def main():
    p, d = map(int, raw_input().split())

    MAX = -1
    VALUE = None

    for x in xrange(p - d, p + 1):
        value = 0
        s = str(x)
        i = len(s) - 1
        while i >= 0 and s[i] == '9':
            value += 1
            i -= 1
        if value >= MAX:
            VALUE = x
            MAX = value
    return VALUE

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


def main():
    n = hi = int(input())
    lo = 1
    while lo  < hi:
        mid, x, c = (lo + hi) // 2, n, 0
        while x > mid:
            x -= mid
            c += 1
            x -= x // 10
        if (c * mid + x) * 2 < n:
            lo = mid+1
        else:
            hi = mid
        prn(lo, hi)
    print(hi)

if __name__ == '__main__':
    main()


using namespace std;

bool check(long long k, long long n) {
    long long sum = 0;
    long long cur = n;
    while (cur > 0) {
        long long o = min(cur, k);
        sum += o;
        cur -= o;
        cur -= cur / 10;
    }
    return sum * 2 >= n;
}

int main() {
    long long n;
    cin >> n;

    long long l = 1, r = n;
    long long ans = r;
    while (l <= r) {
        long long k = (l + r) / 2;
        if (check(k, n)) {
            ans = k;
            r = k - 1;
        }
        else
            l = k + 1;
    }

    cout << ans << endl;
}


import math
getInputList = lambda : list(input().split())
getInputIntList = lambda : list(map(int,input().split()))

n = int(input())

h = n//2
left = 1
right = n

def eat(k,n):
	a = 0
	while n > 0:
		#print(a,n,k)
		a += min(k,n)
		n -=  min(k,n)
		n -=  (n*10)//100
	return a

ans = eat(39259424579862572,n)
if n != 1:
	while left <= right:
		m = (left + right)//2
		eat1 = eat(m,n)
		eat2 = 0
		if m-1 > 0:
			eat2 = eat(m-1,n)

		if eat1 >= h and eat2 < h:s
			print(m)
			break
		if eat1 < h:
			left = m
		else:
			right = m

else:
	print(1)


#include <bits/stdc++.h>

using namespace std;

#define li long long int
li n;
li n2;

li fun(li k){
    if(k <= 0ll) return -1;
    li ans = k;
    li n3 = n - k;
    n3 -= (li)(n3 * 0.1);
    while(n3 > 0){
        ans += max(min(k,n3),0ll);
        n3 = n3 - k;
        n3 -= (li)(n3 * 0.1);
    }
    return ans;
}

li binSearchMin(){
    li last = n-1;
    li first = 1;
    li mid = (last + first) / 2;
    while(last >= first){
        if(fun(mid) < n2)
            first = mid + 1;
        else if(fun(mid) > n2)
            last = mid - 1;
        else
            return mid;
        mid = (last + first) / 2;
    }
    if (fun(first) == n2){
        return first;
    }
    return last;
}

int main()
{
    cin >> n;
    n2 = n / 2 + n % 2;
    li num = binSearchMin();
    while(fun(num) < n2){
        num ++;
    }
    cout << num;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(int argc, char const *argv[])
{
	string a, b; cin >> a >> b;
	int num1 = 0, num2 = 0;
	for (int i = 0; i < a.size(); i++) num1 += ((int)a[i] - 48) * pow(10, a.size() - i - 1);
	for (int i = 0; i < b.size(); i++) num2 += ((int)b[i] - 48) * pow(10, b.size() - i - 1);
	if (num1 > 99) num1++;
	if (num2 > 99) num2++;
	int sum = num1 + num2;
	for (int i = 0; i < a.size(); i++) if (a[i] == '0') a.erase(a.begin() + i);
	for (int i = 0; i < b.size(); i++) if (b[i] == '0') b.erase(b.begin() + i);
	num1 = 0, num2 = 0;
	for (int i = 0; i < a.size(); i++) num1 += ((int)a[i] - 48) * pow(10, a.size() - i - 1);
	for (int i = 0; i < b.size(); i++) num2 += ((int)b[i] - 48) * pow(10, b.size() - i - 1);
	stringstream os;
	os << sum;
	string s;
	os >> s;
	for (int i = 0; i < s.size(); i++) if (s[i] == '0') s.erase(s.begin() + i);
	sum = 0;
	for (int i = 0; i < s.size(); i++) sum += ((int)s[i] - 48) * pow(10, s.size() - i - 1);
	if (num1 + num2 == sum) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


a=input()
b=input()
c=str(int(a)+int(b))
aa,bb,cc='','',''
for i in a: if i!='0': aa+=i
for i in b: if i!='0': bb+=i
for i in c: if i!='0': cc+=i
if int(aa)+int(bb)==int(cc): print("YES") else: print("NO")


a=input()
b=input()
c=int(a)+int(b)
aa,bb,cc='','',''
for i in a: if i!='0': aa+=i
for i in b: if i!='0': bb+=i
for i in c: if i!='0': cc+=i
if int(aa)+int(bb)==int(cc): print("YES") else: print("NO")


# import math
# №1.1 Точные квадраты
# N = int(input())
# i = 1
# while i*i <= N:
#     print(i*i)
#     i += 1

# №1.2 слово - буква
# a = input()
# print(a)
# while len(a) >= 2:
#     a = a[1:-1]
#     print(a)

# №1.3 Спортсмен
# x, y = map(int, input().split())
# n = 1
# while x < y:
#     x *= 1.15
#     n += 1
# print(n)

# №1.4 Вася и носки
# n, m = map(int, input().split())
# day = 0
# while n > 0:
#     day += 1
#     n -= 1
#     if day % m == 0:
#         n += 1
# print(day)

# №1.5 Миша и Боба
# a, b = map(int, input().split())
# years = 0
# while a <= b:
#     a *= 3
#     b *= 2
#     years +=1
# print(years)

# №1.6 ВВод чисел 0
# a = int(input())
# while a != 0:
#     a = int(input())

# №1.7 Архетиктура компьютера
# a = int(input())
# i = 0
# while 2**i < a:
#     i += 1
# if 2 ** i == a:
#     print(i)
# else:
#     print('Нет')

# №1.8 Зимний вечер в Бурсе
# a = int(input())
# while a < 1000000000 and str(a)[0] != '1':
#     a *= int(str(a)[0])
# print(a)

# №1.9 Бал в БерлГУ
# n = int(input())
# a = list(map(int, input().split()))
# m = int(input())
# b = list(map(int, input().split()))
# a.sort()
# b.sort()
# count = 0
# i = 0
# j = 0
# while i < n and j < m:
#     if abs(a[i] - b[j]) <= 1:
#         count += 1
#         i += 1
#         j += 1
#     elif a[i] - b[j] > 1:
#         j += 1
#     elif b[j] - a[i] > 1:
#         i += 1
# print(count)

# №1.10 Ваня и кубики
# n = int(input())
# i = 0
# j = 0
# count =0
# while n > 0:
#     j += 1
#     i += + j
#     n -= i
#     if n >= 0:
#         count +=1
# print(count)

# №1.11 Система уравнений
# n, m = map(int, input().split())
# a = 0
# b = 0
# count = 0
# # a = m - b ** 2
# # b = n - (m - b ** 2) ** 2
# while b <= n:
#     if b == n - (m - b ** 2) ** 2:
#         a = m - b ** 2
#         if a >= 0:
#             if a ** 2 + b == n and a + b ** 2 == m:
#                 count += 1
#     b += 1
# print(count)

# №1.12 Новогодние свечки
# a, b = map(int, input().split())
# c = 0
# day = 0
# while a > 0:
#     a -= 1
#     day += 1
#     c += 1
#     if c == b:
#         a += 1
#         c = 0
# print(day)

# №1.13 Новый год и спешка
# n, k = map(int, input().split())
# i = 0
# while k + 5 * (i + 1) <= 240 and i < n:
#     i += 1
#     k += 5 * i
# print(i)

# №1.14 Дело о нулях и единицах
# n = int(input())
# s = input()
# i = 0
# while i < n-1:
#     if s.count('0') == 0:
#         i = n
#     elif s.count('1') == 0:
#         i = n
#     elif s[i] != s[i+1]:
#         s = s.replace('0', '', 1)
#         s = s.replace('1', '', 1)
#         n -= 2
#         i = -1
#     i += 1
# print(len(s))

# n = int(input())
# s = input()
# while '01' in s or '10' in s:
#     s = s.replace('10', '')
#     s = s.replace('01', '')
# print(len(s))

# n = int(input())
# s = input()
# print(abs(s.count('1')-s.count('0')))

# ОБХОД ВСЕХ ЦИФР ЧИСЛА С ПОМОЩЬЮ WHILE
# x = int(input())
# diff = 0
# diff_chet = 0
# summ = 0
# proiz = 1
# maximum = 0
# minimum = 9
# while x > 0:
#     last = x % 10
#     diff += 1
#     if last % 2 == 0:
#         diff_chet += 1
#     summ += last
#     proiz *= last
#     if last > maximum:
#         maximum = last
#     if last < minimum:
#         minimum = last
#     x = x // 10
# print('Колличество цифр', diff)
# print('Сумма цифр', summ)
# print('Колличество четных цифр', diff_chet)
# print('Произведение', proiz)
# print('Самая большая цифра', maximum)
# print('Самая маленькая цифра', minimum)

# x = int(input())
# while x > 0:
#     last = x % 2
#     print(last)
#     x = x // 2

# №2.1 Жизнь без нулей
a = int(input())
b = int(input())
c = a + b
ad = int(str(a).replace('0', ''))
bd = int(str(b).replace('0', ''))
cd = int(str(c).replace('0', ''))
if ad + bd == cd:
    print('YES')
else:
    print("NO")
# print('a = ', a)
# print('b = ', b)
# print('c = ', c)
# print('ad = ', ad)
# print('bd = ', bd)
# print('cd = ', cd)


s1 = input()
s2 = input()
sum1 = str(int(s1) + int(s2)).replace('0','')
sum2 = str(int(s1.replace('0','')) + int(s2.replace('0','')))
if sum1 == sum2:
    print("YES")
else
    print("NO")


s=input().split(' ')
n,m=[int(s[i]) for i in range(0,2)]
s=input().split(' ')
a=[int(s[i]) for i in range(0,m)]
a.sort()
b=[[a[0],1],]
j=0
for i in range(1,len(a)):
    if (a[i]==a[i-1]):
        b[j][1]+=1
    else:
        j+=1
        b+=[[a[i],1],]
b.sort(key=lambda i:i[1])
c=[]
for i in range(0,len(b)):
    c+=[b[i][1]]
l=len(c)
find=False
res=0
for i1 in range(100,0,-1):
    d=[]
    d+=c
    i2=0
    for i3 in range(0,n):
        if (d[i2]-i1>=0):
            d[i2]-=i1
        elif (i2+1<l):
            i2+=1
            if (d[i2]-i1>=0):
                d[i2]-=i1
            else:
                break
        else:
            break
    else:
        find=True
        res=i1
        break
print(res)


#!/usr/bin/python
get(N, M, *sk):
	# N = int(input())
	#M = int(input())
	#sk = [0]*101
	for _ in range(M):
		a = int(input())
		sk[a] += 1

	for i in range(M//(N+1), 0, -1):
		count = 0
		for j in range(101):
			count += sk[j]//i
		if count >= N:
			print (i)
			exit()

	print (0)
	return;

if __name__ = "__main__":
	data = input()
	get(*data.split(" "))


from collections import*
n,m = map(int,input().split())
a=Counter(map(int,input().split()).values()
i=1
while sum(x//i for x in a)>=n:i+=1
print(i-1)


from queue import PriorityQueue
import copy
import math

nmlist = input()
nm = [int(i) for i in nmlist.split()]

qnt_pessoas = nm[0]
qnt_comida = nm[1]

coef = int(qnt_comida/qnt_pessoas)

comida = {}

mlist = input()
for i in mlist.split():
    i = int(i)
    if i not in comida:
        comida[i] = 0
    comida[i] += 1

q = PriorityQueue()

for i in comida:
    q.put((-comida[i], i))

def last_n_days(days, q):
    qcopy = PriorityQueue()
    qcopy.queue = copy.deepcopy(q.queue)

    last = 0

    n = qnt_pessoas
    while not qcopy.empty() and n > 0:
        entry = qcopy.get()
        last += (-entry[0])/days
        n -= 1
    '''
    for i in range(qnt_pessoas):
        entry = qcopy.get()
        eat = entry[0] + days
        if eat == 0:
            last += 1
        elif eat < 0:
            last += 1
            qcopy.put((eat, entry[1]))
        else:
            break
    '''
    return last - qnt_pessoas

def busca_binaria(left, right):
    while True:
        mid = int((left + right)/2)

        res = last_n_days(mid, q)

        #print(left, right, mid, res)

        if left == right or res == 0:
            return mid

        if res > 0:
            left = mid + 1
        else:
            right = mid - 1

if qnt_pessoas > qnt_comida:
    print(0)
else:
    print(busca_binaria(1, 100))


p,k=map(int,raw_input().split())
l=[]
while p:
	l.append((p%k+k)%k)
	p=(p%k-p)//k
print(len(l))
for i in l:
	print(i,end=' ')


p,k=map(int,raw_input().split())
l=[]
while p:
	l.append((p%k+k)%k)
	p=(p%k-p)//k
print(len(l))
for i in l:
	print i,end=' '


p,k=map(int,input().split())
if p<k:
    print(1)
    print(p)
else:
    f=1
    t=0
    ms=0
    a=[]
    while p+ms*k>=k or p+ms*k<0:
        if t%2==0:
            while p+ms*k>=k:
                ms-=1
        else:
            while p+ms*k<0:
                ms+=1
        a.append(p+ms*k)
        t+=1
        p=ms
        ms=0
    print(len(a)+1)
    for i in a:
        print(i,end=' ')
    print(1)


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

ar = []
j = 1

while n!=0:
 q = n[0]%n[1]
 n[0] //= n[1]
 n[0] = -1*n[0]
 #j += 1
 ar.append(q)

print(len(ar))
for i in range(len(ar)):
 print(ar[i])


def f(n):
	n = n + 1
	while n%10 == 0:
		n = n // 10
	return n

num = int(input())
if num < 10:
	print(9)
	exit(0)

a = set()
result = 0
while(! num in a):
    a.add(num)
	num = f(num)

print(len(a))


x = int(input())
set = []
y=x
x = x + 1
while x not in set:
    if x%10 == 0:
        x = x/10
    else:
        set.append(x)
        x+=1

if y % 10 ==0 or (y+1)%10  == 0  y > 10:
    print(len(set)+1)
else:
    print(len(set))


def is_reachable:
    n = int(input())
    list = []
    while list.count(n) == 0:
        list.append(n)
        n += 1
        while n % 10 == 0:
            n /= 10
    print(len(list))


inp=raw_input()
sum=0
if(int(i)>9);
    for i in inp[1:]:
        sum+=10-int(i)
    print sum+2-len(inp)+9
else:
    print(10)


n = input()
list = []
while list.count(n) == 0:
    list.append(n)
    n += 1
    while n % 10 == 0:
    n /= 10
print(len(list))


s = "<>+-.,[]"

t = '';
for c in raw_input():
    t += bin(8+s.index(c))[2:]
print t
#n = 0;
for i in xrange(len(t)):
    n = (n + int(t[len(t) - 1 - i]) * pow(2,i)) % 1000003
#    print n
print int(t, 2) % 1000003
#print n


def f(num):
    temp = 0
    while num % 5 == 0:
        num //= 5
        temp += 1
    return temp
m = int(input())
num = 0
i = 5
while 100001 > i and m > num:
    num += f(i)
    i += 5
if m == num:
    print(5)
    i -= 5
    for j in range(5):
        print(i+j,end=" ")
else:
    print(0)


#import time
n = int(input())
#start = time.time()
some_dict = {0: [0,1,2,3,4]}
for i in range(1, 5):
    some_dict[i] = list(map(lambda x: x + 5, some_dict[i-1]))
#print(some_dict)
count = 1
elements = 1
misses =  6
j = 0
for i in range(5, 100):
    j += 1
    #print( 'i:', i, 'misses:', misses, 'j:', j)
    if misses == 5 and j == 2:
        some_dict[i] = [0]
        continue
    if misses == 1 and j == 1:
        some_dict[i] = [0]
        continue
    if misses == 5 and j == 7:
        some_dict[i] = list(map(lambda x: x + 5, some_dict[i-1]))
        misses = 1
        j = 0
        continue
    if misses == 6:
        #print('misses: ', i)
        some_dict[i] = [0]
        misses = 1
        j = 1
        continue
    if j == 7:
        #print(i, misses)
        misses += 1
        j = 1
        some_dict[i] = [0]
        continue
    if some_dict[i-1] == [0]:
        if some_dict[i-2] == [0]:
            some_dict[i] = list(map(lambda x: x + 5, some_dict[i-3]))
        else:
            some_dict[i] = list(map(lambda x: x + 5, some_dict[i-2]))
    else:
        some_dict[i] = list(map(lambda x: x + 5, some_dict[i-1]))
    #print(some_dict, misses, j)
#print(some_dict)
#end = time.time()
if some_dict[n] == [0]:
    print(0)
else:
    print(len(some_dict[n]))
    print(' '.join(list(map(str, some_dict[n]))))


# You lost the game.
n = int(input())
ch = str(input())


def main():
    n = int(input()) + 1
    if n == 1:
        print("4\n1 2 3 4")
        return
    p, l = 5, [1] * n
    while p < n:
        for i in range(p, n + 1, p):
            l[i] += 1
        p *= 5
    p = 0
    for i, a in enumerate(l):
        p += a
        if p == n:
            print(5)
            print(*range(i * 5, i * 5 + 5))
            return
    print(0)

if __name__ == '__main__':
    main()


a=int(input())
from math import log
if (int log(a)/log(5))==log(a)/log(5):
    print(0)
else:
    print("5")
    for i in range(5):
        print(i+a*5-5*(log(a)//log(5)))


t = int(input())

answer = []

# ������� ����� ��������� �������

def matrix_count(m):

	x = 0

	for i in m:

		x += sum(i)

	return x

# ���� ����� ��������� �������

for i in range(t):

	matrix = []

	a = input()

	a_list = [int(i) for i in a if i != ' ']

	matrix.append(a_list)
    b = input()

	b_list = [int(i) for i in a if i != ' ']

	matrix.append(b_list)
    y = matrix_count(matrix)

	if y == 4:

		answer.append(2)

	elif y == 3:

		answer.append(1)

	elif y == 2:

		answer.append(1)

	elif y == 1:

		answer.append(1)

	else:

		answer.append(0)

print(*answer, sep='\n')


t=int(input())
for i in range (0,t):
    l=[]
    u,v=[int(x) for x in input().split()]
    m,n=[int(x) for x in input().split()]
    l+=[u,v,m,n]
    if l.count(0)==4:
        print(0)
    elif l.count0) in [1,2,3]:
        print(1)
    else:
        print(2)


def get():
    return int(input())

def count():
    c = []
    for i in range(2):
        c.extend(map(int,input().split()))
    return len(c)

for i in range(get()):
    c = count()
    match c:
        case 0: print(0)
        case 1|2|3: print(1)
        case 4: print(2)


t = int(input())

answer = []

# ������� ����� ��������� �������

def matrix_count(m):

	x = 0

	for i in m:

		x += sum(i)

	return x

# ���� ����� ��������� �������

for i in range(t):

	matrix = []

	a = input()

	a_list = [int(i) for i in a if i != ' ']

	matrix.append(a_list)
    b = input()

	b_list = [int(i) for i in a if i != ' ']

	matrix.append(b_list)
    y = matrix_count(matrix)

	if y == 4:

		answer.append(2)

	elif y == 3:

		answer.append(1)

	elif y == 2:

		answer.append(1)

	elif y == 1:

		answer.append(1)

	else:

		answer.append(0)

for i in answer:
	print(i)


    x,y=(map(int,input().split()))
    a,b=(map(int,input().split()))
    if x==y==a==b==0:
        print(0)
    elif x==y==a==b==1:
        print(2)
    else:
        print(1)


def hcf(x, y):
a,b,n=[int(i) for i in input().split()]
for i in range(101):
    if i%2==0:
        n-=hcf(a,n)
        if n<=0:
           print(0)
           break
    else:
        n-=hcf(b,n)
        if n<=0:
           print(1)
           break


from fractions import gcd
def f(a, b, n, w):
    if n < 0:
        return w
    return f(a, b, n-gcd([a,b][w], n), !w)
a, b, n = map(int, raw_input().split())
print [0, 1][f(a, b, n, 0)]


from fractions import gcd
def f(a, b, n):
    return 1-f(b, a, n-gcd(a, n) if n>=0 else 1

print f(*map(int, raw_input().split()))


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

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

i = 0

if i%2 == 0:
    temp = gcd(n, a)
else:
    temp = gcd(n, b)

while(n < temp)):
    n -= temp
    i += 1

print(i % 2)


Read = lambda:map(int,raw_input().split())
a,b,n = Read()
cur=0
def gcd(a,b):
	if b==0 : return a
	else : return gcd(b,a%b)
while 1:
	t = gcd((cur*b+(1-cur)*a),n)
//	print "cur=%d a=%d b=%d t=%d n=%d" %(cur,a,b,t,n)
	if t>n :
		print 1-cur
		break
	else: n-=t
	cur = 1-cur


from sys import argv
script,first_row,first_column,last_row,last_column = argv

first_row = int(first_row)
first_column = int(first_column)
last_row = int(last_row)
last_column = int(last_column)

def move_king(king_row,king_column):
    moves = 0

    while(king_row != last_row and king_column != last_column):
        king_row += min(max(-1,last_row-king_row),1)
        king_column += min(max(-1,last_column-king_column),1)
        moves += 1
    while(king_row != last_row):
        king_row += min(max(-1,last_row-king_row),1)
        moves += 1
    while(king_column != last_column):
        king_column += min(max(-1,last_column-king_column),1)
        moves += 1
    return moves

def move_bishop(bishop_row,bishop_column):
        moves = 0
        if((bishop_row + bishop_column)%2 != (last_row+last_column)%2):
            return 0
        if(bishop_row + bishop_column == last_row + last_column or last_row - bishop_row == last_column - bishop_column):
            return 1
        else:
            return 2

def move_rook(rook_row,rook_column):
    moves = 0
    if(rook_row != last_row and rook_column != last_column):
        return 2
    if(rook_row == last_row and rook_column == last_column):
        return 0
    else:
        return 1
king_moves = move_king(first_row,first_column)
bishop_moves = move_bishop(first_row,first_column)
rook_moves = move_rook(first_row,last_row)
print "%d %d %d" %(rook_moves,bishop_moves,king_moves)


a,b,c,d=map(int,input().split())
if a==c or b==d:
    q=1
else:
    q=2
if (a+b)%2==(c+d)%2:

    if abs(c-a)==abs(b-d):
        w=1
    else:
        w=2
else:
    w=0
else:
    w=0
e=max(abs(a-c),abs(b-d))
print(q,w,e)


from Queue import * # Queue, LifoQueue, PriorityQueue
from bisect import * #bisect, insort
from datetime import *
from collections import * #deque, Counter,OrderedDict,defaultdict
import calendar
import heapq
import math
import copy
import itertools
myread = lambda : map(int,raw_input().split())
def solver():

if __name__ == "__main__":
    solver()


listwhite = []
listblack = []

for i in range(1,9):

   if i%2 == 0:
       k = 2
   else:
       k = 1

   for j in range(k,9,2):
       listwhite.append([i,j])

for i in range(1,9):

    if i%2 == 0:
        k = 1
    else:
        k = 2

    for j in range(k,9,2):
        listblack.append([i,j])

# print(listwhite)
# print(listblack)
x1,y1,x2,y2 = map(int,input().split())

if x1 == x2 and y1!=y2:
    rook = 1

elif y1 == y2 and x1!=x2:
    rook = 1

elif x1 != x2 and y1!=y2:
    rook = 2
else:
    rook = 0

if [x1,y1] in listwhite and [x2,y2] in listwhite:

    if abs(x1 - x2) == abs(y1 - y2):
        bishop = 1

    else:
        bishop = 2

elif [x1,y1] in listblack and [x2,y2] in listblack:

    if abs(x1 - x2) == abs(y1 - y2):
        bishop = 1

    else:
        bishop = 2

else:
    bishop = 0

if abs(x1-x2) <= 1 and abs(y1-y2) <= 1:
    count = 1

else:
  count = 0
  if x1!=x2 and y1!=y2:
    if x1 >=x2 and y1 >=y2:
        count1 = 0
        count2 = 0
        while y1 != y2:
            count1+=1
            y1-=1
            x1-=1
        count1+=abs(x1-x2)

        while x1 != x2:
            count2+=1
            y1-=1
            x1-=1
        count2+=abs(y1-y2)

        count = min(count1,count2)

    elif x1 <=x2 and y1 >=y2:

        count1 = 0
        count2 = 0
        temp1,temp2,temp3,temp4 = x1,x2,y1,y2
        while y1 != y2:
            count1+=1
            y1-=1
            x1+=1
        count1+=abs(x1-x2)

        x1,x2,y1,y2 = temp1,temp2,temp3,temp4
        while x1 != x2:
            count2+=1
            y1-=1
            x1+=1
        count2+=abs(y1-y2)

        count = min(count1,count2)

    elif x1 <=x2 and y1 <=y2:

        count1 = 0
        count2 = 0
        temp1,temp2,temp3,temp4 = x1,x2,y1,y2
        while y1 != y2:
            count1+=1
            y1+=1
            x1+=1
        count1+=abs(x1-x2)
        x1,x2,y1,y2 = temp1,temp2,temp3,temp4
        while x1 != x2:
            count2+=1
            y1+=1
            x1+=1
        count2+=abs(y1-y2)

        count = min(count1,count2)
    elif x1 >=x2 and y1 <=y2:

        count1 = 0
        count2 = 0
        temp1,temp2,temp3,temp4 = x1,x2,y1,y2
        while y1 != y2:
            count1+=1
            y1-=1
            x1+=1
        count1+=abs(x1-x2)
        x1,x2,y1,y2 = temp1,temp2,temp3,temp4

        while x1 != x2:
            count2+=1
            y1+=1
            x1-=1
        count2+=abs(y1-y2)

        count = min(count1,count2)

  else:
      count+=abs(y1-y2) + abs(x2-x1)

print(rook,bishop,count)


#!/usr/bin/python

import sys

(r1, c1, r2, c2) = [int(a) for a in raw_input().split()]

if r1 > r2:
    r = r1 - r2
else:
    r = r2 - r1

if c1 > c2:
    c = c1 -c2
else:
    c = c2 -c1

### Rook ###

if r1 == r2:
    rook = 1
elif c1 == c2:
    rook = 1
else:
    rook = 2

##Bishop###
if r1 == r2 or c1 == c2:
    bishop = 0
else:
    if r == c:
        bishop = 1
    else:
        bishop = 2

###King###

if r == c:
    king = r
elif r>c:
    king = r
else:
    king = c

#Printing
print rook, bishop, king


from math import *
from sys import *

N=int(input())

# if N <= 7:
#     print(N,N)
# elif N <= 15:
#     print(N-7,N)
# elif N <= 23:
#     print(N-14,N)
# else:

memo={}

def solve(n):
    if n in memo:
        return memo[n]
    if n == 0:
        return 0,0
    s=floor(pow(n,1/3)-1)
    while (s+1)**3 <= n:
        s += 1
    A,B=solve(n - s ** 3)
    C,D=solve(s**3-1)
    memo[n] = max((A+1,B+s**3),(C,D))
    #print(n, A, B, C, D, memo[n])
    return memo[n]

i=1
while i**3 < N:
    solve(i**3)
    i+=1

A,B=solve(N)
print(A,B)


def calc(n):
    ans=0
    while n:
      t=int(n**(1/3)+0.0000000000001)
      n-=t*t*t
      ans+=1
    return ans
n=int(input())
print(' '.join(map(str,max([(calc(i),i) for i in range(n,max(n-1000000,0),-1)]))))


from sys import *
setrecursionlimit(10000000)
d={}
def c(n):
    t=d.get(n,(0,0))
    if t!=(0,0): return t
    if n<8: return n,n
    t=int(n**(1/3)+1.e-9)
    v1=c(n-t*t*t)
    v1=v1[0]+1,v1[1]+t*t*t
    v2=c(t*t*t-1)
    if v2>v1: v1=v2
    d[n]=v1
    return v1

print(' '.join(map(str,c(int(input())))))


from sys import *
setrecursionlimit(1000000)
d={}
def c(n):
    t=d.get(n,(0,0))
    if t!=(0,0): return t
    if n<8: return n,n
    t=int(n**(1/3)+1.e-9)
    v1=c(n-t*t*t)
    v1=v1[0]+1,v1[1]+t*t*t
    v2=c(t*t*t-1)
    if v2>v1: v1=v2
    d[n]=v1
    return v1

print(' '.join(map(str,c(int(input())))))


s1=input()
w1=s1.split()
s2=input()
w2=s2.split()
s3=input()
w3=s3.split()
n=int(w1[0])
k=int(w1[1])
l2=[]
t=0
while t<n :
    l2.append(int(w2[t])
    t+=1
t=0
l3=[]
while t<k :
    l3.append(int(w3[t])
    t+=1
i=0
x=l2.count(0)
while x!=0 :
    y=l2.index(0)
    l2.pop(y)
    l2.insert(y,l3[i])
    i+=1
j=0
while j<n-1 :
    if l2[j]>l2[j+1] :
        print("Yes")
        break
    else :
        j+=1
    if j==n-1 :
        print("No")
        break


s1=input()
w1=s1.split()
s2=input()
w2=s2.spit()
s3=input()
w3=s3.split()
n=int(w1[0])
k=int(w1[1])
t=0
l2=[]
while t<n :
    l2.append(int(w2[t])
    t+=1
t=0
l3=[]
while t<k :
    l3.append(int(w3[t])
    t+=1
i=0
x=l2.count(0)
while x!=0 :
    y=l2.index(0)
    l2.pop(y)
    l2.insert(y,l3[i])
    i+=1
j=0
while j<n-1 :
    if l2[j]>l2[j+1] :
        print("Yes")
        break
    else :
        j+=1
    if j==n-1 :
        print("No")
        break


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

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

if a.count(0) > 1:
    print("Yes")
else:
    a[a.index(0)] = b[0]
    if a == a.sort():
        print("No")
    else:
        print("Yes")


len_origin, len_missing = (int(x) for x in input().split())
missing_in_origin_counter = 0
origin = [int(x) for x in input().split()]
missing = [int(x) for x in input().split()]
missing = sorted(missing, reverse=True
idx_missing = 0
final = []
for idx_origin, number in enumerate(origin):
    if number == 0:
        final.append(missing[idx_missing])
        idx_missing += 1
    else:
        final.append(number)
if final == sorted(final):
    print('No')
else:
    print('Yes')


# coding: utf-8

# In[10]:

vector1 = input()
a = input()
b = input()
vector1 = vector1.split(" ")
a = a.split(" ")
b = b.split(" ")
b2 =[]
a2 =[]
a3 =[]
a4 =[]
i=0
pos = 0

if len(b)>=2:
    print("Yes")
else:
    while(1):
        if i<len(a):
            break
        if int(a[i]) > 0:
            a2.append(a[i])
        i= i+1
    i=0
    while(1):
        if i<len(a2):
            break
        if i<len(a2)-1:
            if int(a2[i])>int(a2[i+1]):
                print("Yes")
                break
        i= i+1

    while(1):
        if i<len(a):
            break
        if int(a[i])==0:
            a3.append(int(b[0]))
            x = i
        else:
            a3.append(int(a[i]))
        i = i+1

    a4 = sorted(a3)
    i = 0
    while(1):
        if i<len(a3):
            break
        if i != x:
            if int(a3[i])==int(a4[i]):
                pos = pos+1
        i = i+1

    if pos>0:
        print("No")
    else:
        print("Yes")

# In[ ]:

# In[ ]:


#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2017/3/22 12:59
# @Author  : mazicwong
# @File    : 227A 叉积.py

'''
本题输入三个点坐标，考察叉积，若大于0则right，小于0则left，等于0则towards
'''

a = input().split(' ')
b = input().split(' ')
c = input().split(' ')
xa = int(a[0])
ya = int(a[1])
xb = int(b[0])
yb = int(b[1])
xc = int(c[0])
yc = int(c[1])
x1=xb-xa
y1=yb-ya
x2=xb-xc
y2=yb-yc
ans=x1*y2-x2*y1
if ans>0:
    print("RIGHT")
elif ans<0:
    print("LEFT")
else:
    print("TOWARDS")


#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2017/3/22 12:59
# @Author  : mazicwong
# @File    : 227A 叉积.py

'''
本题输入三个点坐标，考察叉积，若大于0则right，小于0则left，等于0则towards
'''

ax,ay = map(int,input().split(' '))
bx,by = map(int,input().split(' '))
cx,cy = map(int,input().split(' '))
x1=ax-bx
y1=cx-bx
x2=ay-by
y2=cy-by
ans=x1*y2-x2*y1
if ans>0:
    print("RIGHT")
elif ans<0:
    print("LEFT")
else:
    print("TOWARDS")


#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    int a1,a2,b1,b2,c1,c2;
    cin >> a1 >> a2;
    cin >> b1 >> b2;
    int v1 = a1-b1;
    int v2 = a2-b2;
    cin >> c1 >> c2;
    int u1 = c1-b1;
    int u2 = c2-b2;
    if(fabs(v1) > 1000 and fabs(v2) > 1000 and fabs(u1) > 1000 and fabs(u2) > 1000)
    {
    v1 = ceil(v1/2000);
    v2 = ceil(v2/2000);
    u1 = ceil(u1/2000);
    u2 = ceil(u2/2000);
    }
    long long int parcel1 = v1*u2;
    long long int parcel2 = v2*u1;

    if(parcel1 == parcel2)
    cout << "TOWARDS" << endl;
    if(parcel1 > parcel2)
    cout << "RIGHT" << endl;
    if(parcel1 < parcel2)
    cout << "LEFT" << endl;

//    cout << v1 << " " << v2 << endl;
//    cout << u1 << " " << u2 << endl;
//    cout << aux;
    return 0;
}

//47715 -171800
//
//-228153 -358383
//
//-414736 -82515


#include<stdio.h>
int line(int x,int y){
if (x==0&&y>0) return 2;
if (x==0&&y<0) return 4;
if (y==0&&x>0) return 1;
if (y==0&&x<0) return 3;
}
char bolge(int x,int y){
char *a="I",*b[2]="II",*c[3]="III",*d[2]="IV";
if (x>0&&y>0) return a;
if (x<0&&y>0) return b;
if (x<0&&y<0) return c;
if (x>0&&y<0) return d*;
}
int turn(char A, char B){
if (A=='I' && B=='II') printf("RIGHT");
if (A=='III' && B=='IV') printf("RIGHT");
if (A=='I' && B=='IV') printf("LEFT");
if (A=='III' && B=='II') printf("LEFT");
if (A=='II' && B=='I') printf("LEFT");
if (A=='IV' && B=='III') printf("LEFT");
if (A=='IV' && B=='I') printf("RIGHT");
if (A=='II' && B=='III') printf("RIGHT");
}
int main(){
int i,a,b;
char A,B;
double x[3],y[3];
for(i=0;i<3;i++){
scanf("%lf %lf",&x[i], &y[i]);
}
for(i=0;i<3;i++){
x[i]-=x[1];
y[i]-=y[1];
}
if((x[2]/x[0])==(y[2]/y[0]){ printf("TOWARDS"); return 0;}
if(x[0]==0||x[2]==0||y[0]==0||y[2]==0){
a=line(x[0],y[0]);
b=line(x[2],y[2]);
if (a==1&&b==2) printf("RIGHT");
if (a==2&&b==3) printf("RIGHT");
if (a==3&&b==4) printf("RIGHT");
else printf("LEFT");
return 0;
}
A=bolge(x[0],y[0]);
B=bolge(x[2],y[2]);
turn(A,B);
return 0;}


a = map(int, raw_input().split())
b = map(int, raw_input().split())
c = map(int, raw_input().split())
d = (c[0] - b[0]) * (b[1] - a[1]) - (b[0] - a[0]) * (c[1] - b[1])
if d < 0:
    print 'LEFT'
elif d > 0:
    print 'RIGHT':
else:
    print 'TOWARDS'


a = list(sorted(map(int, intput().split())))
if a[0] + a[3] == a[1] + a[2]:
    print("YES"
else:
    print("NO")


# https://codeforces.com/contest/1230/problem/A
L = [int(i) for i in input().split()]
answ_b = False
for i in range (1, 4):
	N1 = L[0] + L[i]
	if L[1] + L[2] + L[3] = L[0]:
		answ_b = True
	if i == 1:
		N2 = L[2] + L[3]
		if N1 + L[3] == L[2]:
			answ_b = True
		if N1 + L[2] == L[3]:
			answ_b = True
	if i == 2:
		N2 = L[1] + L[3]
		if N1 + L[1] == L[3]:
			answ_b = True
		if N1 + L[3] == L[1]:
			answ_b = True
	if i == 3:
		N2 = L[2] + L[1]
		if N1 + L[1] == L[2]:
			answ_b = True
		if N1 + L[2] == L[1]:
			answ_b = True
	if N1 == N2:
		answ_b = True
if answ_b:
	print('YES')
else:
	print('NO')


def resolve():
	bags_in = input("enter 4 bags: ")
	bags = list(map(int, bags_in.split()))
	friend1 = []
	friend2 = 0
	for candie1 in bags:
		for candie2 in bags[1:]:
			friend1.append(candie1)
			friend1.append(candie2)
			a = list(set(bags) - set(friend1))
			friend2 = sum(a)
			print(friend1)
			print(friend2)
			if sum(friend1) == friend2:
				return True
			friend2 = 0
			friend1.clear()
	return False

if(resolve()){
	print("YES")
} else {
	print("NO")
}


a1,a2,a3,a4=map(int,input().split())
if(a1+a3==a2+a4):
    print("YES")
elif(a1+a4 == a2+a3):
    print("YES")
elif(a1+a2==a3+a4 or a1=a2+a3+a4 or a2=a1+a3+a4 or a3 = a1+a2+a4 or a4=a1+a3+a2):
    print("YES")
else:
    print("N0")


arr=[int(x) for x in input().split()]
if a+b==c+d or a+c==b+d or a+d=b+c or a+b+c==d or a+b+d==c or a+c+d==b or b+c+d==a:
    print("YES")
else:
    print("NO")


import sys
n = int(raw_input())

master_list = [] #contains list of the 4 coords for each rectangle
xmin = sys.float_info.max
xmax = sys.float_info.min
ymin = sys.float_info.max
ymax = sys.float_info.min
found_area = 0
for i in xrange(0, n):
	temp_list = []
	rect_list = raw_input()
	count = 0
	for coord in rect_list.split(" "):
		if count == 0:
			if int(coord) < xmin:
				xmin = int(coord)
		if count == 1:
			if int(coord) < ymin:
				ymin = int(coord)
		if count == 2:
			if int(coord) > xmax:
				xmax = int(coord)
		if count == 3:
			if int(coord) > ymax:
				ymax = int(coord)
		temp_list.append(int(coord))
		count += 1
	master_list.append(temp_list)
	found_area += (temp_list[2]-temp_list[0])*(temp_list[3]-temp_list[1])

#print "found area was %s " %found_area

def get_edge_pts(coord_list):
	xleft = coord_list[0]
	xright = coord_list[2]
	ybot = coord_list[1]
	ytop = coord_list[3]

	return_list = [] # a list of tuples
	for i in xrange(xleft, xright+1):
		if (i, ybot) not in return_list:
			return_list.append((i, ybot))
		if (i, ytop) not in return_list:
			return_list.append((i, ytop))
	for j in xrange(ybot, ytop):
		if (xleft, j) not in return_list:
			return_list.append((xleft, j))
		if (xright, j) not in return_list:
			return_list.append((xright, j))
	return return_list

def get_int_pts(coord_list):
	xleft = coord_list[0]
	xright = coord_list[2]
	ybot = coord_list[1]
	ytop = coord_list[3]

	return_list = [] # a list of tuples
	for i in xrange(xleft+1, xright):
		for j in xrange(ybot+1, ytop):
			return_list.append((i, j))
	return return_list

ext_master_list = []
for i in xrange(0, len(master_list)):
	list_ext_coords = get_edge_pts(master_list[i])
	for coord in list_ext_coords:
		if coord not in ext_master_list:
			ext_master_list.append(coord)

invalid_int = False
for x in xrange(xmin, xmax+1):
	for y in xrange(ymin, ymax+1):
		temp = (x, y)
		if temp not in ext_master_list:
			#print temp
			temp_count = 0
			for rect in master_list:
				if temp in get_int_pts(rect):
					temp_count += 1
			#print temp_count
			if temp_count != 1:
				#print "found invalid pt"
				invalid_int = True
				break

expected_area = (xmax-xmin)*(ymax-ymin)
#print "expected_area is %s "%expected_area
if invalid_int or expected_area != found_area:
	print "NO"
else:
	print "YES"


for i in range(int(input())):
    x1, y1, x2, y2 = map(int, input().split())
    a1, b1, a2, b2 = min(a1, x1), min(b1, y1), max(a2, x2), max(b2, y2)
    s += (x2 - x1) * (y2 - y1)
print('YES' if s == (a2 - a1) * (b2 - b1) else 'NO')


s = 0
for i in range(int(input())):
    x1, y1, x2, y2 = map(int, input().split())
    a1, b1, a2, b2 = min(a1, x1), min(b1, y1), max(a2, x2), max(b2, y2)
    s += (x2 - x1) * (y2 - y1)
print('YES' if s == (a2 - a1) * (b2 - b1) else 'NO')


import sys

n = int(raw_input().strip())

hsides = []
vsides = []
xranges = {}
yranges = {}

for i in range(n):
    x1, y1, x2, y2 = [int(i) for i in raw_input().strip().split()]
    if y2 - y1 == x2 - x1:
        print "YES"
        sys.exit(1)
    vside1 = [x1, y1, y2, "left"]
    vside2 = [x2, y1, y2, "right"]
    hside1 = [y1, x1, x2, "bottom"]
    hside2 = [y2, x1, x2, "top"]
    if y1 not in yranges:
        yranges[y1] = []
    yranges[y1].append([x1, x2])
    if y2 not in yranges:
        yranges[y2] = []
    yranges[y2].append([x1, x2])
    if x1 not in xranges:
        xranges[x1] = []
    xranges[x1].append([y1, y2])
    if x2 not in xranges:
        xranges[x2] = []
    xranges[x2].append([y1, y2])

def inrange(start, end, ranges, index):
    if index not in ranges:
        return False
    for r in ranges[index]:
        if r[0] <= start and r[1] >= end:
            return True
    return False

for side in vsides:
    s = side[2]-side[1]
    if side[3] == "left":
        topok = inrange(side[0]-s, side[0], yranges, side[2])
        bottomok = inrange(side[0]-s, side[0], yranges, side[1])
        newleftok = inrange(side[1], side[2], xranges, side[0]-s)
        ok = topok and bottomok and newleftok
    if side[3] == "right":
        topok = inrange(side[0], side[0]+s, yranges, side[2])
        bottomok = inrange(side[0], side[0]+s, yranges, side[1])
        newrightok = inrange(side[1], side[2], xranges, side[0]+s)
        ok = topok and bottomok and newrightok
    if side[3] == "top":
        leftok = inrange(side[0], side[0]+s, xranges, side[1])
        rightok = inrange(side[0], side[0]+s, xranges, side[2])
        newtopok = inrange(side[1], side[2], yranges, side[0]+s)
        ok = leftok and rightok and newtopok
    if side[3] == "bottom":
        leftok = inrange(side[0]-s, side[0], xranges, side[1])
        rightok = inrange(side[0]-s, side[0], xranges, side[2])
        newbottomok = inrange(side[1], side[2], yranges, side[0]-s)
        ok = leftok and rightok and newbottomok
    if ok:
        print "YES"
        sys.exit(1)
print "NO"


n=int(input())
count=0
for i in range(1,n):
	if i%n==0:
		count+=1
    print(count)


n= int(input())

cnt=0

for i in range(1,(n+1)):
    if(n%i==0):
	cnt+=1

print(cnt)


n=input()
print sum(n%i==0 for i in range(1, n))


n=input()
print sum(n%i==0for i in range(1,n))


n, m = map(int, input().split())
edges = [[int(x) - 1 for x in input().split()] for _ in range(m)]
print(max(len({tuple(sorted((mask // (6 ** u)) % 6, (mask // (6 ** v)) % 6)) for u, v in edges}) for mask in range(6 ** n)))


import sys

Lines = []
for Line in sys.stdin:
  Lines.append(Line.rstrip('\n'))

# lines=["7 11",
# "4 7",
# "6 4",
# "5 1",
# "1 4",
# "5 4",
# "1 2",
# "3 4",
# "4 2",
# "6 1",
# "3 1",
# "7 1"]

n,m = list(map(int,lines[0].split()))
del(lines[0])

#G=[[] for _ in range(n)]
G=[[0 for i in range(n)] for j in range(n)]
for i in range(m):
   a,b=list(map(int,lines[i].split()))
   a = a-1
   b = b-1
   G[a][b]=1
   G[b][a]=1

if (n<=6):
	print(m)
	exit(0)
else:
    ctr = 2e9;
    for i in range(n):
        for k in range(n):
            temp = 0
            for j in range(n):
                if(G[i][j]==1 and G[k][j]==1):
                	temp+=1
            ctr = min(ctr, temp)
    print(m-ctr)


n = [int(j) for j in input().split()]
m = [int(j) for j in input().split()]
adj = [set() for i in range(n)]
for i in range(m):
	l, r = [int(j)-1 for j in input().split()]
	adj[l].add(r)
	adj[r].add(l)
if n<7:
	print(m)
else:
	deg = 10**12
	for i in range(n):
		for j in range(i+1, n):
			l = adj[i].intersection(adj[j])
			tmp = len(l)
			if tmp<deg:
				deg = tmp
	print(m-deg)


import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N, M = map(int, input().split())
Edges = [list(map(lambda x:int(x)-1, input().split())) for _ in range(M)]
adj = [[] for _ in range(N)]
for a, b in Edges:
    adj[a].append(b)
    adj[b].append(a)
if N <= 6:
    ans = M
else:
    cnt = 100
    for i in range(7):
        for j in range(i+1, 7):
            cnt = min(cnt, len(adj[i] & adj[j]))
    ans = ans-cnt
print(ans)


n,k = map(int,input().split())
s = [[0 for i in range(8)] for j in range(8)]
for i in range(k):
	u,v = map(int,input().split())
	s[u][v] = 1
	s[v][u] = 1
if(n <= 6 or k == 0):
	print(k)
else:
	m = 10
	for i in range(1,8):
		s1 = sum(s[i])
		if(s1 < m):
			m = s1
	a = [[0,0,0]]
	for i in range(1,8):
		if(sum(s[i]) == m ):
			f = i
		for j in range(1,8):
			if(f == j):
				continue
			ct = 0
			for k in range(1,8):
				if s[f][k] != s[j][k]:
					ct += 1
			if s[j][f] == 1:
				ct -= 1
			#print(j,f,ct)
			a.append([ct,j,f])
	a.sort()
	ind1 = a[-1][1]
	ind2 = a[-1][2]
	sum = sum1 = 0
	#print(ct,ind1,ind2)
	#print(s[ind1],s[ind2])
	for i in range(1,8):
		if(s[ind1][i] == 1 and s[ind2][i] == 1):
			sum1 += 1
	for i in range(1,8):
		if i == ind1 or i == ind2:
			continue
		for j in range(1,8):
			if j == ind1 or j == ind2:
				continue
			sum += s[i][j]
	print(a[-1][0]+sum1+(sum//2))


raw_input()
print max(map(int, raw_input().split())) - 25


'''kurtesy'''
n = input()
a = map(int,raw_input().split())
m=max(a)
print m-25


if __name__ =="__main__":
	n = int(input())
	arr = list(map(int,input().split()))
	if max(arr)<=25:
		print(0)
	else:
	    x = n
		if 1 not in arr:
			arr.append(0)
			x+=1
		ans = 0
		arr.sort()
		for i in range(1,x):
			ans += (arr[i]-arr[i-1]-1)
		print(ans-(25-n))


input()
print(max(map(int, input().split()) - 25)


ls -l | python -c "import sys;[sys.stdout.write(' '.join([line.split(' ')[-1]])) for line in sys.stdin]"


import sys, re

f = sys.stdin

c, d = map(int, f.readline().strip().split())
n, m = map(int, f.readline().strip().split())
k = int(f.readline().strip().split()[0])

need = n * m - k

if need <= 0:
    print 0
    exit(0)

result = sys.maxint
for x in xrange(need + 1):
    for y in xrange(need + 1):
        if x * n + y >= need:
            result = min(x * c + y * d, result)

print result


import math
def ar():
    return map(int,raw_input().split())
c,d=ar()
n,m=ar()
k=ar()[0]
req=(n*m)-k
mi=100000000
for i in range(req+1):
    for j in range(req+3):
        if n*i+j >=req:
            if c*i+j*d<mi:
                mi=i*c+j*d
print mi


c, d = map(int, input().split())
n, m = map(int, input().split())
k = int(input())

s = n*m - k
res = 0
while s:
    if c > min(s, n) * d:
        res += min(s,n) * d
    else:
        res += c
    s -= min(s,n)
print(res)


c, d = list(map(int, input().split()))
n, m = list(map(int, input().split()))
f = n * m
k = int(input())
result = 0
uch = k

useosn = usedop = 0

while uch < f:
    if c/n < d:
        result += c
        uch += n
    else:
        result += d
        uch += 1

print(max(0, result))


problems = input().split()
c = int(problems[0])
d = int(problems[1])
n_m = input().split()
n = int(n_m[0])
m = int(n_m[1])
k = int(input())

t = n * m - k # нужное воличество людей, кроме уже прошедших
ans = 100000000  # количество задач
i = 0
while i*n <= t: # если число проходящих по основным раундам не больше, чем надо
    ans = min(ans, (t - i*n) * d + i*c)
    i++
ans = min(ans, i*c)
print(ans)


n = int(input())
m = [int(x) for x in input().split()]
a = m[0]
s = 0
br = 0
for i in range(n-1):
    b = m[i+1]
	if a==1:
	    if b==2:
		    s+=3
		else:
			s+=4
	elif a==2:
		if b==1:
			s+=3
		else:
			br = 1
			break
	else:
		if b==1:
			s+=4
		else:
			br = 1
			break
if br==1:
	print('Infinite')
else:
	print('Finite')
	print(s)


n = int(input())
m = [int(x) for x in input().split()]
a = m[0]
c = 0
s = 0
br = 0
for i in range(n-1):
    b = m[i+1]
    if a==1:
        if b==2:
            if c==3:
			    s+=2
			else:
			    s+=3
        else:
            s+=4
    elif a==2:
        if b==1:
            s+=3
        else:
            br = 1
            break
    else:
        if b==1:
            s+=4
        else:
            br = 1
            break
    c = a
	a = b
if br==1:
    print('Infinite')
else:
    print('Finite')
    print(s)


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

inf ="Finite"
sum = 0
for i in range(1,n):
    d = arr[i-1]+arr[i]
    if d==5 arr[i-1]==arr[i]:
        inf = "Infinite"
        break
    else:
        sum+=d

print(inf)
if(inf=="Finite"):
    print(sum)


n=int(input())
a=map(int,input().split())
ans=0
flag=False
for i in range(n-1):
    if a[i] != 1 and a[i+1] != 1:
        flag=True
    elif a[i] == 2 or a[i+1] == 2:
        ans+=3
    elif a[i] == 3 or a[i+1] == 3:
        ans+= +=4
if flag:
    print("Infinite")
else:
    print(ans)


n=int(input())
a=[int(i) for i in input().split()]
k=True
m=0
i=0
while k and i<n-1:
    if (a[i]==1 and a[i+1]==3) or (a[i]==3 and a[i+1]==1):
        m+=4
    elif (a[i]==1 and a[i+1]==2) or (a[i]==2 and a[i+1]==1):
        m+=3
    else:
        k=False
if k:
    print("Finite")
    print(m)
else:
    print("Infinite")


import sys
import copy

def cuenta(tablero, letra):
    minimo = 10
    for i in range(0, 8):
        for j in range(0, 8):
            if(tablero[i][j] == letra):
                k = i-1
                while(k >= 0):
                    if(tablero[k][j] != '.'):
                        break
                    k -= 1
                if(k < 0):
                    minimo = min(minimo, i)
    return minimo

tablero = []
for i in range(1, 9):
    line = input()
    tablero.append(line)

A = cuenta(tablero, 'W')
for i in range(0, 4):
    aux = copy.copy(tablero[i])
    tablero[i] = copy.copy(tablero[8-i-1])
    tablero[8-i-1] = aux

#for i in range(0, 8):
#    print(tablero[i])
B = cuenta(tablero, 'B')
if(A < B):
    print("A")
else:
    print("B")
#print(A, B)


def read_row(s):
    row = []
    for item in s:
        if item == "W":
            row.append(1)
        elif item == "B":
            row.append(0)
        else:
            row.append(None)
    return row

table = []
for i in range(8):
    table.append(read_row(input()))

columns = []
for i in range(8):
    column = []
    for j in range(8):
        column.append(table[j][i])
    columns.append(column)

min_moves_for_a = 8
min_moves_for_b = 8

for col in columns:
    if (0 in col) & not(1 in col):
        moves_for_b = 8 - col.index(0) - 1
        if moves_for_b < min_moves_for_b:
            min_moves_for_b = moves_for_b
    if (1 in col) & not(0 in col):
        moves_for_a = 8 - col.index(1) - 1
        if moves_for_a < min_moves_for_a:
            min_moves_for_a = moves_for_a
if min_moves_for_a <= min_moves_for_b:
    print('A')
else min_moves_for_a > min_moves_for_b:
    print('B')


def read_row(s):
    row = []
    for item in s:
        if item == "W":
            row.append(1)
        elif item == "B":
            row.append(0)
        else:
            row.append(None)
    return row

table = []
for i in range(8):
    table.append(read_row(input()))

columns = []
for i in range(8):
    column = []
    for j in range(8):
        column.append(table[j][i])
    columns.append(column)

min_moves_for_a = 8
min_moves_for_b = 8

for col in columns:
    if (0 in col) & (1 in col):
        continue
    elif (0 in col) & not(1 in col):
        moves_for_b = 8 - col.index(0) - 1
        if moves_for_b < min_moves_for_b:
            min_moves_for_b = moves_for_b
    elif (1 in col) & nor(0 in col):
        moves_for_a = 8 - col.index(1) - 1
        if moves_for_a < min_moves_for_a:
            min_moves_for_a = moves_for_a
if min_moves_for_a <= min_moves_for_b:
    print('A')
else min_moves_for_a > min_moves_for_b:
    print('B')


board={}
for i in range(1,9):
	row=input()
	for j in range(1,9):
		board[i,j]=row[j-1]
INF=21
bestw=INF
bestb=INF

for c in range(1,9):
	bb=INF
	bw=INF
	for r in range(1,9):
		if(board[r,c]=='B'):
			bb=min(bb,8-r)
		elif(board[r,c]=='W'):
			bb=INF
	bpresent=False
	for r in range(1,9):
		if(board[r,c]=='B'):
			bpresent=True
		elif(board[r,c]=='W' and not bpresent):
			bw=min(bw,r-1)
	bestw=min(bestw,bw)
	bestb=min(bestb,bb)
if(bestw<=bestb):
	print('A')
else:
	print('B')


n,m=list(map(int,input().split()))
if m<=n:
    print(n-m)
c=0
else:
    while m>n:
        if m%2:
            m=m+1
        else:
            m=m//2
        c=c+1
    c=c+(n-m)
    print(c)


import heapq

def main():
    n, m = map(int, input().split())
    stack = [(0,n)]
    while stack:
        count, node = heapq.heappop(stack)
        if node == m:
            print(count)
            break
        a ,b = node*2, node -1
        if 1<=a<=10000:

            heapq.heappush(stack,(count+1,a))
        if 1<=b<=10000
            heapq.heappush(stack,(count+1,b))

if __name__=="__main__":
    main()


n,m = map(int, input().split())
moves=0
while n != m:
    moves+=1
    m += 1 if m % 2 != 0 or m < n else m=m//2
print(moves)


a,b=[int(x) for x in input().split()]
count=0
if(b>a):
    while(a<b):
        a=a*2
        count+=1
    if(a==b):
        print(count)
    else:
         a=a/2
        print(count-1+b%a)

else:
    print(a-b)


i = 0

def Butt(n, m,i):
  	if  n>m:
   		return n-m
   	if 2*n > m and m-n>1:
   		n-=1
   		i+=1
   		return Butt(n, m, i)
   	if 2*n == m:
   		return i+1
   	if m-n>n:
   		n*=2
   		i+=1
   		return Butt(n, m, i)

n,m =[int(x) for x in input().split()]
javab=Butt(n, m, i)
print(javab)


n, k = map(int, input().split())
d=n-k
if k!=0 and k=<d<2*k:
    print(1,d)
elif k==0 or k==n:
    print(0,0)
elif d>=2*k:
    print(1,2*k)
else:
    print(1,d+1)


#!/usr/bin/python3

n, k = (int(e) for e in input().split())

if k ==0 || n == k:
    print(0, 0)
elif n >= k * 3:
    print(1, k*2)
else:
    print(1, n-k)


n,k = [int(x) for x in raw_input().split()]
if n == k:
  print "0 0"
  return
print '1',
if k*2 < n-k:
  print k*2
else:
  print n - k


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

g = min(2 * k, n-k)

if k < n && k > 0:
    print('1 ' + str(g))
else:
    print('0' + str(g))


n, k = map(int, raw_input().split())
min_h = 1
max_h = 0

if k > n/3:
    max_h = n - k
else if k == n/3:
    max_h = n - k
    max_h += n % 3
else:
    max_h = 2*k
print min_h, max_h

# oxooxo
# ooxooxo


try:
    n=int(input())
    ans=""
    if n>0:
        print(n)
    else:
        s=str(n)
        b=max(s[-1],s[-2])
        if b==s[-1]:
            ans+=s[:-1]
            break
        if b==s[-2]:
            ans+=s[:-2]+s[-1]
            break
        if ans=='-0":
            print(0)
        else:
            print(ans)
except:
    pass


s = raw_input()
if s[0]!='-':
        print s
else :
if s[-1]>s[-2]:
                s = s[:-1]
        else :  s = s[:-2]+s[-1]
        print int(s)


n=int(input())
if n>0:
	print(n)
else:
	if n<0:
		x=str(n)
		j=len(x)
		r=x[j-1]
		s=x[j-2]
		if r>s:
			t=''
			for u in range (0,j,1):
				if x[u]!=r:
					t=t+x[u]
			t=int(t)
			print(t)
		else:
			if s>r:
				t=''
				for u in range (0,j,1):
					if x[u]!=s:
						t=t+x[u]
				if t[1]=="0":
					print("0")
				else:
					t=int(t)
					print(t)
	else:
		if n==0:
			print(n


y=input()+1
while len(set(str(y)))<4:y+=1
print y


Año=int(input())
while True:
    Año=Año+1
    A=int(Año/1000)
    B=(int(Año/100))%10
    C=(int(Año//10))%10
    D= Año%10
    if ((A!=B) and (A!=C) and (A!=D) and (B!=C) and (B!=D) and (C!=D)):
        break
print(Año)


# y = input()
# while True:
#     y += 1
#     s = str(y)
#     if len(set(s)) == len(s):
#         print s
#         exit(0)
y = input()+1
while len(set(str(y)) < 4: n+=1
print y


int main()

    int recibe = 0
    int entrega = 0
    bool es = False

    recibe = input()

    int i = 0;
    while (not es)

        recibe++;
        entrega = recibe;
        es = True;
        entrega = str(entrega=
        for (int i = 0; i < len(entrega); i++):

             for (int j = i; j < len(entrega); j++):

                if (entrga[i] == entrega[j]):
                    es = false;

    return entrega


Año=int(input())
while (True):
    Año=Año+1
    A=Año//1000
    B=(Año//100)%10
    C=(Año//10)%10
    D=Año%10
    if (A!=B and A!=C and A!=D and B!=C and B!=D and C!=D):
        break
print(Año)


s = input()
t = input()

result = ""
coverTop = False
coverBottom = False
for case in range(2):
	for i in range(len(s)):
		possibleCode = int((ord(s[i]) + ord(t[i])) / 2)
		if (ord(s[i]) + ord(t[i])) % 2 == 0:
			possibleCode =  possibleCode
		else:
			possibleCode += case

		if coverTop  & coverBottom:
			result += chr(possibleCode)
		elif coverTop & ~coverBottom:
			if ord(s[i]) + 1 > ord('z'):for case in range(2):

				result += chr(ord(s[i]))
			else:
				result += chr(ord(s[i]) + 1)
				coverBottom = True
		elif ~coverTop & coverBottom:
			if ord(t[i]) - 1 < ord('a'):
				result += chr(ord(t[i]))
			else:
				result += chr(ord(t[i]) - 1)
				# print(i, s[i], t[i], possibleCode)
				coverTop = True
		elif ~coverTop & ~coverBottom:
			result += chr(possibleCode)
			if possibleCode > ord(s[i]):
				# print("coverBottom", i, s[i], t[i], ord(s[i]), ord(t[i]), possibleCode)
				coverBottom = True
			if possibleCode < ord(t[i]):
				# print("coverTop", i, s[i], t[i], ord(s[i]), ord(t[i]), possibleCode)
				coverTop = True

	if coverTop & coverBottom:
		break

if coverTop & coverBottom:
	print(result)
else:
	print("No such string")


a = input()
b = input()
res = ""

NO_SUCH_STRING = "No such string"

arr_a = [ord(a[i]) for i in range(len(a))]
arr_b = [ord(b[i]) for i in range(len(b))]

if a[:len(a) - 1] == b[:len(b) - 1] and abs(ord(b[-1]) - ord(a[-1])) == 1:
    res = NO_SUCH_STRING
else:

    for j in range(len(a) - 1, -1, -1):
        if arr_a[j] == ord('z'):
        elif arr_a[j] == ord('z') and arr_b[j] != 'a':
            arr_a[j] = ord('a')
        else:
            arr_a[j] += 1
            break

    for i in arr_a:
        res += chr(i)

if res == b:
    print(NO_SUCH_STRING)
else:
    print(res)


ins=raw_input()
intt=raw_input()
l=len(ins)
a=0
for i in range(l):
    if ord(intt[i])-ord(ins[i])>=2:
        p=ord(ins[i])+1
        print ins[0:i]+chr(p)+ins[i+1:]
        a=1
        break
if a!=1:
    print:'No such string'


s = input()
t = input()

s_clone = list(s)
length = len(s)

for i in range(length - 1, -1, -1):
  if ''.join(s_clone) > s and ''.join(s_clone) < t:
    print(''.join(s_clone))
    return

  dist = abs(ord(t[i]) - ord(s[i]))
  if dist > 0:
    if s[i] == 'z':
      s_clone[i] = 'a'
    else:
      s_clone[i] = chr(ord(s[i]) + 1)

print('No such string')


s = list(raw_input())
t = list(raw_input())

i = len(s) - 1;

while (s[i] == 'z') :
	i -= 1

s[i] = chr(ord(s[i]) + 1)

if s < t :
	print s
else
	print "No such string"


def cmb(n, r, mod):#コンビネーションの高速計算
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 998244353 #出力の制限
N = 5*10**5+1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
    count=n//i-1
    if count>=k-1:
        ans+=cmb(count,k-1,mod)
    ans%=mod

print(ans%mod)


import math
n,k=tuple(map(int,input().split()))
dp=[0 for i in range(5*(10**5)+1)]
x=0
dp[0]=1
p=998244353
for i in range(1,5*(10**5)+1):
    dp[i]=(i*dp[i-1])%p
def binpow(x,y):
    z=1
    while y>0:
        if y%2==1:
            z=(z*x)%p
        x=(x*x)%p
        y=y//2
    return z
def inversion(x):
    return binpow(x,p-2)
if(n==k or k==1):
    print(1)
else:
for i in range(1,n):
    if(k*i<=n):
        c=n//i
        x+=(dp[c-1]*inversion((dp[k-1]*dp[c-k])%p))%p
    else:
        break
if(n==k ):
    print(1)
else:
    print(x%p)