UTPC Spring 2023 Contest (HS)
A. Dojo Duel
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Yuji and his friends are having a jujutsu duel at the dojo. To be able to come up with a fair tournament style, their instructor Satoru has decided to use a ranking system that takes various factors into account such as kicking skill, magic skill, speed, and of course demon slaying skill.

Satoru has a list of all of the students at the dojo, though it is not sorted according to any particular criteria. He would like it to be such that the students are sorted in descending order of demon slaying skill, with ties broken by descending order of magic skill, ties then being broken by descending order of kicking skill, and then ties being broken by descending order of speed, and finally if there are still ties, to break those by ascending lexicographical order of name.

Unfortunately, Satoru's list of students is quite long and he, being a busy jujutsu teacher, has employed your help to sort the list of students according to the above process. Given their stats and names, can you help Satoru out by reporting the names of the students in sorted order?

Input

The input will begin with an integer $$$N$$$ ($$$1 \leq N \leq 100$$$) denoting the number of students at the dojo. The next $$$n$$$ lines will each contain a description of a student in the form $$$n, k, m, s, d$$$ ($$$1 \leq |n|, k, m, s, d \leq 100$$$) representing their name, kicking skill, magic skill, speed, and demon slaying skill respectively.

It is guaranteed that each student's name consists of only lowercase English letters and that all student names are unique.

Output

The output should consist of $$$N$$$ lines, the names of the students in sorted order.

Example
Input
4
ryomen 20 20 20 20
suguru 30 10 40 50
maki 10 10 90 90
nobara 70 60 50 40
Output
maki
suguru
nobara
ryomen

B. Snack Time
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

Umaru's older brother Taihei is off to work again, which means it is time for her to sit back, relax, play some video games, and enjoy delicious snacks including potato chips and cola. Taihei has been trying to teach Umaru the importance of sharing, so to put this into practice, she will be buying bags of chips to distribute to her friends.

The town Umaru lives in can be modeled as a set of $$$N$$$ houses and $$$N - 1$$$ roads such that there is a unique simple (no edges or nodes reused) path between any two houses. Additionally, Umaru has $$$a_i$$$ friends that live in the $$$i$$$-th house. Taihei will be gone for $$$Q$$$ hours, so Umaru plans to go on at most $$$Q$$$ "snack runs". At the $$$i$$$-th point in time (for each $$$i$$$ at most $$$Q$$$), one of two things may happen. The first possibility is that Umaru will go on a snack run. If so, Umaru travels from house $$$u_i$$$ to house $$$v_i$$$ and gives snacks to her friends along the way. If not, she tells her friends to gather at a particular house $$$w_i$$$, in which case the number of friends that live at house $$$w_i$$$ becomes multiplied by a factor of $$$f_i$$$ (these friends come from out of town, friends never leave their houses).

Umaru is having trouble figuring out how many snacks to bring with her on each snack run. Being lazy, she wants to bring the smallest positive integer number of snacks that will be evenly divisible by the number of people in each of the houses that she visits along the way (including her starting city and destination). Given information regarding each of her snack runs, can you help her figure out how many snacks to bring?

Input

The input will begin with two integers, $$$N$$$ and $$$Q$$$ ($$$1 \leq N, Q \leq 10^3$$$), the number of houses and the number of snack runs, respectively.

The next line will contain $$$N$$$ integers, the $$$i$$$-th of which represents $$$a_i$$$ ($$$1 \leq a_i \leq 10^7$$$), the number of friends of Umaru who live in the $$$i$$$-th house.

The $$$i$$$-th of each of the next $$$N - 1$$$ lines will each contain two integers, $$$u_i$$$ and $$$v_i$$$ ($$$1 \leq u_i, v_i, \leq N, u_i \neq v_i$$$), meaning that houses $$$u_i$$$ and $$$v_i$$$ are connected by a (bidirectional) road.

The $$$i$$$th of each of the final $$$Q$$$ lines will each contain three integers, either a 1 followed by $$$u_i$$$ and $$$v_i$$$ ($$$1 \leq u_i, v_i \leq N$$$), denoting that the $$$i$$$-th snack run is between houses $$$u_i$$$ and $$$v_i$$$, or a 2 followed by $$$w_i$$$ and $$$f_i$$$ ($$$1 \leq w_i \leq N, 1 \leq f_i \leq 10^7$$$). It is guaranteed that there will be at least one type 1 snack run in the input.

Output

The output should consist of as many lines as there are type 1 snack runs, the $$$i$$$-th of which denotes the minimum positive integer number of snacks that Umaru can bring from house $$$u_i$$$ to $$$v_i$$$ such that the number of snacks is divisible by the number of people living in each of the houses in the unique simple path from house $$$u_i$$$ to house $$$v_i$$$. Note that, since the answers may be quite large, print them modulo $$$10^9+7$$$.

Example
Input
6 3
1 6 5 3 4 3
1 2
1 3
1 4
2 5
4 6
1 1 5
2 2 4
1 1 2
Output
12
24
Note

For the first snack run, the houses along the way are 1, 2, and 5 which house 1, 6, and 4 people, respectively. The smallest positive integer which is divisible by 1, 6, and 4 is 12.

For the second snack run, the number of friends that live at house 2 is multiplied by a factor of 4, so now 24 friends of Umaru's live at house 2.

For the third snack run, the houses along the way are 1 and 2 which house 1 and 24 people, respectively. The smallest positive integer which is divisible by 1 and 24 is 24.

C. Milk Cow
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Bessie the cow has been kidnapped from Farmer John's farm by the Satellite Girl. She is currently being pulled up to the satellite by a tractor beam which has flipped her upside down. Can you create an artist's depiction of what Bessie currently looks like?

Note that an upside down "^" looks like a "v", an upside down "/" looks like a "\", an upside down "\" looks like a "/", and all other characters are left unchanged. Note that Bessie is entirely upside down, so not only must the characters be flipped as mentioned, but the lines should be output in reverse order as well.

Input

The sample input will be the reference picture of Bessie as seen above (right-side up).

Output

The output should consist of your artist's depiction of Bessie upside down based on the reference image above (and here for your convenience).

D. Love is War
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Kaguya has been texting Shirogane a lot recently, but is unsure what his feelings for her are. Can you help analyze Kaguya's text messages to figure out what's going on?

Specifically, Kaguya is convinced that love is war, and that relationships are only built through strategically planned battles. However, in some of her recent texts, she is unsure if some of they have been friendly conversation, or a battle in disguise. For a text message to be a battle, it must contain some yelling — that is, a sequence of 3 or more consecutive 'a's, which can be capitalized in any way.

Help Kaguya identify these hidden battles so she can win the war!

Input

The first line contains a single integer, $$$n$$$, corresponding to the number of text messages to analyze. Then, $$$n$$$ lines follow, with each line containing a text message.

Text messages are at most 100 characters long, but can contain spaces.

Output

For each line of the input, output "Love is war!" if the line corresponds to an argument. Otherwise, output "Just friends <3"

Example
Input
5
How are you doing Kaguya?
THIS MEANS WAAAAAARRRRRRRRRR
oops sorry wrong person
LlLmmAAaOoo that's soooo funnnyyy
what is a aardvark
Output
Just friends <3
Love is war!
Just friends <3
Love is war!
Just friends <3

E. Attack on Titans
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

In Attack on Titans, humanity lives in fear of giant humanoid creatures called Titans. In order to defend themselves, the humans built three walls: Wall Maria, Wall Rose, and Wall Sina. Wall Maria is made up of $$$n$$$ separate sections, with the $$$i$$$th section having height $$$m_i$$$. Wall Rose and Wall Sina also have $$$n$$$ sections each, with heights $$$r_i$$$ and $$$s_i$$$ respectively.

Find the tallest section height common to all three walls: the maximum value of $$$h$$$ with $$$h = m_i = r_j = s_k$$$ for some indices $$$1 \leq i,j,k \leq n$$$. Note that for a height $$$h$$$ to be common to all three walls, each wall must have a section of height $$$h$$$, but these sections are not required to be at the same position on all three walls.

Input

The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$), the number of sections in each wall. The second, third, and fourth lines each contain $$$n$$$ space-separated integers: the second line lists the heights $$$m_i$$$ of the sections in Wall Maria, the third the heights $$$r_i$$$, and the fourth the $$$s_i$$$. Each height satisfies ($$$1 \leq m_i, r_i, s_i \leq 10^5$$$).

Output

Print a single integer: the tallest section height common to all three walls. If there is no section height common to all three walls, print $$$-1$$$ instead.

Example
Input
5
1 2 3 8 5
5 6 7 8 9
8 12 14 19 12
Output
8

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

Ashley Ketchup is training to be the best dragon collector in the world, and she needs your help.

Whenever she collects a dragon, she keeps them in a small, spherical habitat, known as a "Dragon Ball". Ashley has many of these dragon balls, but she wants to make sure that the dragons she puts in there are always happy. Dragons come in all shapes and sizes, and can be easily intimidated by other dragons. Ashley wants to keep track of the dragons as she adds more to her collection and make sure they are always doing ok. Can you help Ashley?

Input

The first line contains a single integer, $$$t$$$ ($$$1 \leq t \leq 100$$$), representing the number of actions that Ashley performs.

Then, $$$n$$$ lines follow, which will be in one of the following forms:

  • $$$\text{add [habitat_name] [dragon_name] [dragon_size]}$$$: Ashley adds a dragon to the specified habitat. Initially, all habitats are empty.
  • $$$\text{ask [habitat_name]}$$$: Ashley wants to know the smallest and largest dragon in the habitat. It is guaranteed that the specified habitat will have at least one dragon.
All names will only contain lowercase English letters. All dragons have distinct names and sizes, which are positive integers at most $$$100$$$.
Output

Each time Ashley asks about a habitat, output the name of the smallest dragon, and the name of the largest dragon, in that order.

Example
Input
9
add garden saladmander 5
add garden leekachu 6
add mountain coldasaur 8
ask garden
ask mountain
add garden myrtle 2
add lake fishy 3
ask garden
ask lake
Output
saladmander leekachu
coldasaur coldasaur
myrtle leekachu
fishy fishy

G. Anime Trading
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

It's Fantastic Friday, so Izuku Midoriya goes to the local anime trading card dealership to explore the latest releases. He is currently trying to collect the entire "Plus Ultra" card set of anime characters. Unfortunately for him, he does not know how many characters are in this set. He does, however, see that each character has a unique "quirk number."

He has brought his own collection containing $$$N$$$ cards, some of which may be duplicates. His goal is to collect one of each character in a contiguous run of quirk numbers starting at $$$1$$$. More formally, he would like to collect exactly one card each with quirk number $$$1, 2, 3, \ldots K$$$ for some positive integer $$$K$$$. He does not want any duplicates or any extra character cards whose quirk numbers are not part of the contiguous run: this would ruin the collection.

Midoriya cannot bring himself to simply throw a card away; however the card dealership will allow him to trade in any character card he owns for any other card of his choice for $$$A$$$ yen. Midoriya can also buy any character card of his choice outright for $$$B$$$ yen. (It's possible that $$$A \gt B$$$: the card dealer loves anime, but may not be great at economics.) The shop has an unlimited supply of cards of every quirk number. In order to satisfy his wish of possessing a contiguous run of quirk numbers, what is the minimum amount of money Izuku Midoriya needs to spend?

Input

The first line contains three space-separated integers $$$N$$$, $$$A$$$, and $$$B$$$ $$$(1 \leq N, A, B \leq 10^5)$$$.

The second line contains $$$N$$$ space-separated integers $$$c_i$$$ $$$(1 \leq c_i \leq 10^6)$$$, the quirk numbers of the cards that Midoriya already owns. Note that this list could contain duplicate quirk numbers.

Output

Print a single integer: the minimum amount of yen Izuku Midoriya needs to pay so that the quirk numbers in his collection form a contiguous run $$$1, 2, \ldots, K$$$ for some $$$K$$$.

Examples
Input
5 3 5
1 7 5 10 5
Output
9
Input
4 100 5
1 7 5 10
Output
30
Input
4 100 5
1 7 5 1000
Output
115
Note

In the first test case, he can trade in the card with quirk number $$$7$$$ for a new card with quirk number $$$2$$$; similarly he can trade $$$5$$$ for $$$3$$$ and $$$10$$$ for $$$4$$$. In this way he will have cards with quirk numbers $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, and $$$5$$$. These trades cost him $$$3*3 = 9$$$ yen.

In the second test case, he can buy all of the cards with quirk numbers $$$1$$$–$$$10$$$, excluding $$$1$$$, $$$5$$$, $$$7$$$, and $$$10$$$ which he already owns. This costs him $$$6*5 = 30$$$ yen.

In the third test case, he can trade in the card with quirk number $$$1000$$$ for quirk number $$$6$$$ and then buy the characters with quirk numbers $$$2$$$, $$$3$$$, and $$$4$$$. This costs him a total of $$$100+5*3 = 115$$$ yen.

H. My Hero Photographia
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

My Hero Academia (you) has taken a break from saving my grades and has now decided to help me with my burgeoning photography hobby. I have taken an image with my camera, but there are a few problems with it. Please help me fix it.

Specifically, I will provide you with my image, represented as a matrix of $$$n \times m$$$ integers. The edges of the matrix "loop around", meaning that the left-most column is considered adjacent to the right-most column, and the top-most row is considered adjacent to the bottom-most row. To fully process the image, we will apply $$$k$$$ transformations sequentially on the image. These transformations will be of the following form (where +x is to the right, +y is up):

  • Blur: Given a pixel $$$(i, j)$$$ in the image, replace its value with the average (rounded down to the nearest integer) of its $$$3\times 3$$$ neighboring pixels in the input image (from the original unblurred image), with the edge pixels wrapping around to the opposite side of the image.
  • Shift x y: Shift each pixel by $$$x$$$ units horizontally in the +x (right) direction and $$$y$$$ units vertically in the +y direction (up), with the edge pixels wrapping around to the opposite side of the image.
  • Sharpen: Given a pixel $$$(i, j)$$$ in the image, if its value is larger than all of its $$$3\times 3$$$ neighboring pixels in the input image (excluding itself, of course), add $$$100$$$ to its value. If its value is less than the minimum value among its $$$3\times 3$$$ neighboring pixels (excluding itself, of course), subtract $$$100$$$ from its value. Again, the edge pixels should wrap around the opposite side of the image when determining neighbors.
  • Rotate CW: Rotate the image 90 degrees clockwise.
  • Rotate CCW: Rotate the image 90 degrees counter-clockwise.
  • Flip Horizontal: Flip the image across the y-axis.
  • Flip Vertical: Flip the image across the x-axis.

Given the image and a list of $$$k$$$ operations, please be My Hero Photographia and provide me with the final image.

Input

The first line of input contains two integers $$$n$$$ and $$$m$$$ $$$(3 \leq n, m \leq 100)$$$, the dimensions of the image. The following $$$n$$$ lines contain $$$m$$$ integers each (between $$$0$$$ and $$$100$$$ inclusive), representing the image.

The next line of input contains a single integer $$$k$$$ $$$(1 \leq k \leq 1000)$$$, the number of operations to be performed on the image. The following $$$k$$$ lines each contain a single operation to be performed on the image. Each operation is one of the following:

  • Blur
  • Shift x y ($$$-100 \leq x, y \leq 100$$$)
  • Sharpen
  • Rotate CW
  • Rotate CCW
  • Flip Horizontal
  • Flip Vertical
Output

After performing all operations, output the resulting image.

The image should be formatted as $$$n$$$ lines, each containing $$$m$$$ integers separated by spaces, or $$$m$$$ lines, each containing $$$n$$$ integers separated by spaces (depending on the rotation of the image.

Examples
Input
4 5
3 3 3 10 16
3 3 3 12 38
3 3 3 40 4
5 6 7 8 9
1
Blur
Output
9 4 6 11 11 
8 3 8 14 14 
8 4 9 13 13 
5 4 9 11 10 
Input
3 3
1 2 3
4 5 6
7 8 9
1
Shift 0 1
Output
4 5 6 
7 8 9 
1 2 3 
Input
3 3
1 2 3
4 5 6
7 8 9
1
Sharpen
Output
-99 2 3 
4 5 6 
7 8 109 
Input
3 4
1 2 3 4
5 6 7 8
9 10 11 12
2
Rotate CW
Flip Horizontal
Output
1 5 9 
2 6 10 
3 7 11 
4 8 12 

I. Square Jutsu!
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

After years of experimentation, Kakashi has come up with the "square"-jutsu, a powerful technique that strikes lightning onto a large square area of land. Kakashi happens to be testing his jutsu on a mountain, which can be modeled by an $$$N \times N$$$ grid.

Each cell at row $$$1\leq i\leq N$$$ and column $$$1\leq j\leq N$$$ on the mountain has an elevation $$$c_{i, j}$$$. For every cell $$$(i,j)$$$ it is guaranteed that $$$c_{i,j} \leq \min \left(c_{i+1, j}, \space c_{i, j+1}, \space c_{i+1, j+1}\right)$$$ (treating cells outside the $$$N\times N$$$ grid as having infinite elevation). It is also guaranteed that $$$c_{1, 1} = 0$$$.

Kakashi's jutsu is powerful, but limited: square-jutsu can strike any $$$k\times k$$$ square block of mountain cells, but only if the entire $$$k\times k$$$ block lies within the bounds of the mountain grid and only if every cell in the block has elevation within a certain range $$$[a, b]$$$ inclusive ($$$a \leq c_{i, j} \leq b$$$ for all cells $$$(i,j)$$$ in the target square). Given the elevation of every mountain cell and the elevation range allowed by his jutsu, Kakashi wants to know the number of cells in the largest possible square block his jutsu can hit.

Input

The first line of input contains 2 integers $$$N$$$ and $$$Q$$$ ($$$1 \leq N \leq 300, \space 1 \leq Q \leq 10^4$$$), the size of the grid and the number of test cases, respectively. Each test case uses the same mountain grid.

The next $$$N$$$ lines each contain $$$N$$$ space-separated integers. The $$$j$$$-th integer on the $$$i$$$-th line represents the elevation $$$c_{i, j}$$$ ($$$0 \leq c_{i, j} \leq N^2$$$).

The next $$$Q$$$ lines each specify one test case, and contain two space-separated integers $$$a$$$ and $$$b$$$ ($$$0 \leq a \leq b \lt N^2$$$), the minimum and maximum elevation that Kakashi's square-jutsu can hit.

Output

For each test case, print a line with one integer: the number of mountain cells in the largest square block of land that Kakashi's square-jutsu can strike. For each test case it is guaranteed that Kakashi can target at least one cell.

Examples
Input
5 5
0 1 2 3 4
0 1 2 4 4
0 2 3 5 6
1 3 3 5 6
1 4 4 6 7
6 7
4 4
0 6
3 4
5 7
Output
1
1
16
4
4
Input
10 5
0 0 0 0 0 0 1 2 3 3
1 1 1 1 1 1 2 2 3 4
1 2 2 2 2 2 3 3 3 4
2 2 2 2 2 2 3 3 3 5
2 2 2 3 3 3 3 3 3 6
3 3 3 3 3 3 4 5 5 7
4 4 4 4 5 5 6 6 6 7
4 4 5 5 5 5 7 7 7 8
5 5 6 6 6 6 8 8 9 9
5 5 6 6 6 6 8 8 10 11
4 6
2 3
3 11
3 6
2 5
Output
16
16
36
25
25
Input
4 1
0 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
0 15
Output
16

J. No Game No Life
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

To determine the fate of Immanity, Sora and Shiro are playing yet another game!

They are given a string $$$s$$$ of length $$$N$$$ consisting only of lowercase and uppercase English letters. The $$$i$$$th character in has an integer $$$a_i$$$ in the range $$$[1, 100]$$$.

Sora carefully constructs $$$M$$$ (not necessarily distinct) strings, also consisting only of lowercase and uppercase English letters.

Shiro then chooses a (possibly empty) subset of letters from the English alphabet. Let's denote this set as $$$S$$$.

Sora's score $$$k$$$ is calculated through the following process:

  • For all characters $$$c$$$ in $$$S$$$, replace all occurrences of $$$c$$$ in $$$s$$$ with a dot ('.'). Note that characters are being replaced, not removed. Denote the new string as $$$t$$$.
  • For each character $$$t_i$$$ in $$$t$$$, if $$$t_i$$$ is not equal to a dot, add $$$a_i$$$ to $$$k$$$.
  • Each time one of Sora's strings $$$r_i$$$ appears as a susbstring of $$$t$$$, subtract $$$c_i$$$ from $$$k$$$.

Since Shiro wants to beat Sora, she will choose a subset of characters that minimizes Sora's score. You must help her by finding the minimum possible value of Sora's final score, and to also print a string $$$t$$$ which produces this score.

Input

The first line of input consists of two integers $$$N$$$ and $$$M$$$. ($$$1 \leq M,M \leq 20$$$)

The next line contains the string $$$s$$$, which consists of $$$N$$$ characters from the set $$$\{a-h\}$$$.

The next line contains $$$N$$$ space-separated integers, corresponding to $$$a_1, a_2, ... a_N$$$. ($$$1 \leq a_i \leq 100$$$)

The last $$$M$$$ lines each contain a string $$$r_i$$$ and an integer $$$c_i$$$ ($$$1 \leq c_i \leq 100$$$). Each $$$r_i$$$ consists of characters from the set $$$\{a-z,A-Z\}$$$, and $$$1 \leq |r_i| \leq N$$$. Note that not all $$$r_i$$$ are guaranteed to be unique.

Output

The first line of output contains an integer which is the minimum possible score of a string.

The second line contains a string $$$t$$$ with minimum possible score. If there are multiple correct answers, output any of them.

Example
Input
5 3
abcdb
1 1 2 2 3
b 2
bc 1
ab 3
Output
-2
ab..b
Note

In the sample case, Sora gets a total of $$$1+1+3$$$ from the non dot letters in $$$t$$$. $$$b$$$ appears twice and $$$ab$$$ appears once, so his total score is $$$1+1+3-2-2-3 = -2$$$.

K. Monster-Slayer
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Saitama, the One-Punch Man, is on a mission to defeat a group of monsters in order to challenge the monster boss, Centichoro. The power level of each of the $$$i$$$ monsters is stored in an array, where $$$p_i$$$ denotes the power level of the monster at index $$$i.$$$ Saitama's goal is to defeat the most powerful group of monsters by finding the maximum sum of any contiguous subarray of monster strengths. If he does so, he will be able to fight against Centichoro to save humanity. Help Saitama calculate the sum of the power levels of the corresponding subarray!

Note: The subarray of $$$a$$$ is $$$a$$$ contiguous part of the array $$$a$$$, i.e. the array $$$a_i,a_{i+1}...,a_j$$$ for some $$$1 \leq i \leq j \leq n$$$.

Input

The first line contains a single integer, ($$$1 \leq n \leq 10^5$$$), denoting the number of monsters. The following line will contain $$$n$$$ integers denoting the power levels $$$p_i$$$ ($$$-10^9 \leq p_i \leq 10^9$$$) of each of the $$$n$$$ monsters in order.

Output

Output a single integer representing the sum of the power levels in the maximum subarray.

Example
Input
9
-2 10 -3 5 -2 1 2 6 -1
Output
19
Note

In the sample case, the contiguous subarray with the maximum sum is $$$[10, -3, 5, -2, 1, 2, 6]$$$, which has a sum of $$$19$$$. Therefore, Saitama needs to defeat this set of monsters to achieve his goal of challenging Centichoro.

L. 3 Reasons to Eat Potato Chips
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Light Yagami is once again playing games with the detective L. This time, L has invited Light to a fancy restaurant and has brought 3 piles of canned potato chips to the table; unknowingly, this happens to be one of Light's favorite snacks. While waiting for their order, the detective offers a game: Light and L will alternate between taking chips, where each person can take some number of chips $$$1 \leq c_i \leq p_i$$$ from one of the piles i (where $$$p_i$$$ is the number of chips in pile i), or take some number of chips $$$1 \leq c_i \leq \min\{p_i\}$$$ (where $$$\min\{p_i\}$$$ is the minimum amount of chips across all piles) from all three of the piles. Being a gentleman, L offers Light to go first. Is it possible for Light to take the last chip if both play optimally?

Input

The input consists of three integers $$$0 \leq a,b,c \leq 50$$$, denoting the number of chips in each pile.

Output

Please output, in one line, the case-insensitive characters "Yes" if Light can take the last chip or "No" if he cannot.

Examples
Input
0 0 0
Output
No
Input
0 0 1
Output
Yes
Input
1 2 3
Output
No