Score : <var>200</var> points

Problem Statement

Snuke loves working out. He is now exercising <var>N</var> times.

Before he starts exercising, his power is <var>1</var>. After he exercises for the <var>i</var>-th time, his power gets multiplied by <var>i</var>.

Find Snuke's power after he exercises <var>N</var> times. Since the answer can be extremely large, print the answer modulo <var>10^{9}+7</var>.

Constraints

<var>1 ≤ N ≤ 10^{5}</var>

Input

The input is given from Standard Input in the following format:

<var>N</var>

Output

Print the answer modulo <var>10^{9}+7</var>.

Sample Input 1

3

Sample Output 1

6

After Snuke exercises for the first time, his power gets multiplied by <var>1</var> and becomes <var>1</var>.

After Snuke exercises for the second time, his power gets multiplied by <var>2</var> and becomes <var>2</var>.

After Snuke exercises for the third time, his power gets multiplied by <var>3</var> and becomes <var>6</var>.

Sample Input 2

10

Sample Output 2

3628800

Sample Input 3

100000

Sample Output 3

457992974

Print the answer modulo <var>10^{9}+7</var>.


Score : <var>300</var> points

Problem Statement

There is a rectangle in a coordinate plane. The coordinates of the four vertices are <var>(0,0)</var>, <var>(W,0)</var>, <var>(W,H)</var>, and <var>(0,H)</var>.
You are given a point <var>(x,y)</var> which is within the rectangle or on its border. We will draw a straight line passing through <var>(x,y)</var> to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.

Constraints

<var>1 \leq W,H \leq 10^9</var>

<var>0\leq x\leq W</var>

<var>0\leq y\leq H</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>W</var> <var>H</var> <var>x</var> <var>y</var>

Output

Print the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.

The area printed will be judged correct when its absolute or relative error is at most <var>10^{-9}</var>.

Sample Input 1

2 3 1 2

Sample Output 1

3.000000 0

The line <var>x=1</var> gives the optimal cut, and no other line does.

Sample Input 2

2 2 1 1

Sample Output 2

2.000000 1


Score : <var>300</var> points

Problem Statement

You are given three integers <var>A</var>, <var>B</var> and <var>C</var>. Find the minimum number of operations required to make <var>A</var>, <var>B</var> and <var>C</var> all equal by repeatedly performing the following two kinds of operations in any order:

Choose two among <var>A</var>, <var>B</var> and <var>C</var>, then increase both by <var>1</var>.

Choose one among <var>A</var>, <var>B</var> and <var>C</var>, then increase it by <var>2</var>.

It can be proved that we can always make <var>A</var>, <var>B</var> and <var>C</var> all equal by repeatedly performing these operations.

Constraints

<var>0 \leq A,B,C \leq 50</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>A</var> <var>B</var> <var>C</var>

Output

Print the minimum number of operations required to make <var>A</var>, <var>B</var> and <var>C</var> all equal.

Sample Input 1

2 5 4

Sample Output 1

2

We can make <var>A</var>, <var>B</var> and <var>C</var> all equal by the following operations:

Increase <var>A</var> and <var>C</var> by <var>1</var>. Now, <var>A</var>, <var>B</var>, <var>C</var> are <var>3</var>, <var>5</var>, <var>5</var>, respectively.

Increase <var>A</var> by <var>2</var>. Now, <var>A</var>, <var>B</var>, <var>C</var> are <var>5</var>, <var>5</var>, <var>5</var>, respectively.

Sample Input 2

2 6 3

Sample Output 2

5

Sample Input 3

31 41 5

Sample Output 3

23


Score : <var>100</var> points

Problem Statement

Given is an integer <var>x</var> that is greater than or equal to <var>0</var>, and less than or equal to <var>1</var>.
Output <var>1</var> if <var>x</var> is equal to <var>0</var>, or <var>0</var> if <var>x</var> is equal to <var>1</var>.

Constraints

<var>0 \leq x \leq 1</var>

<var>x</var> is an integer

Input

Input is given from Standard Input in the following format:

<var>x</var>

Output

Print <var>1</var> if <var>x</var> is equal to <var>0</var>, or <var>0</var> if <var>x</var> is equal to <var>1</var>.

Sample Input 1

1

Sample Output 1

0

Sample Input 2

0

Sample Output 2

1


Score : <var>200</var> points

Problem Statement

We have a permutation <var>p</var> = {<var>p_1,\ p_2,\ ...,\ p_n</var>} of {<var>1,\ 2,\ ...,\ n</var>}.

Print the number of elements <var>p_i</var> (<var>1 < i < n</var>) that satisfy the following condition:

<var>p_i</var> is the second smallest number among the three numbers <var>p_{i - 1}</var>, <var>p_i</var>, and <var>p_{i + 1}</var>.

Constraints

All values in input are integers.

<var>3 \leq n \leq 20</var>

<var>p</var> is a permutation of {<var>1,\ 2,\ ...,\ n</var>}.

Input

Input is given from Standard Input in the following format:

<var>n</var>
<var>p_1</var> <var>p_2</var> <var>...</var> <var>p_n</var>

Output

Print the number of elements <var>p_i</var> (<var>1 < i < n</var>) that satisfy the condition.

Sample Input 1

5
1 3 5 4 2

Sample Output 1

2

<var>p_2 = 3</var> is the second smallest number among <var>p_1 = 1</var>, <var>p_2 = 3</var>, and <var>p_3 = 5</var>. Also, <var>p_4 = 4</var> is the second smallest number among <var>p_3 = 5</var>, <var>p_4 = 4</var>, and <var>p_5 = 2</var>. These two elements satisfy the condition.

Sample Input 2

9
9 6 3 2 5 8 7 4 1

Sample Output 2

5


Score : <var>200</var> points

Problem Statement

There are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.

Takahashi says: "there are <var>X</var> animals in total in the garden, and they have <var>Y</var> legs in total." Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.

Constraints

<var>1 \leq X \leq 100</var>

<var>1 \leq Y \leq 100</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>X</var> <var>Y</var>

Output

If there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.

Sample Input 1

3 8

Sample Output 1

Yes

The statement "there are <var>3</var> animals in total in the garden, and they have <var>8</var> legs in total" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.

Sample Input 2

2 100

Sample Output 2

No

There is no combination of numbers of cranes and turtles in which this statement is correct.

Sample Input 3

1 2

Sample Output 3

Yes

We also consider the case in which there are only cranes or only turtles.


Score : <var>400</var> points

Problem Statement

We have a grid with <var>H</var> rows and <var>W</var> columns of squares.
Snuke is painting these squares in colors <var>1</var>, <var>2</var>, <var>...</var>, <var>N</var>.
Here, the following conditions should be satisfied:

For each <var>i</var> (<var>1 ≤ i ≤ N</var>), there are exactly <var>a_i</var> squares painted in Color <var>i</var>. Here, <var>a_1 + a_2 + ... + a_N = H W</var>.

For each <var>i</var> (<var>1 ≤ i ≤ N</var>), the squares painted in Color <var>i</var> are 4-connected. That is, every square painted in Color <var>i</var> can be reached from every square painted in Color <var>i</var> by repeatedly traveling to a horizontally or vertically adjacent square painted in Color <var>i</var>.

Find a way to paint the squares so that the conditions are satisfied.
It can be shown that a solution always exists.

Constraints

<var>1 ≤ H, W ≤ 100</var>

<var>1 ≤ N ≤ H W</var>

<var>a_i ≥ 1</var>

<var>a_1 + a_2 + ... + a_N = H W</var>

Input

Input is given from Standard Input in the following format:

<var>H</var> <var>W</var>
<var>N</var>
<var>a_1</var> <var>a_2</var> <var>...</var> <var>a_N</var>

Output

Print one way to paint the squares that satisfies the conditions.
Output in the following format:

<var>c_{1 1}</var> <var>...</var> <var>c_{1 W}</var>
<var>:</var>
<var>c_{H 1}</var> <var>...</var> <var>c_{H W}</var>

Here, <var>c_{i j}</var> is the color of the square at the <var>i</var>-th row from the top and <var>j</var>-th column from the left.

Sample Input 1

2 2
3
2 1 1

Sample Output 1

1 1
2 3

Below is an example of an invalid solution:

1 2
3 1

This is because the squares painted in Color <var>1</var> are not 4-connected.

Sample Input 2

3 5
5
1 2 3 4 5

Sample Output 2

1 4 4 4 3
2 5 4 5 3
2 5 5 5 3

Sample Input 3

1 1
1
1

Sample Output 3

1


Score : <var>200</var> points

Problem Statement

Given is a string <var>S</var>. Replace every character in <var>S</var> with x and print the result.

Constraints

<var>S</var> is a string consisting of lowercase English letters.

The length of <var>S</var> is between <var>1</var> and <var>100</var> (inclusive).

Input

Input is given from Standard Input in the following format:

<var>S</var>

Output

Replace every character in <var>S</var> with x and print the result.

Sample Input 1

sardine

Sample Output 1

xxxxxxx

Replacing every character in <var>S</var> with x results in xxxxxxx.

Sample Input 2

xxxx

Sample Output 2

xxxx

Sample Input 3

gone

Sample Output 3

xxxx


Score : <var>300</var> points

Problem Statement

How many integer sequences <var>A_1,A_2,\ldots,A_N</var> of length <var>N</var> satisfy all of the following conditions?

<var>0 \leq A_i \leq 9</var>

There exists some <var>i</var> such that <var>A_i=0</var> holds.

There exists some <var>i</var> such that <var>A_i=9</var> holds.

The answer can be very large, so output it modulo <var>10^9 + 7</var>.

Constraints

<var>1 \leq N \leq 10^6</var>

<var>N</var> is an integer.

Input

Input is given from Standard Input in the following format:

<var>N</var>

Output

Print the answer modulo <var>10^9 + 7</var>.

Sample Input 1

2

Sample Output 1

2

Two sequences <var>\{0,9\}</var> and <var>\{9,0\}</var> satisfy all conditions.

Sample Input 2

1

Sample Output 2

0

Sample Input 3

869121

Sample Output 3

2511445


Score : <var>100</var> points

Problem Statement

You are given integers <var>A</var> and <var>B</var>, each between <var>1</var> and <var>3</var> (inclusive).

Determine if there is an integer <var>C</var> between <var>1</var> and <var>3</var> (inclusive) such that <var>A \times B \times C</var> is an odd number.

Constraints

All values in input are integers.

<var>1 \leq A, B \leq 3</var>

Input

Input is given from Standard Input in the following format:

<var>A</var> <var>B</var>

Output

If there is an integer <var>C</var> between <var>1</var> and <var>3</var> that satisfies the condition, print Yes; otherwise, print No.

Sample Input 1

3 1

Sample Output 1

Yes

Let <var>C = 3</var>. Then, <var>A \times B \times C = 3 \times 1 \times 3 = 9</var>, which is an odd number.

Sample Input 2

1 2

Sample Output 2

No

Sample Input 3

2 2

Sample Output 3

No


Score : <var>100</var> points

Problem Statement

There are a total of <var>A + B</var> cats and dogs.
Among them, <var>A</var> are known to be cats, but the remaining <var>B</var> are not known to be either cats or dogs.

Determine if it is possible that there are exactly <var>X</var> cats among these <var>A + B</var> animals.

Constraints

<var>1 \leq A \leq 100</var>

<var>1 \leq B \leq 100</var>

<var>1 \leq X \leq 200</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>A</var> <var>B</var> <var>X</var>

Output

If it is possible that there are exactly <var>X</var> cats, print YES; if it is impossible, print NO.

Sample Input 1

3 5 4

Sample Output 1

YES

If there are one cat and four dogs among the <var>B = 5</var> animals, there are <var>X = 4</var> cats in total.

Sample Input 2

2 2 6

Sample Output 2

NO

Even if all of the <var>B = 2</var> animals are cats, there are less than <var>X = 6</var> cats in total.

Sample Input 3

5 3 2

Sample Output 3

NO

Even if all of the <var>B = 3</var> animals are dogs, there are more than <var>X = 2</var> cats in total.


Score: <var>500</var> points

Problem Statement

You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.

There are <var>N</var> attendees in the party, and they are given attendee numbers from <var>1</var> through <var>N</var>. The height of Attendee <var>i</var> is <var>A_i</var>.

According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.

The absolute difference of their attendee numbers is equal to the sum of their heights.

There are <var>\frac{N(N-1)}{2}</var> ways to choose two from the <var>N</var> attendees and make a pair. Among them, how many satisfy the condition above?

P.S.: We cannot let you know the secret.

Constraints

All values in input are integers.

<var>2 \leq N \leq 2 \times 10^5</var>

<var>1 \leq A_i \leq 10^9\ (1 \leq i \leq N)</var>

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>A_1</var> <var>A_2</var> <var>\dots</var> <var>A_N</var>

Output

Print the number of pairs satisfying the condition.

Sample Input 1

6
2 3 3 1 3 1

Sample Output 1

3

<var>A_1 + A_4 = 3</var>, so the pair of Attendee <var>1</var> and <var>4</var> satisfy the condition.

<var>A_2 + A_6 = 4</var>, so the pair of Attendee <var>2</var> and <var>6</var> satisfy the condition.

<var>A_4 + A_6 = 2</var>, so the pair of Attendee <var>4</var> and <var>6</var> satisfy the condition.

No other pair satisfies the condition, so you should print <var>3</var>.

Sample Input 2

6
5 2 4 2 8 8

Sample Output 2

0

No pair satisfies the condition, so you should print <var>0</var>.

Sample Input 3

32
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5

Sample Output 3

22


Score : <var>300</var> points

Problem Statement

We have two permutations <var>P</var> and <var>Q</var> of size <var>N</var> (that is, <var>P</var> and <var>Q</var> are both rearrangements of <var>(1,~2,~...,~N)</var>).

There are <var>N!</var> possible permutations of size <var>N</var>. Among them, let <var>P</var> and <var>Q</var> be the <var>a</var>-th and <var>b</var>-th lexicographically smallest permutations, respectively. Find <var>|a - b|</var>.

Notes

For two sequences <var>X</var> and <var>Y</var>, <var>X</var> is said to be lexicographically smaller than <var>Y</var> if and only if there exists an integer <var>k</var> such that <var>X_i = Y_i~(1 \leq i < k)</var> and <var>X_k < Y_k</var>.

Constraints

<var>2 \leq N \leq 8</var>

<var>P</var> and <var>Q</var> are permutations of size <var>N</var>.

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>P_1</var> <var>P_2</var> <var>...</var> <var>P_N</var>
<var>Q_1</var> <var>Q_2</var> <var>...</var> <var>Q_N</var>

Output

Print <var>|a - b|</var>.

Sample Input 1

3
1 3 2
3 1 2

Sample Output 1

3

There are <var>6</var> permutations of size <var>3</var>: <var>(1,~2,~3)</var>, <var>(1,~3,~2)</var>, <var>(2,~1,~3)</var>, <var>(2,~3,~1)</var>, <var>(3,~1,~2)</var>, and <var>(3,~2,~1)</var>. Among them, <var>(1,~3,~2)</var> and <var>(3,~1,~2)</var> come <var>2</var>-nd and <var>5</var>-th in lexicographical order, so the answer is <var>|2 - 5| = 3</var>.

Sample Input 2

8
7 3 5 4 2 1 6 8
3 8 2 5 4 6 7 1

Sample Output 2

17517

Sample Input 3

3
1 2 3
1 2 3

Sample Output 3

0


Score : <var>300</var> points

Problem Statement

Snuke loves "paper cutting": he cuts out characters from a newspaper headline and rearranges them to form another string.

He will receive a headline which contains one of the strings <var>S_1,...,S_n</var> tomorrow.
He is excited and already thinking of what string he will create.
Since he does not know the string on the headline yet, he is interested in strings that can be created regardless of which string the headline contains.

Find the longest string that can be created regardless of which string among <var>S_1,...,S_n</var> the headline contains.
If there are multiple such strings, find the lexicographically smallest one among them.

Constraints

<var>1 \leq n \leq 50</var>

<var>1 \leq |S_i| \leq 50</var> for every <var>i = 1, ..., n</var>.

<var>S_i</var> consists of lowercase English letters (a - z) for every <var>i = 1, ..., n</var>.

Input

Input is given from Standard Input in the following format:

<var>n</var>
<var>S_1</var>
<var>...</var>
<var>S_n</var>

Output

Print the lexicographically smallest string among the longest strings that satisfy the condition.
If the answer is an empty string, print an empty line.

Sample Input 1

3
cbaa
daacc
acacac

Sample Output 1

aac

The strings that can be created from each of cbaa, daacc and acacac, are aa, aac, aca, caa and so forth.
Among them, aac, aca and caa are the longest, and the lexicographically smallest of these three is aac.

Sample Input 2

3
a
aa
b

Sample Output 2

The answer is an empty string.


Score: <var>100</var> points

Problem Statement

E869120's and square1001's <var>16</var>-th birthday is coming soon.

Takahashi from AtCoder Kingdom gave them a round cake cut into <var>16</var> equal fan-shaped pieces.

E869120 and square1001 were just about to eat <var>A</var> and <var>B</var> of those pieces, respectively,

when they found a note attached to the cake saying that "the same person should not take two adjacent pieces of cake".

Can both of them obey the instruction in the note and take desired numbers of pieces of cake?

Constraints

<var>A</var> and <var>B</var> are integers between <var>1</var> and <var>16</var> (inclusive).

<var>A+B</var> is at most <var>16</var>.

Input

Input is given from Standard Input in the following format:

<var>A</var> <var>B</var>

Output

If both E869120 and square1001 can obey the instruction in the note and take desired numbers of pieces of cake, print Yay!; otherwise, print :(.

Sample Input 1

5 4

Sample Output 1

Yay!

Both of them can take desired number of pieces as follows:

Sample Input 2

8 8

Sample Output 2

Yay!

Both of them can take desired number of pieces as follows:

Sample Input 3

11 4

Sample Output 3

:(

In this case, there is no way for them to take desired number of pieces, unfortunately.


Score : <var>200</var> points

Problem Statement

You have <var>A</var> <var>500</var>-yen coins, <var>B</var> <var>100</var>-yen coins and <var>C</var> <var>50</var>-yen coins (yen is the currency of Japan).
In how many ways can we select some of these coins so that they are <var>X</var> yen in total?

Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.

Constraints

<var>0 \leq A, B, C \leq 50</var>

<var>A + B + C \geq 1</var>

<var>50 \leq X \leq 20</var> <var>000</var>

<var>A</var>, <var>B</var> and <var>C</var> are integers.

<var>X</var> is a multiple of <var>50</var>.

Input

Input is given from Standard Input in the following format:

<var>A</var>
<var>B</var>
<var>C</var>
<var>X</var>

Output

Print the number of ways to select coins.

Sample Input 1

2
2
2
100

Sample Output 1

2

There are two ways to satisfy the condition:

Select zero <var>500</var>-yen coins, one <var>100</var>-yen coin and zero <var>50</var>-yen coins.

Select zero <var>500</var>-yen coins, zero <var>100</var>-yen coins and two <var>50</var>-yen coins.

Sample Input 2

5
1
0
150

Sample Output 2

0

Note that the total must be exactly <var>X</var> yen.

Sample Input 3

30
40
50
6000

Sample Output 3

213


Score : <var>100</var> points

Problem Statement

Given is an integer <var>N</var>.

Takahashi chooses an integer <var>a</var> from the positive integers not greater than <var>N</var> with equal probability.

Find the probability that <var>a</var> is odd.

Constraints

<var>1 \leq N \leq 100</var>

Input

Input is given from Standard Input in the following format:

<var>N</var>

Output

Print the probability that <var>a</var> is odd.
Your output will be considered correct when its absolute or relative error from the judge's output is at most <var>10^{-6}</var>.

Sample Input 1

4

Sample Output 1

0.5000000000

There are four positive integers not greater than <var>4</var>: <var>1</var>, <var>2</var>, <var>3</var>, and <var>4</var>. Among them, we have two odd numbers: <var>1</var> and <var>3</var>. Thus, the answer is <var>\frac{2}{4} = 0.5</var>.

Sample Input 2

5

Sample Output 2

0.6000000000

Sample Input 3

1

Sample Output 3

1.0000000000


Score : <var>200</var> points

Problem Statement

You are given a image with a height of <var>H</var> pixels and a width of <var>W</var> pixels.
Each pixel is represented by a lowercase English letter.
The pixel at the <var>i</var>-th row from the top and <var>j</var>-th column from the left is <var>a_{ij}</var>.

Put a box around this image and output the result. The box should consist of # and have a thickness of <var>1</var>.

Constraints

<var>1 ≤ H, W ≤ 100</var>

<var>a_{ij}</var> is a lowercase English letter.

Input

Input is given from Standard Input in the following format:

<var>H</var> <var>W</var>
<var>a_{11}</var> <var>...</var> <var>a_{1W}</var>
<var>:</var>
<var>a_{H1}</var> <var>...</var> <var>a_{HW}</var>

Output

Print the image surrounded by a box that consists of # and has a thickness of <var>1</var>.

Sample Input 1

2 3
abc
arc

Sample Output 1

#####
#abc#
#arc#
#####

Sample Input 2

1 1
z

Sample Output 2

###
#z#
###


Score : <var>100</var> points

Problem Statement

In the Kingdom of AtCoder, people use a language called Taknese, which uses lowercase English letters.

In Taknese, the plural form of a noun is spelled based on the following rules:

If a noun's singular form does not end with s, append s to the end of the singular form.

If a noun's singular form ends with s, append es to the end of the singular form.

You are given the singular form <var>S</var> of a Taknese noun. Output its plural form.

Constraints

<var>S</var> is a string of length <var>1</var> between <var>1000</var>, inclusive.

<var>S</var> contains only lowercase English letters.

Input

Input is given from Standard Input in the following format:

<var>S</var>

Output

Print the plural form of the given Taknese word.

Sample Input 1

apple

Sample Output 1

apples

apple ends with e, so its plural form is apples.

Sample Input 2

bus

Sample Output 2

buses

bus ends with s, so its plural form is buses.

Sample Input 3

box

Sample Output 3

boxs


Score : <var>400</var> points

Problem Statement

Takahashi is going to buy <var>N</var> items one by one.

The price of the <var>i</var>-th item he buys is <var>A_i</var> yen (the currency of Japan).

He has <var>M</var> discount tickets, and he can use any number of them when buying an item.

If <var>Y</var> tickets are used when buying an item priced <var>X</var> yen, he can get the item for <var>\frac{X}{2^Y}</var> (rounded down to the nearest integer) yen.

What is the minimum amount of money required to buy all the items?

Constraints

All values in input are integers.

<var>1 \leq N, M \leq 10^5</var>

<var>1 \leq A_i \leq 10^9</var>

Input

Input is given from Standard Input in the following format:

<var>N</var> <var>M</var>
<var>A_1</var> <var>A_2</var> <var>...</var> <var>A_N</var>

Output

Print the minimum amount of money required to buy all the items.

Sample Input 1

3 3
2 13 8

Sample Output 1

9

We can buy all the items for <var>9</var> yen, as follows:

Buy the <var>1</var>-st item for <var>2</var> yen without tickets.

Buy the <var>2</var>-nd item for <var>3</var> yen with <var>2</var> tickets.

Buy the <var>3</var>-rd item for <var>4</var> yen with <var>1</var> ticket.

Sample Input 2

4 4
1 9 3 5

Sample Output 2

6

Sample Input 3

1 100000
1000000000

Sample Output 3

0

We can buy the item priced <var>1000000000</var> yen for <var>0</var> yen with <var>100000</var> tickets.

Sample Input 4

10 1
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000

Sample Output 4

9500000000


Score : <var>200</var> points

Problem Statement

A group of people played a game. All players had distinct scores, which are positive integers.

Takahashi knows <var>N</var> facts on the players' scores. The <var>i</var>-th fact is as follows: the <var>A_i</var>-th highest score among the players is <var>B_i</var>.

Find the maximum possible number of players in the game.

Constraints

<var>1 \leq N \leq 10^5</var>

<var>1 \leq A_i \leq 10^9(1\leq i\leq N)</var>

<var>0 \leq B_i \leq 10^9(1\leq i\leq N)</var>

If <var>i ≠ j</var>, <var>A_i ≠ A_j</var>.

There exists a possible outcome of the game that are consistent with the facts.

All input values are integers.

Inputs

Input is given from Standard Input in the following format:

<var>N</var>
<var>A_1</var> <var>B_1</var>
:
<var>A_N</var> <var>B_N</var>

Outputs

Print the maximum possible number of players in the game.

Sample Input 1

3
4 7
2 9
6 2

Sample Output 1

8

The maximum possible number of players is achieved when, for example, the players have the following scores: <var>12,9,8,7,5,2,1,0</var>.

Sample Input 2

5
1 10
3 6
5 2
4 4
2 8

Sample Output 2

7

Sample Input 3

2
1 1000000000
1000000000 1

Sample Output 3

1000000001


Score : <var>200</var> points

Problem Statement

Akaki, a patissier, can make <var>N</var> kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut <var>1</var>, Doughnut <var>2</var>, <var>...,</var> Doughnut <var>N</var>. In order to make one Doughnut <var>i</var> <var>(1 ≤ i ≤ N)</var>, she needs to consume <var>m_i</var> grams of Moto. She cannot make a non-integer number of doughnuts, such as <var>0.5</var> doughnuts.

Now, she has <var>X</var> grams of Moto. She decides to make as many doughnuts as possible for a party tonight. However, since the tastes of the guests differ, she will obey the following condition:

For each of the <var>N</var> kinds of doughnuts, make at least one doughnut of that kind.

At most how many doughnuts can be made here? She does not necessarily need to consume all of her Moto. Also, under the constraints of this problem, it is always possible to obey the condition.

Constraints

<var>2 ≤ N ≤ 100</var>

<var>1 ≤ m_i ≤ 1000</var>

<var>m_1 + m_2 + ... + m_N ≤ X ≤ 10^5</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>N</var> <var>X</var>
<var>m_1</var>
<var>m_2</var>
<var>:</var>
<var>m_N</var>

Output

Print the maximum number of doughnuts that can be made under the condition.

Sample Input 1

3 1000
120
100
140

Sample Output 1

9

She has <var>1000</var> grams of Moto and can make three kinds of doughnuts. If she makes one doughnut for each of the three kinds, she consumes <var>120 + 100 + 140 = 360</var> grams of Moto. From the <var>640</var> grams of Moto that remains here, she can make additional six Doughnuts <var>2</var>. This is how she can made a total of nine doughnuts, which is the maximum.

Sample Input 2

4 360
90
90
90
90

Sample Output 2

4

Making one doughnut for each of the four kinds consumes all of her Moto.

Sample Input 3

5 3000
150
130
150
130
110

Sample Output 3

26


Score : <var>200</var> points

Problem Statement

Raccoon is fighting with a monster.

The health of the monster is <var>H</var>.

Raccoon can use <var>N</var> kinds of special moves. Using the <var>i</var>-th move decreases the monster's health by <var>A_i</var>.
There is no other way to decrease the monster's health.

Raccoon wins when the monster's health becomes <var>0</var> or below.

If Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.

Constraints

<var>1 \leq H \leq 10^9</var>

<var>1 \leq N \leq 10^5</var>

<var>1 \leq A_i \leq 10^4</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>H</var> <var>N</var>
<var>A_1</var> <var>A_2</var> <var>...</var> <var>A_N</var>

Output

If Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.

Sample Input 1

10 3
4 5 6

Sample Output 1

Yes

The monster's health will become <var>0</var> or below after, for example, using the second and third moves.

Sample Input 2

20 3
4 5 6

Sample Output 2

No

Sample Input 3

210 5
31 41 59 26 53

Sample Output 3

Yes

Sample Input 4

211 5
31 41 59 26 53

Sample Output 4

No


Score : <var>300</var> points

Problem Statement

When <var>l</var> is an odd number, the median of <var>l</var> numbers <var>a_1, a_2, ..., a_l</var> is the <var>(\frac{l+1}{2})</var>-th largest value among <var>a_1, a_2, ..., a_l</var>.

You are given <var>N</var> numbers <var>X_1, X_2, ..., X_N</var>, where <var>N</var> is an even number.
For each <var>i = 1, 2, ..., N</var>, let the median of <var>X_1, X_2, ..., X_N</var> excluding <var>X_i</var>, that is, the median of <var>X_1, X_2, ..., X_{i-1}, X_{i+1}, ..., X_N</var> be <var>B_i</var>.

Find <var>B_i</var> for each <var>i = 1, 2, ..., N</var>.

Constraints

<var>2 \leq N \leq 200000</var>

<var>N</var> is even.

<var>1 \leq X_i \leq 10^9</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>X_1</var> <var>X_2</var> ... <var>X_N</var>

Output

Print <var>N</var> lines.
The <var>i</var>-th line should contain <var>B_i</var>.

Sample Input 1

4
2 4 4 3

Sample Output 1

4
3
3
4

Since the median of <var>X_2, X_3, X_4</var> is <var>4</var>, <var>B_1 = 4</var>.

Since the median of <var>X_1, X_3, X_4</var> is <var>3</var>, <var>B_2 = 3</var>.

Since the median of <var>X_1, X_2, X_4</var> is <var>3</var>, <var>B_3 = 3</var>.

Since the median of <var>X_1, X_2, X_3</var> is <var>4</var>, <var>B_4 = 4</var>.

Sample Input 2

2
1 2

Sample Output 2

2
1

Sample Input 3

6
5 5 4 4 3 3

Sample Output 3

4
4
4
4
4
4


Score : <var>200</var> points

Problem Statement

We have a string <var>S</var> of length <var>N</var> consisting of uppercase English letters.

How many times does ABC occur in <var>S</var> as contiguous subsequences (see Sample Inputs and Outputs)?

Constraints

<var>3 \leq N \leq 50</var>

<var>S</var> consists of uppercase English letters.

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>S</var>

Output

Print number of occurrences of ABC in <var>S</var> as contiguous subsequences.

Sample Input 1

10
ZABCDBABCQ

Sample Output 1

2

Two contiguous subsequences of <var>S</var> are equal to ABC: the <var>2</var>-nd through <var>4</var>-th characters, and the <var>7</var>-th through <var>9</var>-th characters.

Sample Input 2

19
THREEONEFOURONEFIVE

Sample Output 2

0

No contiguous subsequences of <var>S</var> are equal to ABC.

Sample Input 3

33
ABCCABCBABCCABACBCBBABCBCBCBCABCB

Sample Output 3

5


Score : <var>200</var> points

Problem Statement

There are <var>N</var> participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.

Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from the top rank down. Participants who are not students cannot pass the Qualification contests.

A Japanese student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than <var>A+B</var>.

An overseas student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than <var>A+B</var> and the student ranks <var>B</var>-th or above among all overseas students.

A string <var>S</var> is assigned indicating attributes of all participants. If the <var>i</var>-th character of string <var>S</var> is a, this means the participant ranked <var>i</var>-th in the Qualification contests is a Japanese student; b means the participant ranked <var>i</var>-th is an overseas student; and c means the participant ranked <var>i</var>-th is neither of these.

Write a program that outputs for all the participants in descending rank either Yes if they passed the Qualification contests or No if they did not pass.

Constraints

<var>1≦N,A,B≦100000</var>

<var>A+B≦N</var>

<var>S</var> is <var>N</var> characters long.

<var>S</var> consists only of the letters a, b and c.

Input

Inputs are provided from Standard Input in the following form.

<var>N</var> <var>A</var> <var>B</var>
<var>S</var>

Output

Output <var>N</var> lines. On the <var>i</var>-th line, output Yes if the <var>i</var>-th participant passed the Qualification contests or No if that participant did not pass.

Sample Input 1

10 2 3
abccabaabb

Sample Output 1

Yes
Yes
No
No
Yes
Yes
Yes
No
No
No

The first, second, fifth, sixth, and seventh participants pass the Qualification contests.

Sample Input 2

12 5 2
cabbabaacaba

Sample Output 2

No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
No

The sixth participant is third among overseas students and thus does not pass the Qualification contests.

Sample Input 3

5 2 2
ccccc

Sample Output 3

No
No
No
No
No


Score: <var>100</var> points

Problem Statement

There is a farm whose length and width are <var>A</var> yard and <var>B</var> yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)

What is the area of this yard excluding the roads? Find it.

Note

It can be proved that the positions of the roads do not affect the area.

Constraints

<var>A</var> is an integer between <var>2</var> and <var>100</var> (inclusive).

<var>B</var> is an integer between <var>2</var> and <var>100</var> (inclusive).

Input

Input is given from Standard Input in the following format:

<var>A</var> <var>B</var>

Output

Print the area of this yard excluding the roads (in square yards).

Sample Input 1

2 2

Sample Output 1

1

In this case, the area is <var>1</var> square yard.

Sample Input 2

5 7

Sample Output 2

24

In this case, the area is <var>24</var> square yards.


Problem Statement

You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.

Constraints

<var>a</var> and <var>b</var> are integers.

<var>-10^9≤a≤b≤10^9</var>

Partial Score

In test cases worth <var>100</var> points, <var>-10≤a≤b≤10</var>.

Input

The input is given from Standard Input in the following format:

<var>a</var> <var>b</var>

Output

If the product is positive, print Positive. If it is negative, print Negative. If it is zero, print Zero.

Sample Input 1

1 3

Sample Output 1

Positive

<var>1×2×3=6</var> is positive.

Sample Input 2

-3 -1

Sample Output 2

Negative

<var>(-3)×(-2)×(-1)=-6</var> is negative.

Sample Input 3

-1 1

Sample Output 3

Zero

<var>(-1)×0×1=0</var>.


Score : <var>200</var> points

Problem Statement

We will say that two integer sequences of length <var>N</var>, <var>x_1, x_2, ..., x_N</var> and <var>y_1, y_2, ..., y_N</var>, are similar when <var>|x_i - y_i| \leq 1</var> holds for all <var>i</var> (<var>1 \leq i \leq N</var>).

In particular, any integer sequence is similar to itself.

You are given an integer <var>N</var> and an integer sequence of length <var>N</var>, <var>A_1, A_2, ..., A_N</var>.

How many integer sequences <var>b_1, b_2, ..., b_N</var> are there such that <var>b_1, b_2, ..., b_N</var> is similar to <var>A</var> and the product of all elements, <var>b_1 b_2 ... b_N</var>, is even?

Constraints

<var>1 \leq N \leq 10</var>

<var>1 \leq A_i \leq 100</var>

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>A_1</var> <var>A_2</var> <var>...</var> <var>A_N</var>

Output

Print the number of integer sequences that satisfy the condition.

Sample Input 1

2
2 3

Sample Output 1

7

There are seven integer sequences that satisfy the condition:

<var>1, 2</var>

<var>1, 4</var>

<var>2, 2</var>

<var>2, 3</var>

<var>2, 4</var>

<var>3, 2</var>

<var>3, 4</var>

Sample Input 2

3
3 3 3

Sample Output 2

26

Sample Input 3

1
100

Sample Output 3

1

Sample Input 4

10
90 52 56 71 44 8 13 30 57 84

Sample Output 4

58921


Score : <var>300</var> points

Problem Statement

AtCoDeer the deer is going on a trip in a two-dimensional plane.
In his plan, he will depart from point <var>(0, 0)</var> at time <var>0</var>, then for each <var>i</var> between <var>1</var> and <var>N</var> (inclusive), he will visit point <var>(x_i,y_i)</var> at time <var>t_i</var>.

If AtCoDeer is at point <var>(x, y)</var> at time <var>t</var>, he can be at one of the following points at time <var>t+1</var>: <var>(x+1,y)</var>, <var>(x-1,y)</var>, <var>(x,y+1)</var> and <var>(x,y-1)</var>.
Note that he cannot stay at his place.
Determine whether he can carry out his plan.

Constraints

<var>1</var> <var>≤</var> <var>N</var> <var>≤</var> <var>10^5</var>

<var>0</var> <var>≤</var> <var>x_i</var> <var>≤</var> <var>10^5</var>

<var>0</var> <var>≤</var> <var>y_i</var> <var>≤</var> <var>10^5</var>

<var>1</var> <var>≤</var> <var>t_i</var> <var>≤</var> <var>10^5</var>

<var>t_i</var> <var><</var> <var>t_{i+1}</var> (<var>1</var> <var>≤</var> <var>i</var> <var>≤</var> <var>N-1</var>)

All input values are integers.

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>t_1</var> <var>x_1</var> <var>y_1</var>
<var>t_2</var> <var>x_2</var> <var>y_2</var>
<var>:</var>
<var>t_N</var> <var>x_N</var> <var>y_N</var>

Output

If AtCoDeer can carry out his plan, print Yes; if he cannot, print No.

Sample Input 1

2
3 1 2
6 1 1

Sample Output 1

Yes

For example, he can travel as follows: <var>(0,0)</var>, <var>(0,1)</var>, <var>(1,1)</var>, <var>(1,2)</var>, <var>(1,1)</var>, <var>(1,0)</var>, then <var>(1,1)</var>.

Sample Input 2

1
2 100 100

Sample Output 2

No

It is impossible to be at <var>(100,100)</var> two seconds after being at <var>(0,0)</var>.

Sample Input 3

2
5 1 1
100 1 1

Sample Output 3

No


Score: <var>200</var> points

Problem Statement

Today, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.

As the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by <var>100</var> exactly <var>D</var> times.

Find the <var>N</var>-th smallest integer that would make Ringo happy.

Constraints

<var>D</var> is <var>0</var>, <var>1</var> or <var>2</var>.

<var>N</var> is an integer between <var>1</var> and <var>100</var> (inclusive).

Input

Input is given from Standard Input in the following format:

<var>D</var> <var>N</var>

Output

Print the <var>N</var>-th smallest integer that can be divided by <var>100</var> exactly <var>D</var> times.

Sample Input 1

0 5

Sample Output 1

5

The integers that can be divided by <var>100</var> exactly <var>0</var> times (that is, not divisible by <var>100</var>) are as follows: <var>1</var>, <var>2</var>, <var>3</var>, <var>4</var>, <var>5</var>, <var>6</var>, <var>7</var>, ...

Thus, the <var>5</var>-th smallest integer that would make Ringo happy is <var>5</var>.

Sample Input 2

1 11

Sample Output 2

1100

The integers that can be divided by <var>100</var> exactly once are as follows: <var>100</var>, <var>200</var>, <var>300</var>, <var>400</var>, <var>500</var>, <var>600</var>, <var>700</var>, <var>800</var>, <var>900</var>, <var>1 \ 000</var>, <var>1 \ 100</var>, ...

Thus, the integer we are seeking is <var>1 \ 100</var>.

Sample Input 3

2 85

Sample Output 3

850000

The integers that can be divided by <var>100</var> exactly twice are as follows: <var>10 \ 000</var>, <var>20 \ 000</var>, <var>30 \ 000</var>, ...

Thus, the integer we are seeking is <var>850 \ 000</var>.


Score : <var>100</var> points

Problem Statement

We have two bottles for holding water.

Bottle <var>1</var> can hold up to <var>A</var> milliliters of water, and now it contains <var>B</var> milliliters of water.

Bottle <var>2</var> contains <var>C</var> milliliters of water.

We will transfer water from Bottle <var>2</var> to Bottle <var>1</var> as much as possible.

How much amount of water will remain in Bottle <var>2</var>?

Constraints

All values in input are integers.

<var>1 \leq B \leq A \leq 20</var>

<var>1 \leq C \leq 20</var>

Input

Input is given from Standard Input in the following format:

<var>A</var> <var>B</var> <var>C</var>

Output

Print the integer representing the amount of water, in milliliters, that will remain in Bottle <var>2</var>.

Sample Input 1

6 4 3

Sample Output 1

1

We will transfer two milliliters of water from Bottle <var>2</var> to Bottle <var>1</var>, and one milliliter of water will remain in Bottle <var>2</var>.

Sample Input 2

8 3 9

Sample Output 2

4

Sample Input 3

12 3 7

Sample Output 3

0


Score: <var>300</var> points

Problem Statement

Mr. Infinity has a string <var>S</var> consisting of digits from 1 to 9. Each time the date changes, this string changes as follows:

Each occurrence of 2 in <var>S</var> is replaced with 22. Similarly, each 3 becomes 333, 4 becomes 4444, 5 becomes 55555, 6 becomes 666666, 7 becomes 7777777, 8 becomes 88888888 and 9 becomes 999999999. 1 remains as 1.

For example, if <var>S</var> is 1324, it becomes 1333224444 the next day, and it becomes 133333333322224444444444444444 the day after next.
You are interested in what the string looks like after <var>5 \times 10^{15}</var> days. What is the <var>K</var>-th character from the left in the string after <var>5 \times 10^{15}</var> days?

Constraints

<var>S</var> is a string of length between <var>1</var> and <var>100</var> (inclusive).

<var>K</var> is an integer between <var>1</var> and <var>10^{18}</var> (inclusive).

The length of the string after <var>5 \times 10^{15}</var> days is at least <var>K</var>.

Input

Input is given from Standard Input in the following format:

<var>S</var>
<var>K</var>

Output

Print the <var>K</var>-th character from the left in Mr. Infinity's string after <var>5 \times 10^{15}</var> days.

Sample Input 1

1214
4

Sample Output 1

2

The string <var>S</var> changes as follows:

Now: 1214

After one day: 12214444

After two days: 1222214444444444444444

After three days: 12222222214444444444444444444444444444444444444444444444444444444444444444

The first five characters in the string after <var>5 \times 10^{15}</var> days is 12222. As <var>K=4</var>, we should print the fourth character, 2.

Sample Input 2

3
157

Sample Output 2

3

The initial string is 3. The string after <var>5 \times 10^{15}</var> days consists only of 3.

Sample Input 3

299792458
9460730472580800

Sample Output 3

2


Score : <var>100</var> points

Problem Statement

This contest, AtCoder Beginner Contest, is abbreviated as ABC.

When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC.

What is the abbreviation for the <var>N</var>-th round of ABC? Write a program to output the answer.

Constraints

<var>100 ≤ N ≤ 999</var>

Input

Input is given from Standard Input in the following format:

<var>N</var>

Output

Print the abbreviation for the <var>N</var>-th round of ABC.

Sample Input 1

100

Sample Output 1

ABC100

The 100th round of ABC is ABC100.

Sample Input 2

425

Sample Output 2

ABC425

Sample Input 3

999

Sample Output 3

ABC999


Score : <var>200</var> points

Problem Statement

We have sticks numbered <var>1, \cdots, N</var>. The length of Stick <var>i</var> <var>(1 \leq i \leq N)</var> is <var>L_i</var>.

In how many ways can we choose three of the sticks with different lengths that can form a triangle?

That is, find the number of triples of integers <var>(i, j, k)</var> <var>(1 \leq i < j < k \leq N)</var> that satisfy both of the following conditions:

<var>L_i</var>, <var>L_j</var>, and <var>L_k</var> are all different.

There exists a triangle whose sides have lengths <var>L_i</var>, <var>L_j</var>, and <var>L_k</var>.

Constraints

<var>1 \leq N \leq 100</var>

<var>1 \leq L_i \leq 10^9</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>L_1</var> <var>L_2</var> <var>\cdots</var> <var>L_N</var>

Output

Print the number of ways to choose three of the sticks with different lengths that can form a triangle.

Sample Input 1

5
4 4 9 7 5

Sample Output 1

5

The following five triples <var>(i, j, k)</var> satisfy the conditions: <var>(1, 3, 4)</var>, <var>(1, 4, 5)</var>, <var>(2, 3, 4)</var>, <var>(2, 4, 5)</var>, and <var>(3, 4, 5)</var>.

Sample Input 2

6
4 5 4 3 3 5

Sample Output 2

8

We have two sticks for each of the lengths <var>3</var>, <var>4</var>, and <var>5</var>. To satisfy the first condition, we have to choose one from each length.

There is a triangle whose sides have lengths <var>3</var>, <var>4</var>, and <var>5</var>, so we have <var>2 ^ 3 = 8</var> triples <var>(i, j, k)</var> that satisfy the conditions.

Sample Input 3

10
9 4 6 1 9 6 10 6 6 8

Sample Output 3

39

Sample Input 4

2
1 1

Sample Output 4

0

No triple <var>(i, j, k)</var> satisfies <var>1 \leq i < j < k \leq N</var>, so we should print <var>0</var>.


Score : <var>300</var> points

Problem Statement

We have two desks: A and B. Desk A has a vertical stack of <var>N</var> books on it, and Desk B similarly has <var>M</var> books on it.

It takes us <var>A_i</var> minutes to read the <var>i</var>-th book from the top on Desk A <var>(1 \leq i \leq N)</var>, and <var>B_i</var> minutes to read the <var>i</var>-th book from the top on Desk B <var>(1 \leq i \leq M)</var>.

Consider the following action:

Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.

How many books can we read at most by repeating this action so that it takes us at most <var>K</var> minutes in total? We ignore the time it takes to do anything other than reading.

Constraints

<var>1 \leq N, M \leq 200000</var>

<var>1 \leq K \leq 10^9</var>

<var>1 \leq A_i, B_i \leq 10^9</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>N</var> <var>M</var> <var>K</var>
<var>A_1</var> <var>A_2</var> <var>\ldots</var> <var>A_N</var>
<var>B_1</var> <var>B_2</var> <var>\ldots</var> <var>B_M</var>

Output

Print an integer representing the maximum number of books that can be read.

Sample Input 1

3 4 240
60 90 120
80 150 80 150

Sample Output 1

3

In this case, it takes us <var>60</var>, <var>90</var>, <var>120</var> minutes to read the <var>1</var>-st, <var>2</var>-nd, <var>3</var>-rd books from the top on Desk A, and <var>80</var>, <var>150</var>, <var>80</var>, <var>150</var> minutes to read the <var>1</var>-st, <var>2</var>-nd, <var>3</var>-rd, <var>4</var>-th books from the top on Desk B, respectively.

We can read three books in <var>230</var> minutes, as shown below, and this is the maximum number of books we can read within <var>240</var> minutes.

Read the topmost book on Desk A in <var>60</var> minutes, and remove that book from the desk.

Read the topmost book on Desk B in <var>80</var> minutes, and remove that book from the desk.

Read the topmost book on Desk A in <var>90</var> minutes, and remove that book from the desk.

Sample Input 2

3 4 730
60 90 120
80 150 80 150

Sample Output 2

7

Sample Input 3

5 4 1
1000000000 1000000000 1000000000 1000000000 1000000000
1000000000 1000000000 1000000000 1000000000

Sample Output 3

0

Watch out for integer overflows.


Score : <var>100</var> points

Problem Statement

This contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.

Mr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.

You are given a string <var>s</var> consisting of uppercase English letters.
Determine whether the string CF can be obtained from the string <var>s</var> by deleting some characters.

Constraints

<var>2 ≤ |s| ≤ 100</var>

All characters in <var>s</var> are uppercase English letters (A-Z).

Input

The input is given from Standard Input in the following format:

<var>s</var>

Output

Print Yes if the string CF can be obtained from the string <var>s</var> by deleting some characters.
Otherwise print No.

Sample Input 1

CODEFESTIVAL

Sample Output 1

Yes

CF is obtained by deleting characters other than the first character C and the fifth character F.

Sample Input 2

FESTIVALCODE

Sample Output 2

No

FC can be obtained but CF cannot be obtained because you cannot change the order of the characters.

Sample Input 3

CF

Sample Output 3

Yes

It is also possible not to delete any characters.

Sample Input 4

FCF

Sample Output 4

Yes

CF is obtained by deleting the first character.


Score : <var>300</var> points

Problem Statement

You are given four integers <var>A</var>, <var>B</var>, <var>C</var>, and <var>D</var>. Find the number of integers between <var>A</var> and <var>B</var> (inclusive) that can be evenly divided by neither <var>C</var> nor <var>D</var>.

Constraints

<var>1\leq A\leq B\leq 10^{18}</var>

<var>1\leq C,D\leq 10^9</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>A</var> <var>B</var> <var>C</var> <var>D</var>

Output

Print the number of integers between <var>A</var> and <var>B</var> (inclusive) that can be evenly divided by neither <var>C</var> nor <var>D</var>.

Sample Input 1

4 9 2 3

Sample Output 1

2

<var>5</var> and <var>7</var> satisfy the condition.

Sample Input 2

10 40 6 8

Sample Output 2

23

Sample Input 3

314159265358979323 846264338327950288 419716939 937510582

Sample Output 3

532105071133627368


Score : <var>300</var> points

Problem Statement

A programming competition site AtCode provides algorithmic problems.
Each problem is allocated a score based on its difficulty.
Currently, for each integer <var>i</var> between <var>1</var> and <var>D</var> (inclusive), there are <var>p_i</var> problems with a score of <var>100i</var> points.
These <var>p_1 + … + p_D</var> problems are all of the problems available on AtCode.

A user of AtCode has a value called total score.
The total score of a user is the sum of the following two elements:

Base score: the sum of the scores of all problems solved by the user.

Perfect bonuses: when a user solves all problems with a score of <var>100i</var> points, he/she earns the perfect bonus of <var>c_i</var> points, aside from the base score <var>(1 ≤ i ≤ D)</var>.

Takahashi, who is the new user of AtCode, has not solved any problem.
His objective is to have a total score of <var>G</var> or more points.
At least how many problems does he need to solve for this objective?

Constraints

<var>1 ≤ D ≤ 10</var>

<var>1 ≤ p_i ≤ 100</var>

<var>100 ≤ c_i ≤ 10^6</var>

<var>100 ≤ G</var>

All values in input are integers.

<var>c_i</var> and <var>G</var> are all multiples of <var>100</var>.

It is possible to have a total score of <var>G</var> or more points.

Input

Input is given from Standard Input in the following format:

<var>D</var> <var>G</var>
<var>p_1</var> <var>c_1</var>
<var>:</var>
<var>p_D</var> <var>c_D</var>

Output

Print the minimum number of problems that needs to be solved in order to have a total score of <var>G</var> or more points. Note that this objective is always achievable (see Constraints).

Sample Input 1

2 700
3 500
5 800

Sample Output 1

3

In this case, there are three problems each with <var>100</var> points and five problems each with <var>200</var> points. The perfect bonus for solving all the <var>100</var>-point problems is <var>500</var> points, and the perfect bonus for solving all the <var>200</var>-point problems is <var>800</var> points. Takahashi's objective is to have a total score of <var>700</var> points or more.

One way to achieve this objective is to solve four <var>200</var>-point problems and earn a base score of <var>800</var> points. However, if we solve three <var>100</var>-point problems, we can earn the perfect bonus of <var>500</var> points in addition to the base score of <var>300</var> points, for a total score of <var>800</var> points, and we can achieve the objective with fewer problems.

Sample Input 2

2 2000
3 500
5 800

Sample Output 2

7

This case is similar to Sample Input 1, but the Takahashi's objective this time is <var>2000</var> points or more. In this case, we inevitably need to solve all five <var>200</var>-point problems, and by solving two <var>100</var>-point problems additionally we have the total score of <var>2000</var> points.

Sample Input 3

2 400
3 500
5 800

Sample Output 3

2

This case is again similar to Sample Input 1, but the Takahashi's objective this time is <var>400</var> points or more. In this case, we only need to solve two <var>200</var>-point problems to achieve the objective.

Sample Input 4

5 25000
20 1000
40 1000
50 1000
30 1000
1 1000

Sample Output 4

66

There is only one <var>500</var>-point problem, but the perfect bonus can be earned even in such a case.


Score : <var>200</var> points

Problem Statement

Takahashi has <var>N</var> blue cards and <var>M</var> red cards.
A string is written on each card. The string written on the <var>i</var>-th blue card is <var>s_i</var>, and the string written on the <var>i</var>-th red card is <var>t_i</var>.

Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will earn <var>1</var> yen (the currency of Japan); each time he finds a red card with that string, he will lose <var>1</var> yen.

Here, we only consider the case where the string announced by Takahashi and the string on the card are exactly the same. For example, if he announces atcoder, he will not earn money even if there are blue cards with atcoderr, atcode, btcoder, and so on. (On the other hand, he will not lose money even if there are red cards with such strings, either.)

At most how much can he earn on balance?

Note that the same string may be written on multiple cards.

Constraints

<var>N</var> and <var>M</var> are integers.

<var>1 \leq N, M \leq 100</var>

<var>s_1, s_2, ..., s_N, t_1, t_2, ..., t_M</var> are all strings of lengths between <var>1</var> and <var>10</var> (inclusive) consisting of lowercase English letters.

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>s_1</var>
<var>s_2</var>
<var>:</var>
<var>s_N</var>
<var>M</var>
<var>t_1</var>
<var>t_2</var>
<var>:</var>
<var>t_M</var>

Output

If Takahashi can earn at most <var>X</var> yen on balance, print <var>X</var>.

Sample Input 1

3
apple
orange
apple
1
grape

Sample Output 1

2

He can earn <var>2</var> yen by announcing apple.

Sample Input 2

3
apple
orange
apple
5
apple
apple
apple
apple
apple

Sample Output 2

1

If he announces apple, he will lose <var>3</var> yen. If he announces orange, he can earn <var>1</var> yen.

Sample Input 3

1
voldemort
10
voldemort
voldemort
voldemort
voldemort
voldemort
voldemort
voldemort
voldemort
voldemort
voldemort

Sample Output 3

0

If he announces voldemort, he will lose <var>9</var> yen. If he announces orange, for example, he can avoid losing a yen.

Sample Input 4

6
red
red
blue
yellow
yellow
red
5
red
red
yellow
green
blue

Sample Output 4

1


Score : <var>100</var> points

Problem Statement

You are given two integers <var>A</var> and <var>B</var>.
Find the largest value among <var>A+B</var>, <var>A-B</var> and <var>A \times B</var>.

Constraints

<var>-1000 \leq A,B \leq 1000</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>A</var> <var>B</var>

Output

Print the largest value among <var>A+B</var>, <var>A-B</var> and <var>A \times B</var>.

Sample Input 1

3 1

Sample Output 1

4

<var>3+1=4</var>, <var>3-1=2</var> and <var>3 \times 1=3</var>. The largest among them is <var>4</var>.

Sample Input 2

4 -2

Sample Output 2

6

The largest is <var>4 - (-2) = 6</var>.

Sample Input 3

0 0

Sample Output 3

0


Score : <var>100</var> points

Problem Statement

Takahashi has <var>K</var> <var>500</var>-yen coins. (Yen is the currency of Japan.)
If these coins add up to <var>X</var> yen or more, print Yes; otherwise, print No.

Constraints

<var>1 \leq K \leq 100</var>

<var>1 \leq X \leq 10^5</var>

Input

Input is given from Standard Input in the following format:

<var>K</var> <var>X</var>

Output

If the coins add up to <var>X</var> yen or more, print Yes; otherwise, print No.

Sample Input 1

2 900

Sample Output 1

Yes

Two <var>500</var>-yen coins add up to <var>1000</var> yen, which is not less than <var>X = 900</var> yen.

Sample Input 2

1 501

Sample Output 2

No

One <var>500</var>-yen coin is worth <var>500</var> yen, which is less than <var>X = 501</var> yen.

Sample Input 3

4 2000

Sample Output 3

Yes

Four <var>500</var>-yen coins add up to <var>2000</var> yen, which is not less than <var>X = 2000</var> yen.


Score : <var>100</var> points

Problem Statement

Snuke lives at position <var>x</var> on a number line.
On this line, there are two stores <var>A</var> and <var>B</var>, respectively at position <var>a</var> and <var>b</var>, that offer food for delivery.

Snuke decided to get food delivery from the closer of stores <var>A</var> and <var>B</var>.
Find out which store is closer to Snuke's residence.

Here, the distance between two points <var>s</var> and <var>t</var> on a number line is represented by <var>|s-t|</var>.

Constraints

<var>1 \leq x \leq 1000</var>

<var>1 \leq a \leq 1000</var>

<var>1 \leq b \leq 1000</var>

<var>x, a</var> and <var>b</var> are pairwise distinct.

The distances between Snuke's residence and stores <var>A</var> and <var>B</var> are different.

Input

Input is given from Standard Input in the following format:

<var>x</var> <var>a</var> <var>b</var>

Output

If store <var>A</var> is closer, print A; if store <var>B</var> is closer, print B.

Sample Input 1

5 2 7

Sample Output 1

B

The distances between Snuke's residence and stores <var>A</var> and <var>B</var> are <var>3</var> and <var>2</var>, respectively.
Since store <var>B</var> is closer, print B.

Sample Input 2

1 999 1000

Sample Output 2

A


Score : <var>400</var> points

Problem Statement

There are <var>N</var> one-off jobs available. If you take the <var>i</var>-th job and complete it, you will earn the reward of <var>B_i</var> after <var>A_i</var> days from the day you do it.

You can take and complete at most one of these jobs in a day.

However, you cannot retake a job that you have already done.

Find the maximum total reward that you can earn no later than <var>M</var> days from today.

You can already start working today.

Constraints

All values in input are integers.

<var>1 \leq N \leq 10^5</var>

<var>1 \leq M \leq 10^5</var>

<var>1 \leq A_i \leq 10^5</var>

<var>1 \leq B_i \leq 10^4</var>

Input

Input is given from Standard Input in the following format:

<var>N</var> <var>M</var>
<var>A_1</var> <var>B_1</var>
<var>A_2</var> <var>B_2</var>
<var>\vdots</var>
<var>A_N</var> <var>B_N</var>

Output

Print the maximum total reward that you can earn no later than <var>M</var> days from today.

Sample Input 1

3 4
4 3
4 1
2 2

Sample Output 1

5

You can earn the total reward of <var>5</var> by taking the jobs as follows:

Take and complete the first job today. You will earn the reward of <var>3</var> after four days from today.

Take and complete the third job tomorrow. You will earn the reward of <var>2</var> after two days from tomorrow, that is, after three days from today.

Sample Input 2

5 3
1 2
1 3
1 4
2 1
2 3

Sample Output 2

10

Sample Input 3

1 1
2 1

Sample Output 3

0


Score : <var>200</var> points

Problem Statement

There are <var>N</var> balls in the <var>xy</var>-plane. The coordinates of the <var>i</var>-th of them is <var>(x_i, i)</var>.
Thus, we have one ball on each of the <var>N</var> lines <var>y = 1</var>, <var>y = 2</var>, <var>...</var>, <var>y = N</var>.

In order to collect these balls, Snuke prepared <var>2N</var> robots, <var>N</var> of type A and <var>N</var> of type B.
Then, he placed the <var>i</var>-th type-A robot at coordinates <var>(0, i)</var>, and the <var>i</var>-th type-B robot at coordinates <var>(K, i)</var>.
Thus, now we have one type-A robot and one type-B robot on each of the <var>N</var> lines <var>y = 1</var>, <var>y = 2</var>, <var>...</var>, <var>y = N</var>.

When activated, each type of robot will operate as follows.

When a type-A robot is activated at coordinates <var>(0, a)</var>, it will move to the position of the ball on the line <var>y = a</var>, collect the ball, move back to its original position <var>(0, a)</var> and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything.

When a type-B robot is activated at coordinates <var>(K, b)</var>, it will move to the position of the ball on the line <var>y = b</var>, collect the ball, move back to its original position <var>(K, b)</var> and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything.

Snuke will activate some of the <var>2N</var> robots to collect all of the balls. Find the minimum possible total distance covered by robots.

Constraints

<var>1 \leq N \leq 100</var>

<var>1 \leq K \leq 100</var>

<var>0 < x_i < K</var>

All input values are integers.

Inputs

Input is given from Standard Input in the following format:

<var>N</var>
<var>K</var>
<var>x_1</var> <var>x_2</var> <var>...</var> <var>x_N</var>

Outputs

Print the minimum possible total distance covered by robots.

Sample Input 1

1
10
2

Sample Output 1

4

There are just one ball, one type-A robot and one type-B robot.

If the type-A robot is used to collect the ball, the distance from the robot to the ball is <var>2</var>, and the distance from the ball to the original position of the robot is also <var>2</var>, for a total distance of <var>4</var>.

Similarly, if the type-B robot is used, the total distance covered will be <var>16</var>.

Thus, the total distance covered will be minimized when the type-A robot is used. The output should be <var>4</var>.

Sample Input 2

2
9
3 6

Sample Output 2

12

The total distance covered will be minimized when the first ball is collected by the type-A robot, and the second ball by the type-B robot.

Sample Input 3

5
20
11 12 9 17 12

Sample Output 3

74


Score: <var>200</var> points

Problem Statement

A country decides to build a palace.

In this country, the average temperature of a point at an elevation of <var>x</var> meters is <var>T-x \times 0.006</var> degrees Celsius.

There are <var>N</var> places proposed for the place. The elevation of Place <var>i</var> is <var>H_i</var> meters.

Among them, Princess Joisino orders you to select the place whose average temperature is the closest to <var>A</var> degrees Celsius, and build the palace there.

Print the index of the place where the palace should be built.

It is guaranteed that the solution is unique.

Constraints

<var>1 \leq N \leq 1000</var>

<var>0 \leq T \leq 50</var>

<var>-60 \leq A \leq T</var>

<var>0 \leq H_i \leq 10^5</var>

All values in input are integers.

The solution is unique.

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>T</var> <var>A</var>
<var>H_1</var> <var>H_2</var> <var>...</var> <var>H_N</var>

Output

Print the index of the place where the palace should be built.

Sample Input 1

2
12 5
1000 2000

Sample Output 1

1

The average temperature of Place <var>1</var> is <var>12-1000 \times 0.006=6</var> degrees Celsius.

The average temperature of Place <var>2</var> is <var>12-2000 \times 0.006=0</var> degrees Celsius.

Thus, the palace should be built at Place <var>1</var>.

Sample Input 2

3
21 -11
81234 94124 52141

Sample Output 2

3


Score : <var>300</var> points

Problem Statement

Given is a positive integer <var>L</var>.
Find the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is <var>L</var>.

Constraints

<var>1 ≤ L ≤ 1000</var>

<var>L</var> is an integer.

Input

Input is given from Standard Input in the following format:

<var>L</var>

Output

Print the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is <var>L</var>.
Your output is considered correct if its absolute or relative error from our answer is at most <var>10^{-6}</var>.

Sample Input 1

3

Sample Output 1

1.000000000000

For example, a rectangular cuboid whose dimensions are <var>0.8</var>, <var>1</var>, and <var>1.2</var> has a volume of <var>0.96</var>.

On the other hand, if the dimensions are <var>1</var>, <var>1</var>, and <var>1</var>, the volume of the rectangular cuboid is <var>1</var>, which is greater.

Sample Input 2

999

Sample Output 2

36926037.000000000000


Score : <var>300</var> points

Problem Statement

We will call a string obtained by arranging the characters contained in a string <var>a</var> in some order, an anagram of <var>a</var>.

For example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.

Given are <var>N</var> strings <var>s_1, s_2, \ldots, s_N</var>. Each of these strings has a length of <var>10</var> and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers <var>i, j</var> <var>(1 \leq i < j \leq N)</var> such that <var>s_i</var> is an anagram of <var>s_j</var>.

Constraints

<var>2 \leq N \leq 10^5</var>

<var>s_i</var> is a string of length <var>10</var>.

Each character in <var>s_i</var> is a lowercase English letter.

<var>s_1, s_2, \ldots, s_N</var> are all distinct.

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>s_1</var>
<var>s_2</var>
<var>:</var>
<var>s_N</var>

Output

Print the number of pairs of integers <var>i, j</var> <var>(1 \leq i < j \leq N)</var> such that <var>s_i</var> is an anagram of <var>s_j</var>.

Sample Input 1

3
acornistnt
peanutbomb
constraint

Sample Output 1

1

<var>s_1 =</var> acornistnt is an anagram of <var>s_3 =</var> constraint. There are no other pairs <var>i, j</var> such that <var>s_i</var> is an anagram of <var>s_j</var>, so the answer is <var>1</var>.

Sample Input 2

2
oneplustwo
ninemodsix

Sample Output 2

0

If there is no pair <var>i, j</var> such that <var>s_i</var> is an anagram of <var>s_j</var>, print <var>0</var>.

Sample Input 3

5
abaaaaaaaa
oneplustwo
aaaaaaaaba
twoplusone
aaaabaaaaa

Sample Output 3

4

Note that the answer may not fit into a <var>32</var>-bit integer type, though we cannot put such a case here.


Score : <var>100</var> points

Problem Statement

Takahashi, who is <var>A</var> years old, is riding a Ferris wheel.

It costs <var>B</var> yen (<var>B</var> is an even number) to ride the Ferris wheel if you are <var>13</var> years old or older, but children between <var>6</var> and <var>12</var> years old (inclusive) can ride it for half the cost, and children who are <var>5</var> years old or younger are free of charge. (Yen is the currency of Japan.)

Find the cost of the Ferris wheel for Takahashi.

Constraints

<var>0 ≤ A ≤ 100</var>

<var>2 ≤ B ≤ 1000</var>

<var>B</var> is an even number.

Input

Input is given from Standard Input in the following format:

<var>A</var> <var>B</var>

Output

Print the cost of the Ferris wheel for Takahashi.

Sample Input 1

30 100

Sample Output 1

100

Takahashi is <var>30</var> years old now, and the cost of the Ferris wheel is <var>100</var> yen.

Sample Input 2

12 100

Sample Output 2

50

Takahashi is <var>12</var> years old, and the cost of the Ferris wheel is the half of <var>100</var> yen, that is, <var>50</var> yen.

Sample Input 3

0 100

Sample Output 3

0

Takahashi is <var>0</var> years old, and he can ride the Ferris wheel for free.


Score : <var>100</var> points

Problem Statement

Snuke prepared <var>6</var> problems for a upcoming programming contest.
For each of those problems, Rng judged whether it can be used in the contest or not.

You are given a string <var>S</var> of length <var>6</var>.
If the <var>i</var>-th character of <var>s</var> is 1, it means that the <var>i</var>-th problem prepared by Snuke is accepted to be used; 0 means that the problem is not accepted.

How many problems prepared by Snuke are accepted to be used in the contest?

Constraints

The length of <var>S</var> is <var>6</var>.

<var>S</var> consists of 0 and 1.

Inputs

Input is given from Standard Input in the following format:

<var>S</var>

Outputs

Print the number of problems prepared by Snuke that are accepted to be used in the contest.

Sample Input 1

111100

Sample Output 1

4

The first, second, third and fourth problems are accepted, for a total of four.

Sample Input 2

001001

Sample Output 2

2

Sample Input 3

000000

Sample Output 3

0


Score: <var>300</var> points

Problem Statement

M-kun is a student in Aoki High School, where a year is divided into <var>N</var> terms.

There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows:

For the first through <var>(K-1)</var>-th terms: not given.

For each of the <var>K</var>-th through <var>N</var>-th terms: the multiplication of the scores in the last <var>K</var> exams, including the exam in the graded term.

M-kun scored <var>A_i</var> in the exam at the end of the <var>i</var>-th term.

For each <var>i</var> such that <var>K+1 \leq i \leq N</var>, determine whether his grade for the <var>i</var>-th term is strictly greater than the grade for the <var>(i-1)</var>-th term.

Constraints

<var>2 \leq N \leq 200000</var>

<var>1 \leq K \leq N-1</var>

<var>1 \leq A_i \leq 10^{9}</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>N</var> <var>K</var>
<var>A_1</var> <var>A_2</var> <var>A_3</var> <var>\ldots</var> <var>A_N</var>

Output

Print the answer in <var>N-K</var> lines.

The <var>i</var>-th line should contain Yes if the grade for the <var>(K+i)</var>-th term is greater than the grade for the <var>(K+i-1)</var>-th term, and No otherwise.

Sample Input 1

5 3
96 98 95 100 20

Sample Output 1

Yes
No

His grade for each term is computed as follows:

<var>3</var>-rd term: <var>(96 \times 98 \times 95) = 893760</var>

<var>4</var>-th term: <var>(98 \times 95 \times 100) = 931000</var>

<var>5</var>-th term: <var>(95 \times 100 \times 20) = 190000</var>

Sample Input 2

3 2
1001 869120 1001

Sample Output 2

No

Note that the output should be No if the grade for the <var>3</var>-rd term is equal to the grade for the <var>2</var>-nd term.

Sample Input 3

15 7
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9

Sample Output 3

Yes
Yes
No
Yes
Yes
No
Yes
Yes


Score : <var>400</var> points

Problem Statement

Given is a positive integer <var>N</var>. Consider repeatedly applying the operation below on <var>N</var>:

First, choose a positive integer <var>z</var> satisfying all of the conditions below:

<var>z</var> can be represented as <var>z=p^e</var>, where <var>p</var> is a prime number and <var>e</var> is a positive integer;

<var>z</var> divides <var>N</var>;

<var>z</var> is different from all integers chosen in previous operations.

Then, replace <var>N</var> with <var>N/z</var>.

Find the maximum number of times the operation can be applied.

Constraints

All values in input are integers.

<var>1 \leq N \leq 10^{12}</var>

Input

Input is given from Standard Input in the following format:

<var>N</var>

Output

Print the maximum number of times the operation can be applied.

Sample Input 1

24

Sample Output 1

3

We can apply the operation three times by, for example, making the following choices:

Choose <var>z=2 (=2^1)</var>. (Now we have <var>N=12</var>.)

Choose <var>z=3 (=3^1)</var>. (Now we have <var>N=4</var>.)

Choose <var>z=4 (=2^2)</var>. (Now we have <var>N=1</var>.)

Sample Input 2

1

Sample Output 2

0

We cannot apply the operation at all.

Sample Input 3

64

Sample Output 3

3

We can apply the operation three times by, for example, making the following choices:

Choose <var>z=2 (=2^1)</var>. (Now we have <var>N=32</var>.)

Choose <var>z=4 (=2^2)</var>. (Now we have <var>N=8</var>.)

Choose <var>z=8 (=2^3)</var>. (Now we have <var>N=1</var>.)

Sample Input 4

1000000007

Sample Output 4

1

We can apply the operation once by, for example, making the following choice:

<var>z=1000000007 (=1000000007^1)</var>. (Now we have <var>N=1</var>.)

Sample Input 5

997764507000

Sample Output 5

7


Score : <var>300</var> points

Problem Statement

Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.

She is shopping, and now paying at the cashier.
Her total is <var>N</var> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).

However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.

Find the amount of money that she will hand to the cashier.

Constraints

<var> 1 ≦ N < 10000</var>

<var> 1 ≦ K < 10</var>

<var> 0 ≦ D_1 < D_2 < … < D_K≦9</var>

<var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var>

Input

The input is given from Standard Input in the following format:

<var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>

Output

Print the amount of money that Iroha will hand to the cashier.

Sample Input 1

1000 8
1 3 4 5 6 7 8 9

Sample Output 1

2000

She dislikes all digits except <var>0</var> and <var>2</var>.

The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.

Sample Input 2

9999 1
0

Sample Output 2

9999


Score : <var>300</var> points

Problem Statement

Find <var>\displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}</var>.

Here <var>\gcd(a,b,c)</var> denotes the greatest common divisor of <var>a</var>, <var>b</var>, and <var>c</var>.

Constraints

<var>1 \leq K \leq 200</var>

<var>K</var> is an integer.

Input

Input is given from Standard Input in the following format:

<var>K</var>

Output

Print the value of <var>\displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}</var>.

Sample Input 1

2

Sample Output 1

9

<var>\gcd(1,1,1)+\gcd(1,1,2)+\gcd(1,2,1)+\gcd(1,2,2)</var>
<var>+\gcd(2,1,1)+\gcd(2,1,2)+\gcd(2,2,1)+\gcd(2,2,2)</var>
<var>=1+1+1+1+1+1+1+2=9</var>

Thus, the answer is <var>9</var>.

Sample Input 2

200

Sample Output 2

10813692


Score : <var>200</var> points

Problem Statement

A string is called a KEYENCE string when it can be changed to keyence by removing its contiguous substring (possibly empty) only once.

Given a string <var>S</var> consisting of lowercase English letters, determine if <var>S</var> is a KEYENCE string.

Constraints

The length of <var>S</var> is between <var>7</var> and <var>100</var> (inclusive).

<var>S</var> consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

<var>S</var>

Output

If <var>S</var> is a KEYENCE string, print YES; otherwise, print NO.

Sample Input 1

keyofscience

Sample Output 1

YES

keyence is an abbreviation of key of science.

Sample Input 2

mpyszsbznf

Sample Output 2

NO

Sample Input 3

ashlfyha

Sample Output 3

NO

Sample Input 4

keyence

Sample Output 4

YES


Score : <var>300</var> points

Problem Statement

A company has <var>N</var> members, who are assigned ID numbers <var>1, ..., N</var>.

Every member, except the member numbered <var>1</var>, has exactly one immediate boss with a smaller ID number.

When a person <var>X</var> is the immediate boss of a person <var>Y</var>, the person <var>Y</var> is said to be an immediate subordinate of the person <var>X</var>.

You are given the information that the immediate boss of the member numbered <var>i</var> is the member numbered <var>A_i</var>. For each member, find how many immediate subordinates it has.

Constraints

<var>2 \leq N \leq 2 \times 10^5</var>

<var>1 \leq A_i < i</var>

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>A_2</var> <var>...</var> <var>A_N</var>

Output

For each of the members numbered <var>1, 2, ..., N</var>, print the number of immediate subordinates it has, in its own line.

Sample Input 1

5
1 1 2 2

Sample Output 1

2
2
0
0
0

The member numbered <var>1</var> has two immediate subordinates: the members numbered <var>2</var> and <var>3</var>.

The member numbered <var>2</var> has two immediate subordinates: the members numbered <var>4</var> and <var>5</var>.

The members numbered <var>3</var>, <var>4</var>, and <var>5</var> do not have immediate subordinates.

Sample Input 2

10
1 1 1 1 1 1 1 1 1

Sample Output 2

9
0
0
0
0
0
0
0
0
0

Sample Input 3

7
1 2 3 4 5 6

Sample Output 3

1
1
1
1
1
1
0


Score : <var>100</var> points

Problem Statement

In some other world, today is December <var>D</var>-th.

Write a program that prints Christmas if <var>D = 25</var>, Christmas Eve if <var>D = 24</var>, Christmas Eve Eve if <var>D = 23</var> and Christmas Eve Eve Eve if <var>D = 22</var>.

Constraints

<var>22 \leq D \leq 25</var>

<var>D</var> is an integer.

Input

Input is given from Standard Input in the following format:

<var>D</var>

Output

Print the specified string (case-sensitive).

Sample Input 1

25

Sample Output 1

Christmas

Sample Input 2

22

Sample Output 2

Christmas Eve Eve Eve

Be sure to print spaces between the words.


Score : <var>100</var> points

Problem Statement

You are given three integers <var>A</var>, <var>B</var> and <var>C</var>.
Determine whether <var>C</var> is not less than <var>A</var> and not greater than <var>B</var>.

Constraints

<var>-100≤A,B,C≤100</var>

<var>A</var>, <var>B</var> and <var>C</var> are all integers.

Input

Input is given from Standard Input in the following format:

<var>A</var> <var>B</var> <var>C</var>

Output

If the condition is satisfied, print Yes; otherwise, print No.

Sample Input 1

1 3 2

Sample Output 1

Yes

<var>C=2</var> is not less than <var>A=1</var> and not greater than <var>B=3</var>, and thus the output should be Yes.

Sample Input 2

6 5 4

Sample Output 2

No

<var>C=4</var> is less than <var>A=6</var>, and thus the output should be No.

Sample Input 3

2 2 2

Sample Output 3

Yes


Score : <var>100</var> points

Problem Statement

We have <var>N+M</var> balls, each of which has an integer written on it.

It is known that:

The numbers written on <var>N</var> of the balls are even.

The numbers written on <var>M</var> of the balls are odd.

Find the number of ways to choose two of the <var>N+M</var> balls (disregarding order) so that the sum of the numbers written on them is even.

It can be shown that this count does not depend on the actual values written on the balls.

Constraints

<var>0 \leq N,M \leq 100</var>

<var>2 \leq N+M</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>N</var> <var>M</var>

Output

Print the answer.

Sample Input 1

2 1

Sample Output 1

1

For example, let us assume that the numbers written on the three balls are <var>1,2,4</var>.

If we choose the two balls with <var>1</var> and <var>2</var>, the sum is odd;

If we choose the two balls with <var>1</var> and <var>4</var>, the sum is odd;

If we choose the two balls with <var>2</var> and <var>4</var>, the sum is even.

Thus, the answer is <var>1</var>.

Sample Input 2

4 3

Sample Output 2

9

Sample Input 3

1 1

Sample Output 3

0

Sample Input 4

13 3

Sample Output 4

81

Sample Input 5

0 3

Sample Output 5

3


Score: <var>300</var> points

Problem Statement

In 2028 and after a continuous growth, AtCoder Inc. finally built an empire with six cities (City <var>1, 2, 3, 4, 5, 6</var>)!

There are five means of transport in this empire:

Train: travels from City <var>1</var> to <var>2</var> in one minute. A train can occupy at most <var>A</var> people.

Bus: travels from City <var>2</var> to <var>3</var> in one minute. A bus can occupy at most <var>B</var> people.

Taxi: travels from City <var>3</var> to <var>4</var> in one minute. A taxi can occupy at most <var>C</var> people.

Airplane: travels from City <var>4</var> to <var>5</var> in one minute. An airplane can occupy at most <var>D</var> people.

Ship: travels from City <var>5</var> to <var>6</var> in one minute. A ship can occupy at most <var>E</var> people.

For each of them, one vehicle leaves the city at each integer time (time <var>0</var>, <var>1</var>, <var>2</var>, <var>...</var>).

There is a group of <var>N</var> people at City <var>1</var>, and they all want to go to City <var>6</var>.

At least how long does it take for all of them to reach there?
You can ignore the time needed to transfer.

Constraints

<var>1 \leq N, A, B, C, D, E \leq 10^{15}</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>A</var>
<var>B</var>
<var>C</var>
<var>D</var>
<var>E</var>

Output

Print the minimum time required for all of the people to reach City <var>6</var>, in minutes.

Sample Input 1

5
3
2
4
3
5

Sample Output 1

7

One possible way to travel is as follows.
First, there are <var>N = 5</var> people at City <var>1</var>, as shown in the following image:

In the first minute, three people travels from City <var>1</var> to City <var>2</var> by train. Note that a train can only occupy at most three people.

In the second minute, the remaining two people travels from City <var>1</var> to City <var>2</var> by train, and two of the three people who were already at City <var>2</var> travels to City <var>3</var> by bus. Note that a bus can only occupy at most two people.

In the third minute, two people travels from City <var>2</var> to City <var>3</var> by train, and another two people travels from City <var>3</var> to City <var>4</var> by taxi.

From then on, if they continue traveling without stopping until they reach City <var>6</var>, all of them can reach there in seven minutes.

There is no way for them to reach City <var>6</var> in <var>6</var> minutes or less.

Sample Input 2

10
123
123
123
123
123

Sample Output 2

5

All kinds of vehicles can occupy <var>N = 10</var> people at a time.
Thus, if they continue traveling without stopping until they reach City <var>6</var>, all of them can reach there in five minutes.

Sample Input 3

10000000007
2
3
5
7
11

Sample Output 3

5000000008

Note that the input or output may not fit into a <var>32</var>-bit integer type.


Score : <var>400</var> points

Problem Statement

We have a tree with <var>N</var> vertices numbered <var>1</var> to <var>N</var>.
The <var>i</var>-th edge in the tree connects Vertex <var>u_i</var> and Vertex <var>v_i</var>, and its length is <var>w_i</var>.
Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied:

For any two vertices painted in the same color, the distance between them is an even number.

Find a coloring of the vertices that satisfies the condition and print it. It can be proved that at least one such coloring exists under the constraints of this problem.

Constraints

All values in input are integers.

<var>1 \leq N \leq 10^5</var>

<var>1 \leq u_i < v_i \leq N</var>

<var>1 \leq w_i \leq 10^9</var>

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>u_1</var> <var>v_1</var> <var>w_1</var>
<var>u_2</var> <var>v_2</var> <var>w_2</var>
<var>.</var>
<var>.</var>
<var>.</var>
<var>u_{N - 1}</var> <var>v_{N - 1}</var> <var>w_{N - 1}</var>

Output

Print a coloring of the vertices that satisfies the condition, in <var>N</var> lines.
The <var>i</var>-th line should contain 0 if Vertex <var>i</var> is painted white and 1 if it is painted black.

If there are multiple colorings that satisfy the condition, any of them will be accepted.

Sample Input 1

3
1 2 2
2 3 1

Sample Output 1

0
0
1

Sample Input 2

5
2 5 2
2 3 10
1 3 8
3 4 2

Sample Output 2

1
0
1
0
1


Score: <var>300</var> points

Problem Statement

Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.

A game is played by <var>N</var> players, numbered <var>1</var> to <var>N</var>. At the beginning of a game, each player has <var>K</var> points.

When a player correctly answers a question, each of the other <var>N-1</var> players receives minus one (<var>-1</var>) point. There is no other factor that affects the players' scores.

At the end of a game, the players with <var>0</var> points or lower are eliminated, and the remaining players survive.

In the last game, the players gave a total of <var>Q</var> correct answers, the <var>i</var>-th of which was given by Player <var>A_i</var>.
For Kizahashi, write a program that determines whether each of the <var>N</var> players survived this game.

Constraints

All values in input are integers.

<var>2 \leq N \leq 10^5</var>

<var>1 \leq K \leq 10^9</var>

<var>1 \leq Q \leq 10^5</var>

<var>1 \leq A_i \leq N\ (1 \leq i \leq Q)</var>

Input

Input is given from Standard Input in the following format:

<var>N</var> <var>K</var> <var>Q</var>
<var>A_1</var>
<var>A_2</var>
<var>.</var>
<var>.</var>
<var>.</var>
<var>A_Q</var>

Output

Print <var>N</var> lines. The <var>i</var>-th line should contain Yes if Player <var>i</var> survived the game, and No otherwise.

Sample Input 1

6 3 4
3
1
3
2

Sample Output 1

No
No
Yes
No
No
No

In the beginning, the players' scores are <var>(3, 3, 3, 3, 3, 3)</var>.

Player <var>3</var> correctly answers a question. The players' scores are now <var>(2, 2, 3, 2, 2, 2)</var>.

Player <var>1</var> correctly answers a question. The players' scores are now <var>(2, 1, 2, 1, 1, 1)</var>.

Player <var>3</var> correctly answers a question. The players' scores are now <var>(1, 0, 2, 0, 0, 0)</var>.

Player <var>2</var> correctly answers a question. The players' scores are now <var>(0, 0, 1, -1, -1, -1)</var>.

Players <var>1, 2, 4, 5</var> and <var>6</var>, who have <var>0</var> points or lower, are eliminated, and Player <var>3</var> survives this game.

Sample Input 2

6 5 4
3
1
3
2

Sample Output 2

Yes
Yes
Yes
Yes
Yes
Yes

Sample Input 3

10 13 15
3
1
4
1
5
9
2
6
5
3
5
8
9
7
9

Sample Output 3

No
No
No
No
Yes
No
No
No
Yes
No


Score : <var>100</var> points

Problem Statement

The window of Takahashi's room has a width of <var>A</var>. There are two curtains hung over the window, each of which has a horizontal length of <var>B</var>. (Vertically, the curtains are long enough to cover the whole window.)

We will close the window so as to minimize the total horizontal length of the uncovered part of the window.
Find the total horizontal length of the uncovered parts of the window then.

Constraints

<var>1 \leq A \leq 100</var>

<var>1 \leq B \leq 100</var>

<var>A</var> and <var>B</var> are integers.

Input

Input is given from Standard Input in the following format:

<var>A</var> <var>B</var>

Output

Print the total horizontal length of the uncovered parts of the window.

Sample Input 1

12 4

Sample Output 1

4

We have a window with a horizontal length of <var>12</var>, and two curtains, each of length <var>4</var>, that cover both ends of the window, for example. The uncovered part has a horizontal length of <var>4</var>.

Sample Input 2

20 15

Sample Output 2

0

If the window is completely covered, print <var>0</var>.

Sample Input 3

20 30

Sample Output 3

0

Each curtain may be longer than the window.


Score : <var>100</var> points

Problem Statement

You are given three integers, <var>A</var>, <var>B</var> and <var>C</var>.

Among them, two are the same, but the remaining one is different from the rest.

For example, when <var>A=5,B=7,C=5</var>, <var>A</var> and <var>C</var> are the same, but <var>B</var> is different.

Find the one that is different from the rest among the given three integers.

Constraints

<var>-100 \leq A,B,C \leq 100</var>

<var>A</var>, <var>B</var> and <var>C</var> are integers.

The input satisfies the condition in the statement.

Input

Input is given from Standard Input in the following format:

<var>A</var> <var>B</var> <var>C</var>

Output

Among <var>A</var>, <var>B</var> and <var>C</var>, print the integer that is different from the rest.

Sample Input 1

5 7 5

Sample Output 1

7

This is the same case as the one in the statement.

Sample Input 2

1 1 7

Sample Output 2

7

In this case, <var>C</var> is the one we seek.

Sample Input 3

-100 100 100

Sample Output 3

-100


Score : <var>200</var> points

Problem Statement

Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes:

Red boxes, each containing <var>R</var> red balls

Green boxes, each containing <var>G</var> green balls

Blue boxes, each containing <var>B</var> blue balls

Snuke wants to get a total of exactly <var>N</var> balls by buying <var>r</var> red boxes, <var>g</var> green boxes and <var>b</var> blue boxes.
How many triples of non-negative integers <var>(r,g,b)</var> achieve this?

Constraints

All values in input are integers.

<var>1 \leq R,G,B,N \leq 3000</var>

Input

Input is given from Standard Input in the following format:

<var>R</var> <var>G</var> <var>B</var> <var>N</var>

Output

Print the answer.

Sample Input 1

1 2 3 4

Sample Output 1

4

Four triples achieve the objective, as follows:

<var>(4,0,0)</var>

<var>(2,1,0)</var>

<var>(1,0,1)</var>

<var>(0,2,0)</var>

Sample Input 2

13 1 4 3000

Sample Output 2

87058


Score : <var>100</var> points

Problem Statement

How many multiples of <var>d</var> are there among the integers between <var>L</var> and <var>R</var> (inclusive)?

Constraints

All values in input are integers.

<var>1 \leq L \leq R \leq 100</var>

<var>1 \leq d \leq 100</var>

Input

Input is given from Standard Input in the following format:

<var>L</var> <var>R</var> <var>d</var>

Output

Print the number of multiples of <var>d</var> among the integers between <var>L</var> and <var>R</var> (inclusive).

Sample Input 1

5 10 2

Sample Output 1

3

Among the integers between <var>5</var> and <var>10</var>, there are three multiples of <var>2</var>: <var>6</var>, <var>8</var>, and <var>10</var>.

Sample Input 2

6 20 7

Sample Output 2

2

Among the integers between <var>6</var> and <var>20</var>, there are two multiples of <var>7</var>: <var>7</var> and <var>14</var>.

Sample Input 3

1 100 1

Sample Output 3

100


Score : <var>100</var> points

Problem Statement

It is known that the area of a regular dodecagon inscribed in a circle of radius <var>a</var> is <var>3a^2</var>.

Given an integer <var>r</var>, find the area of a regular dodecagon inscribed in a circle of radius <var>r</var>.

Constraints

<var>1 \leq r \leq 100</var>

<var>r</var> is an integer.

Input

Input is given from Standard Input in the following format:

<var>r</var>

Output

Print an integer representing the area of the regular dodecagon.

Sample Input 1

4

Sample Output 1

48

The area of the regular dodecagon is <var>3 \times 4^2 = 48</var>.

Sample Input 2

15

Sample Output 2

675

Sample Input 3

80

Sample Output 3

19200


Score : <var>300</var> points

Problem Statement

There are <var>N</var> balls in a two-dimensional plane. The <var>i</var>-th ball is at coordinates <var>(x_i, y_i)</var>.

We will collect all of these balls, by choosing two integers <var>p</var> and <var>q</var> such that <var>p \neq 0</var> or <var>q \neq 0</var> and then repeating the following operation:

Choose a ball remaining in the plane and collect it. Let <var>(a, b)</var> be the coordinates of this ball. If we collected a ball at coordinates <var>(a - p, b - q)</var> in the previous operation, the cost of this operation is <var>0</var>. Otherwise, including when this is the first time to do this operation, the cost of this operation is <var>1</var>.

Find the minimum total cost required to collect all the balls when we optimally choose <var>p</var> and <var>q</var>.

Constraints

<var>1 \leq N \leq 50</var>

<var>|x_i|, |y_i| \leq 10^9</var>

If <var>i \neq j</var>, <var>x_i \neq x_j</var> or <var>y_i \neq y_j</var>.

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>x_1</var> <var>y_1</var>
<var>:</var>
<var>x_N</var> <var>y_N</var>

Output

Print the minimum total cost required to collect all the balls.

Sample Input 1

2
1 1
2 2

Sample Output 1

1

If we choose <var>p = 1, q = 1</var>, we can collect all the balls at a cost of <var>1</var> by collecting them in the order <var>(1, 1)</var>, <var>(2, 2)</var>.

Sample Input 2

3
1 4
4 6
7 8

Sample Output 2

1

If we choose <var>p = -3, q = -2</var>, we can collect all the balls at a cost of <var>1</var> by collecting them in the order <var>(7, 8)</var>, <var>(4, 6)</var>, <var>(1, 4)</var>.

Sample Input 3

4
1 1
1 2
2 1
2 2

Sample Output 3

2


Score : <var>200</var> points

Problem Statement

Given are integers <var>a,b,c</var> and <var>d</var>.
If <var>x</var> and <var>y</var> are integers and <var>a \leq x \leq b</var> and <var>c\leq y \leq d</var> hold, what is the maximum possible value of <var>x \times y</var>?

Constraints

<var>-10^9 \leq a \leq b \leq 10^9</var>

<var>-10^9 \leq c \leq d \leq 10^9</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>a</var> <var>b</var> <var>c</var> <var>d</var>

Output

Print the answer.

Sample Input 1

1 2 1 1

Sample Output 1

2

If <var>x = 1</var> and <var>y = 1</var> then <var>x \times y = 1</var>.
If <var>x = 2</var> and <var>y = 1</var> then <var>x \times y = 2</var>.
Therefore, the answer is <var>2</var>.

Sample Input 2

3 5 -4 -2

Sample Output 2

-6

The answer can be negative.

Sample Input 3

-1000000000 0 -1000000000 0

Sample Output 3

1000000000000000000


Score: <var>400</var> points

Problem Statement

Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.

Let the current time be time <var>0</var>. Kizahashi has <var>N</var> jobs numbered <var>1</var> to <var>N</var>.

It takes <var>A_i</var> units of time for Kizahashi to complete Job <var>i</var>. The deadline for Job <var>i</var> is time <var>B_i</var>, and he must complete the job before or at this time.

Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.

Can Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.

Constraints

All values in input are integers.

<var>1 \leq N \leq 2 \times 10^5</var>

<var>1 \leq A_i, B_i \leq 10^9 (1 \leq i \leq N)</var>

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>A_1</var> <var>B_1</var>
<var>.</var>
<var>.</var>
<var>.</var>
<var>A_N</var> <var>B_N</var>

Output

If Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.

Sample Input 1

5
2 4
1 9
1 8
4 9
3 12

Sample Output 1

Yes

He can complete all the jobs in time by, for example, doing them in the following order:

Do Job <var>2</var> from time <var>0</var> to <var>1</var>.

Do Job <var>1</var> from time <var>1</var> to <var>3</var>.

Do Job <var>4</var> from time <var>3</var> to <var>7</var>.

Do Job <var>3</var> from time <var>7</var> to <var>8</var>.

Do Job <var>5</var> from time <var>8</var> to <var>11</var>.

Note that it is fine to complete Job <var>3</var> exactly at the deadline, time <var>8</var>.

Sample Input 2

3
334 1000
334 1000
334 1000

Sample Output 2

No

He cannot complete all the jobs in time, no matter what order he does them in.

Sample Input 3

30
384 8895
1725 9791
170 1024
4 11105
2 6
578 1815
702 3352
143 5141
1420 6980
24 1602
849 999
76 7586
85 5570
444 4991
719 11090
470 10708
1137 4547
455 9003
110 9901
15 8578
368 3692
104 1286
3 4
366 12143
7 6649
610 2374
152 7324
4 7042
292 11386
334 5720

Sample Output 3

Yes


Score : <var>100</var> points

Problem Statement

You are given three words <var>s_1</var>, <var>s_2</var> and <var>s_3</var>, each composed of lowercase English letters, with spaces in between.
Print the acronym formed from the uppercased initial letters of the words.

Constraints

<var>s_1</var>, <var>s_2</var> and <var>s_3</var> are composed of lowercase English letters.

<var>1 ≤ |s_i| ≤ 10 (1≤i≤3)</var>

Input

Input is given from Standard Input in the following format:

<var>s_1</var> <var>s_2</var> <var>s_3</var>

Output

Print the answer.

Sample Input 1

atcoder beginner contest

Sample Output 1

ABC

The initial letters of atcoder, beginner and contest are a, b and c. Uppercase and concatenate them to obtain ABC.

Sample Input 2

resident register number

Sample Output 2

RRN

Sample Input 3

k nearest neighbor

Sample Output 3

KNN

Sample Input 4

async layered coding

Sample Output 4

ALC


Score : <var>200</var> points

Problem Statement

In Japan, people make offerings called hina arare, colorful crackers, on March <var>3</var>.

We have a bag that contains <var>N</var> hina arare. (From here, we call them arare.)

It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow.

We have taken out the arare in the bag one by one, and the color of the <var>i</var>-th arare was <var>S_i</var>, where colors are represented as follows - pink: P, white: W, green: G, yellow: Y.

If the number of colors of the arare in the bag was three, print Three; if the number of colors was four, print Four.

Constraints

<var>1 \leq N \leq 100</var>

<var>S_i</var> is P, W, G or Y.

There always exist <var>i</var>, <var>j</var> and <var>k</var> such that <var>S_i=</var>P, <var>S_j=</var>W and <var>S_k=</var>G.

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>S_1</var> <var>S_2</var> <var>...</var> <var>S_N</var>

Output

If the number of colors of the arare in the bag was three, print Three; if the number of colors was four, print Four.

Sample Input 1

6
G W Y P Y W

Sample Output 1

Four

The bag contained arare in four colors, so you should print Four.

Sample Input 2

9
G W W G P W P G G

Sample Output 2

Three

The bag contained arare in three colors, so you should print Three.

Sample Input 3

8
P Y W G Y W Y Y

Sample Output 3

Four