October come back. Together training
A. Ornament
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

The ornament has a square shape and consists of equal square pixels. Each pixel can be either red or white. An ornament is considered to be balanced if any square 2 $$$\times$$$ 2 contains both white and red pixels, but their amounts are not equal to each other. Give an example of any balanced ornament.

Input

The input contains a single integer $$$n, (2 \leq n \leq 5000)$$$ - the width and height of the ornament in pixels.

Output

Output $$$n$$$ lines of $$$n$$$ characters $$$R$$$ or $$$W$$$ that show the color of the pixels in the ornament (red and white respectively). From the entire set of possible answers, you can print any.

Example
Input
3
Output
RRR
WRW
WWW

B. Streamer night
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

The well-known JoyTube video site is hosting an event called Streamer Night. On this night, which lasts $$$n$$$ seconds, every self-respecting channel organizes a stream. You are subscribed to $$$k$$$ channels, each of which will start its stream at $$$a_i$$$-th second and end it at $$$b_i$$$-th second $$$(i\in[1;k])$$$. What is the maximum number of streams you can watch that night from start to the end? If any stream ends, then you can switch to another starting stream at the same second.

Input

The first line contains two integers $$$n$$$ and $$$k$$$ $$$(2 \leq n \leq 200 000, 1 \leq k \leq 200 000)$$$. The next $$$k$$$ lines contain pairs of numbers $$$a_i, b_i (1 \leq a_i \lt b_i \leq n)$$$.

Output

Print one number - the answer to the problem.

Examples
Input
5 3
1 3
2 5
3 4
Output
2
Input
6 4
2 3
2 3
2 3
2 3
Output
1

C. Storybooks
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

You work for a publishing house. Recently you have received $$$n$$$ stories from different authors. The $$$i$$$th story has a length of $$$a_i$$$ pages. In the near future you have planned to publish $$$k$$$ books, $$$i$$$-th book contains $$$b_i$$$ pages. Each book can contain any number of different available stories. Each story can be published in any number of books, just like in none of them. For each book, determine the maximum number of stories that it can contain.

Input

The first line contains two space-separated numbers $$$n$$$ and $$$k$$$ ($$$1 \leq n,k \leq 200000$$$). The second line contains $$$n$$$ space-separated numbers $$$a_i$$$ $$$(1 \leq a_i \leq 10^9)$$$. The third line contains $$$k$$$ space-separated numbers $$$b_i$$$ $$$(1 \leq b_i \leq 10^{18})$$$.

Output

Print $$$k$$$ space-separated numbers - the maximum number of stories for each book.

Example
Input
4 3
8 2 3 30
5 29 1
Output
2 3 0 

D. Basic examination
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given a string of characters '(' and ')'. Check if a given sequence of brackets can be obtained from some mathematical expression by removing all numbers and operation symbols.

Input

The first input line contains one natural number $$$n$$$, $$$1 \leq n \leq 200000$$$. The second line contains a sequence of $$$n$$$ characters '(' and ')'.

Output

Print $$$YES$$$ or $$$NO$$$ - the answer to the problem question.

Examples
Input
6
(())()
Output
YES
Input
3
())
Output
NO
Input
4
)(()
Output
NO

E. Football tournament
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

$$$n$$$ teams train at the sports school. The $$$i$$$th team has the strength $$$a_i$$$. A month later, a tournament will take place, during which each team will play a match with every other team. The match ends with the victory of one of the teams if it is stronger than the other, or a draw if the strengths of the teams are equal. At the end of the tournament, each team will receive a certain number of points for the matches played: 3 points for each win and 1 point for each draw.

Mr. Yaruta can train with any team, and then its strength will increase by 1. He is interested in the maximum total amount of points of all teams together. What is the minimum number of training session he need to provide to do this?

Input

The first line contains the number of teams $$$n$$$, $$$(2 \leq n \leq 200000)$$$. The second line contains $$$n$$$ space-separated integers $$$a_i$$$, $$$(1 \leq a_i \leq 10^9)$$$.

Output

Output one integer - the answer to the problem.

Example
Input
3
6 5 6
Output
1

F. Astronomy
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

It is known that any star cannot be simultaneously visible both from the south pole and from the north pole. Using this, the Penguin and the Bear decided to count all the stars in space. They stood at the poles at the same time, and each counted the stars that are visible to him. You know these two numbers. Using these data, answer the question: how many stars are there in space?

Input

The two input lines contain the numbers $$$A$$$ and $$$B$$$ $$$(1 \leq A,B \lt 10^{10^5})$$$ - the number of stars counted by the Penguin and the Bear. These integers don't contain leading zeros.

Output

Output one number - the answer to the problem. This number must not contain leading zeros.

Example
Input
705
33
Output
738

G. Two ants
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Two ants live at points $$$a_1$$$ and $$$a_2$$$ of the coordinate axis. At the same time and at a constant speed, they begin to run in a certain direction. The first ant knows that after $$$t_1$$$ seconds he will be at the point $$$p_1$$$. The second one knows that in $$$t_2$$$ seconds he will be at the point $$$p_2$$$. Determine if the ants will ever meet at the same point. If so, how soon will they meet?

Input

The first line contains 3 integers $$$a_1$$$, $$$t_1$$$, $$$p_1$$$, $$$(-10^4 \leq a_1 \leq 10^4,$$$ $$$1 \leq t_1 \leq 10^4,$$$ $$$-10^4 \leq p_1 \leq 10^4,$$$ $$$a_1 \neq p_1)$$$. The second line contains 3 integers $$$a_2$$$, $$$t_2$$$, $$$p_2$$$, $$$(-10^4 \leq a_2 \leq 10^4,$$$ $$$1 \leq t_2 \leq 10^4,$$$ $$$-10^4 \leq p_2 \leq 10^4,$$$ $$$a_2 \neq p_2)$$$. Also $$$a_1 \neq a_2$$$.

Output

Print -1 if the ants never meet. Otherwise, print a single number - the time until the meeting. It must differ from the correct answer by no more than $$$10^{-6}$$$.

Example
Input
-3 2 5
12 1 10
Output
2.50000000

H. Make a wish!
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

If the person to your right and the person to your left have the same name, then you can make a wish. Your task is to arrange $$$n$$$ Andrews, $$$n$$$ Bens and $$$n$$$ Charlies in a row so that there are exactly $$$k$$$ people among them who can make a wish.

Input

The input contains two numbers $$$n$$$ and $$$k$$$, $$$(1 \leq n \leq 20000$$$, $$$0 \leq k \leq 3*n)$$$.

Output

If the necessary arrangement is impossible, print -1. Otherwise, output a string of $$$3*n$$$ characters. It must contain exactly $$$n$$$ characters $$$A$$$, $$$B$$$, $$$C$$$, each of which represents a person with the corresponding name. If there are more than one correct answers, print any of them.

Examples
Input
2 1
Output
CAABCB
Input
6 17
Output
-1

I. Robin Hood
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Robbers led by Robin Hood live in Sherwood Forest. They are extremely resentful that other people's incomes are distributed unevenly. Therefore, any of the robbers can approach two people and do the following actions:

1) Calculate how much money they have. Let these quantities be equal to $$$a_1$$$ and $$$a_2$$$.

2) Choose $$$i, j \in \{1;2\}$$$ $$$(i \neq j)$$$, also choose a prime number $$$p$$$ such that $$$a_i$$$ is divisible by $$$p$$$.

3) Redistribute the money so that one person has $$$\frac{a_i}{p}$$$ of money, and the other has $$$a_j*p$$$. If extra money remains from such a redistribution, then the robber will take it for himself. If, on the contrary, there is not enough money for such amounts, then the robber will pay them out of his own pocket.

Today two people will walk through Sherwood Forest with amounts of money equal to 1 and $$$n$$$. They can meet any non-negative number of robbers. The robbers, of course, plan to act together in order to take as much money as possible in total. How much richer can the robbers get?

Input

The input contains one number $$$n$$$, $$$(1 \leq n \leq 10^9)$$$.

Output

Print a single number - the amount of money the robbers can get if they act optimally.

Examples
Input
8
Output
3
Input
29
Output
0

J. Find the cat
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Cats are predators, so they know how to camouflage well and disperse throughout the area. Everything you see can be represented as a string $$$s$$$ of lowercase latin letters. There's a cat hiding there if you can choose three indices $$$i \lt j \lt k$$$ such that the string $$$\overline{s_i s_j s_k}$$$ differs from the string $$$'cat'$$$ by no more than a character in one position.

For example, in the string $$$'cpython'$$$ there is a cat hidden, because you can select indices 1, 2, 4, and then the resulting string $$$'cpt'$$$ differs from the string $$$'cat'$$$ only in the second character.

Your task is to determine whether the cat is hiding in a given line, and if so, find it.

Input

The input is a string $$$s$$$ of lowercase latin letters. The length of the string $$$|s|$$$ is such that $$$3 \leq |s| \leq 2*10^5$$$.

Output

If the cat is hiding in this string, then print any of the possible places where it could hide. Namely, print three space-separated indices $$$i, j, k$$$ such that $$$1 \leq i \lt j \lt k \leq |s|$$$.

If the cat could not hide in this string, then print -1.

Examples
Input
cpython
Output
1 3 4
Input
codeforces
Output
-1
Input
thecatishere
Output
4 5 6