ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Неотсортированные > задача:


Herons

Задачи раздела

• SAME OR DIFFERENT
• GCF
• REVERSE ORDER OF WORDS
• Factorial
• Maximum
• Name-Surname
• Decimal to binary
• Heap
• Herons
• Leap Year
• Perfect numbers
• Rectangle
• Bfs
• Chess
• Big Dance
• Binary to decimal
• Circle

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 1000/1000/1000/1000 мс. Лимит памяти 65000/65000/65000/65000 Кб.

Problem description

Peter and Mary came to the zoo. Peter liked the most herons. He was impressed by their ability to sleep on one leg.

All herons are enclosed in one area. Some of them sleep on one leg and the other one is invisible, some on both. Peter counted number of legs he could see and got a legs. After a while Mary did the same thing and she got b legs. Some of herons could change their position by that time.

When they came home they decided to calculate number of herons in zoo. Soon they realised that not always it could be determined uniquely. So now they want to know minimum and maximum number of herons they've seen.

Input

The first line contains two integers a and b (1≤ a, b ≤ 109).

Output

Print minimum and maximum number of herons if there is always a solution.

Example

stdin stdout

3 4

2 3

Для отправки решений необходимо выполнить вход.

www.contester.ru