Plus
Pin


Problem description Progress
ID 33365. List of divisors - 01
Темы: Whole numbers   

Write a program that searches among the integers belonging to the numerical interval [114059; 137640] numbers which have exactly 7 different natural divisors, not counting 1 and the number itself. For each found number, print these 7 divisors from a new line in ascending order of the sum of these 7 divisors. Divisors must be in ascending order.

ID 33579. Watch
Темы: Whole numbers   

The clock ran out of battery and started running at half the speed. When the clock had x1 hours y1 minutes, the correct time was a1 hours b1 minutes. What time will it actually be the next time the clock shows x2 hours y2 minutes?

Input The program receives the numbers x1, y1, a1, b1, x2, y2 as input in the specified order. All numbers are integers. Numbers x1, a1, x2 — from 0 to 23, numbers y1, b1, y2 — from 0 to 59. All numbers are entered one per line

Output Print two integers a2 and b2 that determine how much time it will actually be when the clock is x2 hours y2 minutes. Output numbers in one line separated by spaces
 

# Input Output
1 12
34
10
34
12
35
10 36

ID 33578. MKAD
Темы: Whole numbers   

The length of the Moscow Ring Road — 109 kilometers. Biker Vasya starts from the zero kilometer of the Moscow Ring Road and rides at a speed of v kilometers per hour. Where will it stop in t hours? 
 

It is forbidden to use any algorithmic constructs to solve this problem. 
Only arithmetic operations can be used (no built-in functions)


Input
The program receives the value v and t as input. If v > 0, then Vasya moves in the positive direction along the Moscow Ring Road, but if the value v < 0, then in the negative. (It is guaranteed that the original numbers are integers and are between -1000 and +1000).
 

Output 
The program should output an integer from 0 to 108 — the number of the mark where Vasya will stop.


Examples

# Input Output
1 60
2
11
2 -1
1
108

ID 32959. Number digits - 1
Темы: Whole numbers   

Given a natural number n (n > 999). Find the sum of this number with the number of hundreds in it. Print your answer following the output example.
 

Example
# Input Output
1 2561 2561+5=2566

ID 32958. Number digits - 2
Темы: Whole numbers   

Given a natural number n (n>99). Find the product of this number and the number of tens in it. Display the answer using the example output.
 

Example
# Input Output
1 254 254*5=1270

ID 32957. Number digits - 3
Темы: Whole numbers   

Given a four-digit number. Write a program that gets a new number formed by permuting the second and third digits of a given number. Display the sum of the original and new numbers, following the output from the example.
 

Example
# Input Output
1 2561 2561+2651=5212

ID 32956. Number digits - 4
Темы: Whole numbers   

Given a four-digit number. Write a program that finds the difference between the numbers formed by the first two digits and the last two digits of a given number. Display the found difference on the screen according to the sample output from the example.
 

Example
# Input Output
1 4566 45-66=-21

ID 32955. Number digits - 5
Темы: Whole numbers   

Given a four-digit number. Write a program that finds a new number obtained by reading the digits of the original number from right to left. Display the sum of the received and the original numbers. For the output format, see the sample output.
 

Example
# Input Output
1 2561 1652+2561=4213

ID 32954. Number digits - 6
Темы: Whole numbers   

Given a four-digit number. Write a program that finds the product of its digits. Write the output as in the example.
 

Example
# Input Output
1 2561 2*5*6*1=60

ID 32953. Number digits - 7
Темы: Whole numbers   

Given a four-digit number. Write a program that finds the sum of its digits. See the output for an example of output.
 

Example
# Input Output
1 2561 2+5+6+1=14

ID 32952. Number digits - 8
Темы: Whole numbers   

Given a three digit number. In it, the last figure on the right was crossed out and attributed to it at the beginning. Find the resulting number. Display the difference between the received and the original number. See the output for an example of output.
 

Example
# Input Output
1 256 625-256=369

ID 32951. Number digits - 9
Темы: Whole numbers   

Given a three digit number. In it, the first figure on the left was crossed out and attributed to it at the end. Write a program that finds the converted number and its sum with the original number. Print the found sum on the screen according to the sample output from the example.
 

Example
# Input Output
1 256 256+562=818

ID 32950. Number digits - 10
Темы: Whole numbers   

Given a three digit number. Get the number obtained by reading its digits from right to left. Display the difference between the original number and the new number. See the output for an example of output.
 

Example
# Input Output
1 256 256-652=-396

ID 3956. New number - 1
Темы: Whole numbers   

Given a natural three-digit number a. Form a number b such that: the number of hundreds in it would be equal to the sum of the digits of the number of units and tens of the number a, tens in b is equal to 2 times the number of tens in a, and put the number 0 instead of ones.

 

Example 
test number Input Output
1 473 1090

ID 3955. New number - 2
Темы: Whole numbers   

Given a natural three-digit number a. Form the number b, such that: the number of hundreds in it would be equal to the hundreds digit of the number a, increased by the units digit of the number a, set the number of tens in b to zero, and instead of units put the number of tens of the number a.

Sample input and output

test number Input Output
1 473 707

ID 3954. New number - 3
Темы: Whole numbers   

Given a three digit number. The last figure was crossed out in it and attributed to it at the beginning. Write a program that finds the resulting number.

Sample input and output

test number Input Output
1 456 645

ID 3953. New number - 4
Темы: Whole numbers   

Given a four-digit number. Write a program that finds a number obtained by reading its digits from right to left.

Sample input and output

test number Input Output
1 4561 1654

ID 3952. New number - 5
Темы: Whole numbers   

Given a three digit number. The first digit was crossed out in it and attributed to it at the end. Write a program that finds the original number before the conversion.

Sample input and output

test number Input Output
1 456 645

ID 3950. New number - 6
Темы: Whole numbers   

Given a four-digit number. Write a program that displays the number formed by interchanging the first and fourth, third and second digits of a given number

Sample input and output

test number Input Output
1 4561 1654

ID 3949. New number - 7
Темы: Whole numbers   

Given a four-digit number. Write a program that displays the number formed by interchanging the first and third, second and fourth digits of a given number

Sample input and output

test number Input Output
1 1456 5614

ID 3948. New number - 8
Темы: Whole numbers   

Given a three digit number. Write a program that gets a new number formed by interchanging the second and third digits of a given number.

Sample input and output

test number Input Output
1 456 465

ID 33595. Apples 1
Темы: Whole numbers   

N schoolchildren divide k apples equally, the non-divisible remainder remains in the basket. How many apples will each student get?
 

Input 
The program receives as input the numbers n and k - integer, positive, not exceeding 10000.

Imprint
Output the answer to the problem.

 

Example
# Input Output
1 3
14
4

ID 33592. Apples 2
Темы: Whole numbers   

N schoolchildren share k apples equally, the non-dividing balance remains in the basket. How many apples will be left in the basket?

Input 
The program receives as input the numbers n and k - integer, positive, not exceeding 10000.

Imprint
Output the answer to the problem.

 

Example
# Input Output
1 3
14
2

ID 32964. Days and weeks
Темы: Whole numbers   

N days have passed since a certain moment. How many full weeks and days have passed during this period?

Input
The input is a natural number n (n < 1000).

Imprint
Print the answer to the problem in the format specified in the example.
 

Examples
# Input Output
1 305 43w 4d

ID 32963. Tons and kilograms
Темы: Whole numbers   

Mass is given in kilograms. Find the number of full tons in it and the remaining kilograms.


Input
The input is a positive number not exceeding 106.

Imprint
Print the answer to the problem.

 

Examples
# Input Output
1 25610 25t 610kg

ID 32962. centners and kilograms
Темы: Whole numbers   

Mass is given in kilograms. Find the number of full centners in it and the remaining kilograms

Example:
Input
25610 
Imprint
256c 10kg

ID 32961. Meters and centimeters
Темы: Whole numbers   

The distance is given in centimeters. Find the number of full meters in it and the remaining centimeters

Example:
Input
25610 
Imprint
256m 10cm

ID 32935. Lessons at school - 1
Темы: Whole numbers   

School starts at 8:30. The lesson lasts 45 minutes, breaks between lessons – 10 minutes. Enter the number of the lesson and display the end time.

Input
The input is an integer - the number of the lesson (an integer, not more than 10).

Imprint
Output the answer to the problem in the format hours-minutes.

 

Examples
# Input Output
1 6 13-50

 

ID 32933. Minutes and seconds
Темы: Whole numbers   

Enter a number representing the number of seconds. Output the same time in minutes and seconds.

Example:
Input
175

Imprint
2m 55s
 

ID 33602. Calendar
Темы: Whole numbers   

Let's designate the days of the week as numbers from 1 (Monday) to 7 (Sunday), respectively. According to the well-known m — the day of the week on the first day of the current month — determine the day of the week of n. 
 

It is forbidden to use any algorithmic constructs (if, while, for, etc.) except for arithmetic operations 

Input 
The program receives 2 integers 1 ≤ n≤ 31.1≤ m ≤ 7, each on a separate line.

Imprint 
Output the day of the week of the number n.
 
Examples
# Input Output
1 8
1
1
2 7
7
6

ID 33596. next even
Темы: Whole numbers   

An integer n is given. Print the next even number.

The problem must be solved by integer operations without using conditional operators (including without the ternary operator ?: in C++) and/or loops.

Input
Enter a positive integer not exceeding 1000.

Imprint
Print the answer to the problem.

 
Examples
# Input Output
1 7 8
2 8 10

ID 33593. Laces
Темы: Whole numbers    Formula derivation   

A shoe factory is about to start producing an elite model of boots. The holes for lacing will be arranged in two rows, the distance between the rows is  a, and the distance between the holes in the row b. The number of holes in each row is N. Lacing should take place in an elite way “up, horizontally to another row, up, horizontally, etc.” (see picture). In addition, in order for the laces to be tied with an elite bow, the length of the free end of the lace must be l. What is the lace length for these boots?
Forbidden to use if, while, for, repeat-until statements (Pascal)

Input: The program takes as input four natural numbers a, b, l and N.

Output: The program should output a single number – desired lace length.

Examples
input
2
1
3
4
output
26

ID 33525. Street
Темы: Formula derivation    Whole numbers   

On one side of the street there are houses with odd numbers (1, 3, 5, …), on the other side – with even (2, 4, 6, …). House number 1 is located opposite house number 2, & nbsp; house number 3 – opposite house number 4, etc. You need to walk one minute along the street to the neighboring house, no matter which side of the street it is on (that is, from house number 1 you need to walk one minute both to house number 3 and to house number 4). There is no need to go to the house opposite.



Gromozeka went outside from house number A and must reach house number B. Determine how many minutes he needs to walk along the street.

It is forbidden to use any algorithmic constructs to solve this problem. You can only use arithmetic operations (without using built-in functions).

Input data

The program receives as input two distinct positive integers A and B not exceeding 2×109, – house numbers.

Imprint
The program should output a single number – desired number of minutes.

 

Examples
# Input Output
1 1
8
3

 

ID 32988. sum or product
Темы: Conditional operator    Whole numbers   

An integer X (\(100<=X<=9999\)) is entered from the keyboard. If the number is four-digit, then find the sum its digits, and if three-digit, then the product of the digits of the given number.

Input
The input is an integer X (\(100<=X<=9999\))..

Imprint
Display the answer to the problem.
 

 

Examples
# Input Output
1 125 10
2 1253 11

ID 21960. Comparing the digits of a number
Темы: Whole numbers    Conditional operator   

Given a two-digit number. Display the word YES if the digits of this number are the same and the word NO if the digits are different.

Input 
One number is entered from the keyboard.

Imprint 
Display the word YES if the digits of the given number are the same, or the word NO if the digits are different.
 

 

Examples
# Input Output
1 65 NO
2 55 YES

ID 21959. First or second
Темы: Whole numbers    Conditional operator   

You are given a two-digit number whose digits are different.  Print the word first if the first digit is greater than the second, and the word second if the second digit is greater than the first.

Input 
A positive two-digit number is entered from the keyboard.

Imprint 
Print the word first if the first digit is greater than the second, and the word second if the second digit is greater than the first.
 

 

Examples
# Input Output
1 65 first
2 56 second

ID 3992. The amount is a multiple of 5
Темы: Whole numbers    Conditional operator   

Given a three digit number. Determine if the sum of its digits is a multiple of 5. Display the word YES or NO.

Input
The input is a positive three-digit number.

Imprint
Print the answer word YES if the sum of the digits of the original number is a multiple of 5, otherwise print the word NO.
 

 

Examples
# Input Output
1 473 NO
2 451 YES

ID 3991. Lucky number
Темы: Whole numbers    Conditional operator   

Given a six digit number. Determine whether it is lucky (the sum of the first three digits is equal to the sum of the last three). If the number is happy, display the word HAPPY, otherwise, display the word NO.

Input
The input is a positive six-digit number.

Imprint
Display the answer to the problem.
 

 

Examples
# Input Output
1 111111 HAPPY
2 134211 NO

ID 3990. Maximum digit of a number
Темы: Whole numbers    Conditional operator   

Given a four-digit number. Determine the maximum digit of the number.

Input
The input is a positive four-digit number.

Imprint
Display the answer to the problem.
 

 

Example
# Input Output
1 4731 7

ID 3989. How many fours are there
Темы: Conditional operator    Whole numbers   

Given a three digit number. Determine how many times the number 4 appears in it.

Input
The input is a positive three-digit number.

Imprint
Display the answer to the problem.
 

 

Example
# Input Output
1 473 1

ID 3986. Various digits of a number
Темы: Conditional operator    Whole numbers   

Given a three digit number. Print the word YES if all digits of the number are different and the word NO otherwise.


Input
The input is a positive three-digit number.

Imprint
Display the answer to the problem.
 

 

Examples
# Input Output
1 123 YES
2 112 NO

ID 32989. The sum of the digits of a number
Темы: Whole numbers    Conditional operator   

Given a two-digit number. Determine if the sum of its digits is a two-digit number. If not, then after how many numbers to meet the first two-digit number that satisfies this condition.

Input 
A single number is entered from the keyboard N (\(10 <= N <= 99\)).

Imprint 
Display the word YES if the sum of the digits of the number N is a two-digit number, otherwise display a number that shows how many numbers from the original N > meet the first number whose sum of digits will be a two-digit number.
 

 

Examples
# Input Output
1 65 YES
2 25 3

ID 32934. Hours, minutes and seconds
Темы: Whole numbers   

Enter a number representing the number of seconds. Output the same time in hours, minutes and seconds.

Example:
Input:
8325

Output:

2h 18m 45s
 

ID 33577. Maximum number
Темы: Whole numbers   

Write a program that reads two integers a and b and outputs the largest of them. Numbers — integers from 1 to 1000.

It is forbidden to use any algorithmic constructs to solve this problem. 
Only arithmetic operations can be used (no built-in functions).


Input
Two natural numbers not exceeding 1000 are entered.

Imprint
Print the answer to the problem.


Examples
# Input Output
1 5
6
6

ID 33041. Number of even digits
Темы: Whole numbers    Conditional operator   

Given a four-digit number. Determine how many even digits are in it.

Input
The input is a four-digit positive number.

Imprint
Display the answer to the problem.
 

 

Example
# Input Output
1 4732 2

ID 33042. Number of odd digits
Темы: Conditional operator    Whole numbers   

Given a four-digit number. Determine how many odd digits are in it.

Input
The input is a four-digit positive number.

Imprint
Display the answer to the problem.
 

 

Example
# Input Output
1 4732 2

ID 33580. *Baker king
Темы: Formula derivation    Whole numbers   

King wants to become a baker and lead a simple lifestyle.
The royal kitchen is covered with a kitchen apron, which is divided into squares with side A see. King wants to hang a picture of his family on the apron. He knows the point at which the lower left corner of the painting is in contact, as well as the width and height of the painting itself. And then he wanted to know the number of squares that would be partially or completely covered by the picture.

Input format
The first line contains the number A - the side of one square of the kitchen apron.
The second and third lines - the numbers X and Y - are the coordinates of the lower left corner of the picture.
The fourth and fifth lines - the numbers W and H - the width and height of the picture.
The axis OX is directed to the right, the axis OY is directed up.
The lower left corner of one of the squares of the kitchen apron is at the origin. All numbers are integers not exceeding 2 × 109, numbers A, W, H are positive, numbers X and Y are positive or equal to 0.

Output format 
Output one number - the number of tiles completely or partially covered by the picture.
A square is considered a closed picture if the intersection of the picture and the square has a non-zero area, that is, touching the picture and the square is not considered overlapping.
 

Example

Input Output

1

10 
15 

35 
20

12

Description

Side of the square (side of the cell in the figure) A = 10.
The lower left corner of the picture has coordinates (15, 5), the picture has a width of 35 cm and a height of 20 cm.
The painting completely or partially covers 12 squares

ID 37589. Integer division and remainder
Темы: Whole numbers   

Write a program that, given two numbers a and b, displays the result of integer division and the remainder, in the given format (see examples)

The input of the program is two numbers: a and b
You need to output two lines:
in the first line - the result of integer division of a by b
in the second line - the remainder of dividing a by b
See the output form in the example of input and output values

Example of input and output data
Input
15 6
Imprint
15 div 6 = 2
15 mod 6 = 3

ID 37592. The most difficult question for beginners, or the digits of a number
Темы: Whole numbers   

A three-digit number is entered from the keyboard. 
Write a program that prints space separated on one line:
the sum of the digits of the number and the new number formed by permuting ones and tens

ID 33589. The end of the lessons
Темы: Whole numbers   

At some schools, classes begin at 9:00. Lesson duration - 45 minutes, after the 1st, 3rd, 5th, etc. lessons change 5 minutes, and after the 2nd, 4th, 6th, etc. - 15 minutes. Determine when the specified lesson ends.

Input format
Given a lesson number (number from 1 to 10).

Output format 
Output two integers: the end time of the lesson in hours and minutes. 
 

It is forbidden to use any algorithmic constructions except arithmetic operations. See the list of forbidden operations in the line forbidden operators.
 
Example
N Input Output
1 3 11 35
2 2 10 35

ID 33594. Electronic watch - 2
Темы: Whole numbers   

The electronic watch shows the time in the format h:mm:ss, that is, first the number of hours is recorded in the range from 0 to 23, then a two-digit number of minutes is required, then a two-digit number of seconds is required. The number of minutes and seconds, if necessary, are padded to a two-digit number with zeros.
Since the beginning of the day n seconds have passed. Output what the clock will show.
It is forbidden to use any algorithmic constructs (if, while, for, etc.), except for arithmetic operations

Input: Enter the number n - integer, positive, does not exceed 107.
Output: Output the watch, observing the format.
 

Examples
N Input Output
1 3602 1:00:02
2 129700 12:01:40

ID 31890. Number units
Темы: Whole numbers   

Clever Rabbit and his friends began to study math. The first thing they learned is that all numbers are made up of digits. Write a program to help Clever Rabbit determine the digit that represent the ones in a number. 
Recall that ones is the last digit of a number.

Input format
The natural number is inputed.

Output format
Outpur the answer to the problem.
 

Examples
N Input Output
1 2007 7
2 40 0
 

ID 21875. Digits of the number
Темы: Whole numbers   

A three-digit number is entered from the keyboard.
Write a program that outputs the sum of the digits of a number and a new number formed by the interchanging the digits of tens and ones.

Input format
Given an integer N > 0.

Output format
Output two numbers separated by a space: first, the sum of the digits of the original number, then the new number formed by the interchanging the digits of tens and ones.
 

Example
Входные данные Выходные данные
1 105 6 150

ID 21876. Sum of squares of digits
Темы: Whole numbers   

Given a five-digit positive number. Write a program that finds the sum of the squares of the digits of a given number.

Input format
Given a five-digit positive numbe

Output format
Output the answer to the problem.
 

Example
N Input Output
1 12345 55
Explanation
1*1 + 2*2 + 3*3 + 4*4 + 5*5 = 55

ID 37590. Integer division and remainder
Темы: Whole numbers   

Write a program that given two numbers a and b, displays the result of an integer division and the remainder, in the given format.

The program receives two numbers as input: a and b.
You need to output two lines:
in the first line - the result of integer division a by b.
in the second line - the remainder of dividing a by b.

Example.

Input Output
15
6
15/6=2
15%6=3

 

ID 37591. The most difficult question for beginners, or the digits of a number
Темы: Whole numbers   

Enter a three-digit number from the keyboard. 
Write a program that prints space separated on one line:
the sum of the digits of the number and the new number formed by permuting ones and tens.

An example of input and output data.

Input Output
365 14 356

ID 33692. Полоски радуги
Темы: Formula derivation    Whole numbers   

В школе  № 2007 на уроке информатики в системе SilverTests Васе попалась следующая задача: «В  младшей группе одного объединённого детского сада воспитательница  изучала с детишками  порядок цветов радуги. Она отыскала семь соответствующих цветных мелков и начала рисовать полоски, не нарушая последовательности цветов.  Начала она с красной полоски. Когда доходила до фиолетовой полоски, опять рисовала  красную. Воспитательница  успела нарисовать N полосок, когда у неё закончились  мелки. Напишите программу, которая вычисляет количество полосок каждого цвета».  Вася взялся писать программу, но тут обнаружилось, что на клавиатуре отсутствует клавиша с буквой  «i». Помогите Васе написать программу с учётом этого обстоятельства.

Входные данные: Вводится одно целое положительное число N > 0.
Выходные данные: Выведите ответ на задачу.

Если в коде программы встречается буква «i» система выдаст сообщение:  Использование запрещенных операторов
 
Примеры

Входные данные Выходные данные
1 3 'red - 1'
'orange - 1'
'yellow - 1'
'green - 0'
'blue - 0'
'sky - 0'
'purple - 0'

ID 37541. Perpendicular arrows
Темы: Whole numbers   

The input to the program is two integers  n, m, (\(0<n<=12, 0<=m<60\)) indicating the moment in time " ;n hours m minutes". Determine the smallest number of full minutes after which the hour and minute hands are perpendicular to each other on the dial. Do not use real arithmetic.

Input data: two numbers separated by a space.
Output: Display one number, the answer to the problem.
 

Examples
# Input Output
1 2 50 10
2 12 0  16

ID 31885. Integer Devision and Remainer
Темы: Whole numbers   

Write a program that, given the two numbers a and b, outputs the result of integer division and the remainder in the given format (see examples).

Input format
a and b are inputs in the line.

Output format
In the first line, output the result of integer division a and b.
in the second line, outputs remainder of the division a on b.
Format of output is given in example.
 

Example
N Input Output
1 15 6 15/6=2
15%6=3

ID 33505. The hardest question for beginners, or number digits
Темы: Whole numbers   

A three-digit number is entered from the keyboard.
Write a program that displays space-separated in one line:
the sum of the digits of a number and a new number formed by a permutation of units and tens
 
 

ID 33501. Integer division and remainder
Темы: Whole numbers   

Write a program that, given the two numbers a and b, displays the result of integer division and the remainder in the given format (see examples)
Two numbers are input to the program: a and b
Two lines must be printed:
the first line is the result of integer division of a by b
in the second line - the remainder of dividing a by b
See the output form in the example of input and output values.

Example 
Input
15 6
Output
15//6=2
15%6=3
 
 

ID 38187. Lines in a book
Темы: Whole numbers   

A book has K lines on one page. Thus, on the 1st page the lines from 1th to Kth are printed, on the second — from (K+1)th to (2*K)th, etc. Write a program that, by the number of the line in the text, determines the number of the page on which this line will be printed, and the ordinal number of this line on the page.

Input
Two numbers are entered: K - the number of lines printed on the page, and N - the line number (1<=K<=200 , 1<=N<=20000).

Imprint
Print two numbers - the number of the page on which this line will be printed, and the number of the line on the page.
 
Examples

# Input Output
1 50 1 1 1
2 20 25 2 5
3 15 43 3 13

ID 38198. The equation
Темы: Whole numbers    Conditional operator   

Solve the equation in integers:

\( { \sqrt{ax +b}} = c\)

a, b, c – given integers: find all solutions or report that there are no solutions in integers.

Input
Enter three numbers a, b and c separated by spaces.

Imprint
The program should display all solutions of the equation in ascending order, or NO SOLUTION (in capital letters) if there are no solutions. If there are infinitely many solutions, output MANY SOLUTIONS. 

Examples
# Input Output
1 1 0 0 0
2 1 2 -3 NO SOLUTION

ID 38199. Endless table
Темы: Whole numbers    Conditional operator   

The natural numbers are written in an (infinite) table, as shown.


It is required to display all its neighbors for a given number (the numbers written in the cells above, on the right, on the left and below, if any)

Input
One natural number not exceeding 109.

Imprint
The program should display all the numbers written in adjacent cells with the data, in ascending order. Numbers must be separated by a space.

Examples
# Input Output
1 1 3
2 7 3 6 8 13

ID 38201. Runners
Темы: Whole numbers   

Two runners train on the 400-meter athletics track. They start running from one point and run according to the instructions of the coach for the specified number of minutes at the specified speed (speed is the number of meters that the athlete runs along the track in a minute). It is required to determine the distance at which the runners will be from each other at the end of the workout (the distance is the length of the shorter part of the arc of the track between the athletes).

Input
The first line contains a single number – the number of tasks that each athlete received from the coach (both athletes receive the same number of tasks). Each of the following lines contains tasks for athletes in the following format:

v1 t1 v2 t2

where v1 – speed  of the first player (in m/min), t1 – the time during which the athlete must run at a speed v1; v2 and t2 – corresponding values ​​for the second player. Speeds – positive numbers if you want to run in a clockwise direction, and negative if you want to run counterclockwise.

Imprint
Print one number – distance between runners at the end of the workout.

Examples
# Input Output
1 2
8000 1 8000 1 
8000 10 8001 10 
10
2 1
50 4 -100 1
100

ID 38219. Ring
Темы: Whole numbers   

Two cars are moving along a ring road of length L in opposite directions. They start from one point and travel with constant speeds v1 and v2, respectively. It is required to determine how far apart they will be at time T.

Input
The input is 4 natural numbers L, v1, v2, T, separated by a space. All numbers do not exceed 100.

Imprint
Print the distance between cars at time T – the length of the shortest of the two arcs of the road between cars.
 

# Input Output
1 10 1 2 1 3
2 10 2 3 2 0

ID 38223. gold bars
Темы: Whole numbers    One-Dimensional Arrays   

Given N gold bars. It is required to cut no more than one of them into two parts (not necessarily equal, but with a whole mass), and then divide the ingots into two heaps of equal mass.

Input
The first line contains one natural number N, not exceeding 100.

The second line contains N natural numbers, separated by a space, not exceeding 100 - the mass of the available ingots.

Imprint
Print the masses of the ingots that were included in the first pile (including the mass of the part of the sawn ingot).

If there are several solutions, print any of them.

If there are no solutions, print the phrase NO SOLUTION (in capital letters).

You can display the masses in any order, but the mass of the part of the sawn ingot (if any) should be the last one.

Examples
# Input Output
1 3
5 5 5
NO SOLUTION
2 4
1 2 3 8
1 2 3 1

ID 38236. Amount of numbers
Темы: Whole numbers   

How many natural numbers consist of at least a digits and at most b digits?

Input
Two arbitrary natural numbers a and b are entered, separated by a space. Each does not exceed 10000.

Imprint
Print one number: the number of numbers that have the specified property.

Examples
# Input Output
1 1 2 99
2 1 1 9

ID 38238. Error
Темы: Whole numbers    Prime numbers and factorization   

Think of 2011 as the sum of K consecutive primes (i.e., primes with no other primes between them). For example, the number 31 can be represented as the sum of three successive prime numbers as follows: 7 + 11 + 13 = 31.

Input
One natural number K is entered (from 1 to 2011).

Imprint
Print the terms in ascending order, separating them with a space.

If it is impossible to expand into a sum of K terms, print NO SOLUTION (in capital letters).

Examples
# Input Output
1 3 661 673 677
2 2 NO SOLUTION

ID 38274. Mom, I'm a mathematician!
Темы: Whole numbers   

And we, meanwhile, are returning to the Moscow-Adler train, where Maxim was nevertheless caught by dad, and three rolls of toilet paper were not released from the window of the first car (“Well, paaaap, well, I was wondering what is longer & mdash; train or paper, don't put it behind your ear.

Now Maxim is sitting in a compartment with his mother. To distract him from thinking through the details of new experiments, his mother — good mathematician — she told Maxim one curious problem ("My students on Wednesday could not solve it, they completely forgot how to count").

Given a number x. Each of its digits must be multiplied by 19, added to the result 40, the resulting number is again multiplied by 19, take the last digit of this product and put it in place of the original digit in the number x. Question: what is the final number?

Maxim, however, solved the problem much faster than his mother expected, and, unfortunately, he was again ready for experiments. Can you?

Input
Given an integer x (0≤x≤10000).

Imprint
Print one number: the answer to the problem that mom told Maxim.

Examples
# Input Output
1 27 27

ID 38278. Alyona, remember Viti's age!
Темы: Whole numbers    Conditional operator   

Victor is madly in love with statistics. Still — their birthdays fall on the same day of the year with their older brother! Now every year on his birthday, he writes down how old he and his brother are, and tries to find something interesting in these records.

Today is Viti's birthday, and he showed his notes to Alena. Vitya knows that she also likes to explore all sorts of sets of numbers and find patterns in them. Alena immediately noticed an interesting moment: when Vitya was n years old on one of his previous birthdays, his brother was m years old, and today Vitya is exactly k times younger than his brother!

Returning home in the evening, Alena became interested in the question: is this data enough to calculate how old Vitya turned today? Alena quickly coped, but can you solve this difficult task and find out by the numbers n, m and k, how old is Vita?

Input
The input consists of three lines, each containing one natural number: n , m and k — the age of Vitya and his brother in the old days, as well as how many times Vitya is younger than his brother today ( 1 ≤ n < m ≤ 10 000 , 2 ≤ k ≤ 10 000 ).

Imprint
If the situation described in the condition could happen, print a single number t — how old is Vita today.

If Vitya and Alena made a mistake and the described situation could not have happened, print the number - 1 .
 

# Input Output
1 4
15
2
11
2 4
15
3
-1
3 4
8
2
-1

ID 38305. Buses
Темы: Whole numbers    Conditional operator   

The organizers decided to order buses to visit the health camp. It is known that N children and M adults are going to the camp. Each bus can carry K people. There must be at least two adults on each bus that children travel on.

Determine whether it will be possible to send all children and adults to the camp, and if so, what is the minimum number of buses required to order.

Input
The input of the program is 3 natural numbers written with a space - N, M and K, each of them does not exceed 10 000.

Imprint
Print the number of buses to order. If it's impossible to send everyone to the camp, print 0 (zero).
 

Examples
# Input Output
1 10 4 7 2
2 10 4 5 0

ID 38307. Elections
Темы: Symbols    Conditional operator    Whole numbers   

In the elections to the State Duma, N parties were included in the ballots. An electronic scanner for reading information from ballots transmits information about each ballot in the following format: if there is a mark in the corresponding box of the ballot, then the scanner transmits + (plus), otherwise it transmits - (minus). Thus, it sends a sequence of N characters - pluses and minuses.

The ballot is considered valid if the mark is in exactly one cell. Invalid ballots are not included in the calculation of election results.

A party enters the State Duma only if it receives at least 7% of the total number of valid ballots.

It is required to display the numbers (in the order they are listed in the ballot) of all parties that are going to the State Duma.

Input
The first line of the input contains two numbers separated by a space: N - the number of parties and M - the number of ballots. Both numbers are natural, N ≤ 200, M≤ 100 000.

The next M lines contain the information obtained from the ballots. Each line is a sequence of N characters + or - (no spaces).

It is guaranteed that there is at least one valid ballot.

Imprint
Output the numbers of the parties that entered the Duma, separated by a space, in ascending order. If none of the parties makes it to the Duma,  nothing needs to be displayed.
 

Examples
# Input Output
1 3 4
+--
+--
-+-
+-+
1 2
2 1 5
+
-
-
-
-
1

ID 38314. Internet payment
Темы: Whole numbers    Conditional operator   

Vitya is connected to the Internet according to the following tariff plan. The monthly subscription fee is A rubles, and this subscription fee includes B megabytes of traffic. Unused megabytes "burn out" at the end of the month. If the traffic exceeds B megabytes, then each megabyte of traffic in excess of prepaid costs C rubles.

It is known that last month Vitya spent D megabytes of traffic. How much did Internet access cost him last month (including the monthly fee)?

Input
Four natural numbers A, B, C, D are entered. All numbers do not exceed 100.

Imprint
Print one number — the amount (in rubles) that Vitya has to pay for the Internet.

Examples
# Input Output
1 100 10 12 15 160
2 100 10 12 1 100

ID 38320. End of K-th lesson
Темы: Whole numbers    Simulation tasks   

At school, the duration of each lesson is 45 minutes, and the breaks between lessons – just 5 minutes. The first lesson starts at 8 am sharp. Write a program that answers the question "What time does the Kth lesson end at this school?"

Input
One natural number K is entered, not exceeding 15.

Imprint
Print the end time of the Kth lesson: first hours, then minutes, separating them with a space.

Examples
# Input Output
1 1 8 45
2 6 12 55

ID 38325. Wallpapering
Темы: Whole numbers   

Petya needs to wallpaper a wall measuring N meters high and M meters wide. For gluing, wallpaper is used, which is sold in rolls. Each roll is 1 meter wide and K meters long. Wallpaper is glued to the wall in vertical stripes (from top to bottom). At the same time, Petya wants to glue the wallpaper in such a way that there are no horizontal joints of different pieces (that is, one whole piece is glued from ceiling to floor). Pieces of the desired size can be cut from the roll (sometimes a piece of a smaller size may remain, which therefore cannot be glued, this piece goes to waste).

Given the numbers N, M and K, determine the smallest number of rolls Petya needs to buy to cover the entire wall.

Input
Natural numbers N, M and K are introduced (1 ≤ N ≤ 100, 1 ≤ M ≤ 100, N ≤K ≤100).

Imprint
Print one number - the number of rolls Petya should buy.

Examples
# Input Output
1 10
5
25
3
2 3
6
9
2

ID 38378. Chunga-Changa
Темы: Conditional operator    Whole numbers   

Our happiness is constant — Chew coconuts, eat bananas, Chew coconuts, eat bananas, Chunga-changa!
m/f «Katerok»
After the discovery of the island "Chunga-Changa" civilization gradually began to make its way there and even a market economy began to develop. There is also a new currency — chizhik. Now, in order to happily chew coconuts, you must first buy them under a palm tree.

Sasha and Masha passed by a palm tree, under which coconuts are sold at the price of z chizhiks apiece. Sasha has x siskins, and Masha has y. Each of the girls is going to buy the maximum number of coconuts she has enough money to buy. While discussing their plans to buy coconuts, the girls noticed that if one of them gave a certain number of siskins to another, then the total number of coconuts they would buy could increase (or decrease) because of this. Coconuts are not sold in parts, that is, each of the girls can only buy a non-negative integer number of coconuts. Chizhiks also cannot be divided into parts, that is, one of the girls can only send a non-negative integer number of chizhiks to the other.

For example, suppose that Sasha had 5 chizhiks, Masha 4, and one coconut costs 3 siskins. Then, if the girls do not exchange siskins, they will buy 1+1=2 coconuts. If Masha gives Sasha one chizhik, then Sasha will have 6 of them, and Masha will have 3, and the girls will buy 2+1=3 coconuts.

Life on the island is no longer so easy and simple, so Sasha and Masha want to distribute the money so that in total they can buy as many coconuts as possible. At the same time, no one likes to lend chizhiks, so among all the ways that lead to the maximum number of purchased coconuts, find the one that minimizes the number of chizhiks transferred between Sasha and Masha (no matter in which direction).

Input
The first line contains three integers x, y and z (0 ≤ x, y ≤ 1018 , 1 ≤ z ≤ 1018) — the number of chizhiks Sasha has, the number of chizhiks Masha has and the price of one coconut.

Imprint
Print two integers — the maximum total number of coconuts that can be bought, and the minimum number of siskins that one of the girls will have to share for this.
Note
The first example is analyzed in the problem statement. In the second example, it is optimal not to exchange siskins, in this case 3+4=7 coconuts will be bought.

Examples
# Input Output
1 5 4 3 3 1
2 6 8 2 7 0

ID 38461. bus stops
Темы: Whole numbers   

Bus stops are located every K meters from the beginning of the street, that is, at a distance of 0, K, 2K, 3K, etc. meters from the start. Light passed from the beginning of the street N meters, after which
tired and wanted to take the bus. Determine how many meters Sveta needs to walk to reach the nearest
stops.

Input
The program receives as input two integers K and N, written on separate lines.
1≤ K≤ 2 x 109, 1 ≤ N≤ 2 x 109

Imprint
The program should output a single integer — distance to the nearest stop.
 

Examples
# Input Output
1 600
2000
200

ID 38469. ducks
Темы: Whole numbers   

As you know, when developing and debugging programs, toy yellow ducks can be of great help (see the article "The Duck Method" on Wikipedia), so Denis has collected a large collection of yellow ducks. The collection is already so big that Denis decided to place the ducks on the cabinet shelves. At first he began to put A ducks on each shelf, but one duck turned out to be superfluous. Then he began to put the ducks on the shelves again, placing B ducks on each shelf, but in this case, one duck was not enough for him to have exactly B ducks on each shelf. Determine the minimum number of ducks that could be in Denis's collection.
The program receives as input two positive integers A and B, 2 ≤ A≤ 2×109, 2≤ B≤ 2×109 – the number of ducks when placed on the shelf in the first and second cases.
The program should output a single number – the minimum possible number of ducks in Denis's collection. It is guaranteed that the answer exists and does not exceed 2×109.

Examples
# Input Output Explanation
1 5
3
11 11 = 5 x times; 2+1
11=3.times. 4 ? 1

ID 38523. Factorial factors
Темы: Whole numbers   

An integer N is given. Find the number of positive divisors of N!, modulo \(10 ^ 9 + 7\).

Input
The input is an integer N (\(1<=N<=10^3\)).

Imprint
Print the number of positive divisors of N!, modulo \(10 ^ 9 + 7\).
 

 

Examples
# Input Output
1 3 4
2 6 30
3 1000 972926972

 

ID 38555. Turtle
Темы: Formula derivation    Whole numbers   

The turtle crawls on the floor, which is laid with square tiles with side A see. The start of the Turtle's path is at  X. The turtle managed to crawl a distance of D cm before the owner picked it up. Determine how many cells (partially or whole) the Turtle managed to crawl through.

Input
The first line contains the number A – side length of one tile. The second line contains the number X - the coordinate of the point from which the Turtle started its journey. The third line - the number D - the distance that the Turtle crawled. The OX axis is directed to the right. The last tile in the row on which the Turtle is crawling is at the origin. All numbers are integers not exceeding \(2\cdot10^9 \), numbers A, D – positive, number X – positive or equal to 0.

Imprint
Output one number – the number of tiles that the Turtle has fully or partially crawled through.
It is considered that the Turtle has crawled through the tile if the conditionally drawn line of the Turtle's path has a non-zero length, that is, the touch of the path line and the edge of the tile is not considered.

 

Examples
# Input Output Explanation
1 10
15
35
4 Tile side (cell side in the picture) A = 10.
The turtle started at X = 15 and passed 35.
The turtle has completely or partially passed 4 tiles.

 

ID 38578. Time left
Темы: Whole numbers    Formula derivation   

Gromozeka loves programming competitions. Today he will take part in the competition in STCoder. This site uses a 24-hour clock. For example, 21:00. referred to as «21 o'clock».
The current time is A hours and the competition will start exactly in B hours. Determine the start time of the competition? Give your answer in 24-hour format.

Input
The input string contains two integers A and B (\(0<=A,B<=23\)) separated by one space.

Imprint
Print the contest start hour in 24-hour format.
 

 

Examples
# Input Output
1 9 12 21
2 19 0 19
3 23 2 1

 

ID 38621. Gromozeka's favorite number
Темы: Whole numbers   

Today is the commemorative STCoder Contest 100. In this case, Alice would like to give Gromozeka an integer. Since the name of the contest is STCoder Contest 100, Gromozeka would be happy if he was given a positive integer that can be divided by 100 exactly D times. Find the Nth smallest integer that will make Gromozeka happy.

Input
The input string contains two integers: D (equal to 0, 1, or 2) and N (1<=N<=100).

Imprint
Print the N-th smallest integer that can be divided by 100 exactly D times.
 

 

Examples
# Input Output
1 0 5 5
2 1 11 1100
3 2 85 850000

 

ID 38622. Programmer's Day
Темы: Whole numbers    Cycles    Nested Loops   

Before the celebration of the Day of the programmer, the office of the IT company was decorated with a sequence of numbers of length N, a = {a1, a2, a3, ..., aN}. Bugs Hunter, a member of the testing department, would like to play around with this sequence. In particular, he would like to repeat the following operation as many times as possible.
For every i that satisfies 1<=i<=N, do one of the following: "divide ai by 2" and "multiply ai by 3". You can't do "multiply ai by 3" immediately for each i during one operation, the value of ai after any action must be an integer. 
Bugs Hunter does one operation in 1 second, regardless of the number of numbers in the sequence. Determine the maximum time after which Bugs Hunter will return to his work?

Input
The first line contains an integer N (1<=N<=10000). The second line contains N integers ai (1<=ai<=109).

Imprint
Print one number -  the maximum number of seconds after which Bugs Hunter will return to his job.
 

 

Examples
# Input Output Explanation
1 3
5 2 4
3 The sequence is originally 5,2,4.
Three operations can be performed as follows:
- first multiply a1 by 3, multiply a2 by 3 and divide a3 by 2. Now the sequence is 15,6,2;
- then multiply a1 by 3, divide a2 by 2 and multiply a3 by 3. Now the sequence is 45,3,6;
- finally multiply a1 by 3, multiply a2 by 3 and divide a3 by 2. Now the sequence is 135,9,3.
Further, with each number, you can only perform multiplication by 3, but this action is not allowed for all numbers ai at once.
So the answer is 3.
2 4
631 577 243 199
0  
3 10
2184 2126 1721 1800 1024 2528 3360 1945 1280 1776
39  

 

ID 38627. Number Cookies
Темы: Whole numbers    while loop    Conditional operator   

Gromozeka loves number cookies. Among all the numerical cookies, Gromozek eats only those on which the sum of the digits of the written number in the decimal number system is a divisor of the number itself. You are given a number written on a cookie. Determine whether Gromozeka will eat it or not.

Input
The input is an integer N (1<=N<=109).

Imprint
Print Yes if Gromozeka will eat such a cookie, No  if not.
 

 

Examples
# Input Output
1 12 Yes
2 101 No

 

ID 38630. Gromozeka number
Темы: Whole numbers    Nested Loops   

Let S(n) denote the sum of the digits of in decimal notation. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a Gromozeki number if for all positive integers m such that m > ; n, the condition \(\frac {S(n)}n <= \frac {S(m)}m\) is satisfied. Given an integer K, list the K of the smallest Gromozeka numbers.

Input
The input is an integer K (K>=1, the K-th smallest Gromozeka number is not greater than 1015).

Imprint
Output K lines. The i-th line should contain the i-th lowest Gromozeka number.
 

 

Examples
# Input Output
1 10 1
2
3
4
5
6
7
8
9
19

 

ID 38646. The sum of the digits of a number
Темы: Whole numbers    Cycles   

For integers b ( b >= 2 ) and n ( n >= 1 ) let the function f(b, n) be defined as follows:
\(f (b, n) = n when\ n < b \\ f (b, n) = f (b, floor (n / b)) + (n \ mod \ b) when \ n >= b\)

Here
floor(n / b) denotes the largest integer not greater than n / b;
n mod b denotes the remainder of n divided by b.

Less formally, f(b, n) is equal to the sum of the n digits in base b. For example, the following is true:
\(f (10.87654) = 8 + 7 + 6 + 5 + 4 = 30\\ f (100.87654) = 8 + 76 + 54 = 138\)

You are given the integers n and s. Determine if there is an integer b (b >= 2) such that f(b, n) = s. If the answer is yes, find the smallest of these b.


Input
The first line contains an integer n (1 <= n <= 1011). The second line contains an integer (1 <= s <= 1011).

Imprint
Output the answer to the problem. If there is no answer, then print -1.
 

 

Examples
# Input Output
1 87654
30
10
2 87654
138
100
3 87654
45678
-1
4 31415926535
1
31415926535
5 1
31415926535
-1

 

ID 38648. Chips
Темы: Whole numbers    Conditional operator   

A chip was placed in each extreme cell of the square board. Could it turn out that exactly k chips are placed? (For example, if the board is 22, then 4 chips are exposed, and if 66, then 20).

Input
One natural number k is entered, not exceeding 30000

Imprint
The program should print the word YES if there is such a size of the board that exactly (no more and no less) k chips will be put on, otherwise it should print the word NO.

Examples
# Input Output
1 20 YES
2 13 NO

ID 38649. cutlets
Темы: Conditional operator    Whole numbers   

You can put k cutlets in the pan at the same time. Each cutlet needs to be fried on each side for m minutes continuously. What is the shortest time it takes to fry n cutlets on both sides?

Input
3 numbers are entered: k, m and n. All numbers do not exceed 32000.

Imprint
Print the time it takes for all cutlets to be fried.


Examples
# Input Output
1 1
5
1
10

ID 38710. Minimum discount
Темы: Whole numbers    Conditional operator   

Mr. Duncan, the manager of Duncan's Toy Chest, donates a certain amount of money to children's funds each year around Christmas.  The amount that goes to charity is always equal to the minimum number, which is divided by 2 and the number of toys sold in a year. Given the number of toys sold per year (N), determine the amount that Mr. Duncan will donate. 

Input
The input is a positive integer N (1<=N<=109).

Imprint
Print a single number - the amount that Mr. Duncan will donate.
 

Examples
# Input Output
1 3 6
2 10 10
3 999999999 1999999998

ID 38800. Five digit number - 1
Темы: Whole numbers   

The program receives a five-digit number as input. Output  display two numbers separated by a space: the sum of digits divisible by 4 and the number of digits divisible by 3.
 

Examples
# Input Output
1 12345 4 1

ID 38801. Five digit number - 2
Темы: Whole numbers   

The program receives a five-digit number as input (the 3rd digit of the number is not equal to zero). Output  on the screen two numbers separated by a space: the largest sum of digits among  the sum of digits 1 and 2 and the sum of digits 4 and 5, and print the number of digits that are multiples of the 3rd digit (excluding the 3rd digit).
 

Examples
# Input Output
1 13245 9 1

ID 38802. Six digit number - 1
Темы: Whole numbers   

The program receives a six-digit number as input. Output  print two space-separated numbers: the smallest sum among the first three and last three digits, and print the number of 7 digits that have at least one even digit in their neighbors.
 

Examples
# Input Output
1 127357 10 1

ID 38803. Six digit number - 2
Темы: Whole numbers   

The program receives a six-digit number as input. Output  display two numbers separated by a space: the largest sum among the sums of even and odd digits, and print the number of even digits with odd neighbors.
 

Examples
# Input Output
1 127357 23 1

ID 38804. Five digit number - 3
Темы: Whole numbers   

The program receives a five-digit number as input. Output  two numbers on the screen separated by a space: the number of digits that are greater than all their neighbors, and the sum of digits whose product with the left neighbor is greater than with the right one (the extreme digits are not considered, since they do not have a second neighbor). If there are no such digits, then print 0.
 

Examples
# Input Output
1 33251 18

ID 41230. Laboratory tables
Темы: Whole numbers    Formula derivation   

At the Department of "Applied Informatics" University N in the new academic year recruited three groups of first-year students. For practical exercises, it is necessary to equip a new audience with laboratory tables. No more than four students can sit at each such table, and all students must be from the same group. The audience has the opportunity to simultaneously accommodate students from three groups at once.
Determine the minimum number of tables to be purchased.

Input
The program receives as input three natural numbers (one number per line): the number of students in each of the three groups.

Imprint
Print the answer to the problem.
 

Examples
# Input Output
1 15
20
24
15

ID 41231. Time difference
Темы: Whole numbers    Formula derivation   

The values ​​of two points of time belonging to the same day are given: hours, minutes and seconds for each of the points of time. It is known that the second moment of time came not earlier than the first. Determine how many seconds have elapsed between two points in time.

Input
The program receives three integers as input — hours, minutes, seconds representing the first point in time and three integers representing the second point in time.

Imprint
Print the number of seconds between these times.
 
 

Examples
# Input Output
1
1
1
1
2
2
2
3661
2
1
2
thirty
1
3
20
50

ID 42262. midpoint
Темы: Cycles    Whole numbers   

Gromozeka and Alice are playing the following game. Initially, they put three points on the number line in integer coordinates. Then, one of them erases any extreme point and puts it in the middle between the two remaining ones in a coordinate with an integer. If there is an even number of integers between the remaining points, then you can put a point in any of them.

For example, if initially there were points at coordinates 3, 6, 8, then the first move can be to erase the point with coordinate 3 and put it in coordinate 7. Or erase the point with coordinate 8 and put it in coordinate 4 or 5.

In order not to think for a long time, Gromozeka and Alice decided that they would spend no more than two seconds on each move.

You will be asked to calculate the maximum number of seconds the game will last if the starting positions of the three dots are known.

Input
The program takes as input three integers A, B and C (1<=A < B < C <= 1000). Each number is written on a new line.

Imprint
Print the answer to the problem.
 
 

Examples
# Input Output
1 3
6
8
4

ID 33519. *Jam-jar
Темы: Whole numbers   

Princess and the rabbit Clever are very fond of jam. The princess eats a can of jam in n minutes, and the rabbit in m minutes. Determine how many minutes they will eat a jar of jam together.

Input format
Two integers are supplied to the input through a space: n and m (n, m <= 1000)

Output format
You need to output one number - the time in minutes that friends will need to eat one jar of jam together (an incomplete minute is considered 1 minute).
 

Example
Входные данные Выходные данные
1 9 6 4

ID 42696. Define the age
Темы: Whole numbers   

What is a century?
A century is a period of 100 years (a century). For example, the 1st century consists of years 1 to 100, the 2nd century consists of years 101 to 200, and so on.

Write a program that determines what century the year is in N?

Input
The input is a natural number N (1 <= N <= 3000).

Imprint
Display the answer to the problem as an integer.
 

Examples
# Input Output
1 2021 21
2 200 2

ID 33521. Princess learns to count
Темы: Whole numbers   

Princess learn mathematics. Recently, a math teacher told about a tricky way of squaring natural numbers ending in the number 5. Now, Princess can easily square double-digit (and even some three-digit) numbers ending in 5. The method is as follows: to square the numbers , ending in 5, it is enough to multiply the number obtained from the original by deleting the last five by the next number in order, then it remains only to assign “25” to the resulting result on the right.
For example, in order to square 125, it’s enough to multiply 12 by 13 and ascribe 25, i.e. attributing to the number 12 * 13 = 156 the number 25, we get the result 15625, i.e. 1252 = 15625.

Princess decided to train in a new skill, and wants someone to check it. But since she is too proud to ask anyone for help in the Kingdom, she asks you to write a program for her that she could test herself with.


Input format
Given an integer A ending in 5 (A <= 400005). 

Output format
Output one number - A2.
 

Example
N Input Output
1 125 15625

ID 33522. Divisibility of numbers
Темы: Computer science    Whole numbers   

Prince is very fond of math. For his research, he needs to learn to quickly find out if one of the two numbers is divisible by the other. Help Prince write a program so he can get an answer instantly.

Input format
Given two natural numbers, each not more than 100.

Output format
The program should output the number 1 if one of the numbers is divisible by another. Otherwise, you must output any other number not equal to 1, and not exceeding 109.
 

Examples
N Input Output
1 2 4 1
2 4 2 1
3 2 5 500