vgel/INTELLECT-2-RL-Dataset-Code-Only huggingface dataset:
The manager of the Japanese sweets shop Tomogurido in Aizuwakamatsu City is a very skillful craftsman, but he feels a little mood. The buns made by the manager are very delicious, but the size varies depending on the mood at that time.

The store manager's wife, who couldn't see it, came up with the idea of ​​packing buns of different sizes and weights in a bag for sale. If you pack the buns in a bag so that they have a certain weight, you can sell them at a fixed price even if they are different in size, and there is also a surprise that you do not know what kind of buns are in until you open it. It may be for sale. When it was put on the market under the name of "Dismembered Manju", a new idea became a hot topic and Tomokuri-do quickly became popular. However, there was a problem, and the number of "separate buns" that could be made changed depending on how the buns were put in the bag, which sometimes caused waste. When you came to Tomokuri-do as a part-time job, you decided to create a program to pack it in a bag without waste.

There are 9 types of buns weighing 1 to 9. When packing in a bag, pack so that the total weight of the buns is exactly 10. The combination of buns is 1 + 1 + 2 + 4 + 2 = 10 or 1 + 1 + 1 + 1 + 1 + 5 = 10, and you can use any number of buns of the same weight.

Enter the information on the number of buns to be made and the weight of the buns, and create a program that outputs the maximum number of "separate buns" that can be made.



input

Given multiple datasets. The end of the input is indicated by a single zero. Each dataset is given in the following format:


n
m1 m2 ... mn


The number of buns n (2 ≤ n ≤ 100) is given on the first line. The second line gives the weight mi (1 ≤ mi ≤ 9) for each bun.

The number of datasets does not exceed 100.

output

For each dataset, the maximum number of "disjoint buns" that could be packed is output on one line.

Example

Input

5
4 9 1 3 8
10
8 5 3 6 2 1 4 5 4 5
9
5 7 3 8 2 9 6 4 1
0


Output

1
4
4

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
It was the third month of remote learning, Nastya got sick of staying at dormitory, so she decided to return to her hometown. In order to make her trip more entertaining, one of Nastya's friend presented her an integer array a. 

Several hours after starting her journey home Nastya remembered about the present. To entertain herself she decided to check, are there four different indices x, y, z, w such that a_x + a_y = a_z + a_w.

Her train has already arrived the destination, but she still hasn't found the answer. Can you help her unravel the mystery?

Input

The first line contains the single integer n (4 ≤ n ≤ 200 000) — the size of the array.

The second line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 2.5 ⋅ 10^6).

Output

Print "YES" if there are such four indices, and "NO" otherwise.

If such indices exist, print these indices x, y, z and w (1 ≤ x, y, z, w ≤ n).

If there are multiple answers, print any of them.

Examples

Input


6
2 1 5 2 7 4


Output


YES
2 3 1 6 

Input


5
1 3 1 9 20


Output


NO

Note

In the first example a_2 + a_3 = 1 + 5 = 2 + 4 = a_1 + a_6. Note that there are other answer, for example, 2 3 4 6.

In the second example, we can't choose four indices. The answer 1 2 2 3 is wrong, because indices should be different, despite that a_1 + a_2 = 1 + 3 = 3 + 1 = a_2 + a_3

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
This is the performance edition of [this kata](https://www.codewars.com/kata/ulam-sequences). If you didn't do it yet, you should begin there.

---

The Ulam sequence U is defined by `u0=u`, `u1=v`, with the general term `u_n` for `n>2` given by the least integer expressible uniquely as the sum of two distinct earlier terms.  
In other words, the next number is always the smallest, unique sum of any two previous terms.

The first 10 terms of the sequence `U(u0=1, u1=2)` are `[1, 2, 3, 4, 6, 8, 11, 13, 16, 18]`.

* Here, the first term after the initial `1, 2` is obviously `3` since `3=1+2`.
* The next term is `4=1+3` (we don't have to worry about `4=2+2` since it is a sum of a single term instead of two distinct terms)
* `5` is not a member of the sequence since it is representable in two ways: `5=1+4=2+3`, but `6=2+4` is a member (since `3+3` isn't a valid calculation).

You'll have to write a code that creates an Ulam Sequence starting with `u0`, `u1` and containing `n` terms.

---

# ___The pitfall...___

While the passing solutions of the first version could have a time complexity of O(N^(3)) (or even O(N^(4))!!), with 20 tests up to 100 terms only, here you'll have to manage generation of sequences up to 1500 terms before time out.

___Inputs:___

* `u0` and `u1`: integers, greater than or equal to 1
* `n`: integer greater than 1, length of the returned list

___Configuration of the tests:___

```if:python
* 6 small fixed tests
* 20 random tests on small sequences (10 to 30 terms)
* 13 large random tests (1500 terms)
```
```if:ruby
* 6 small fixed tests
* 20 random tests on small sequences (10 to 30 terms)
* 16 large random tests (1500 terms)
```
```if:javascript,go
* 6 small fixed tests
* 40 random tests on small sequences (10 to 30 terms)
* 30 large random tests (2450 terms)
```

---

Description Reference: http://mathworld.wolfram.com/UlamSequence.html

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
Young Marin, now already a respectable star of Croatian cinematography, spends his free time looking out the window. Unfortunately for him, the same activity is also taken up by a few flies that have landed on his window and are looking into the distance. Marin immediately hurried to get his square racket for killing flies. At the same time, he wondered how many flies it is possible to kill in one shot. After trying to scare away the flies unsuccessfully for a few hours, he decided to ask for your help.

Marin has sent you a picture of his window, the dimensions being $R \times S$ pixels and has also told you the length of the side of the racket he uses to kill the flies, in pixels. Your task is to determine the maximal amount of flies that Marin could have killed in a single shot and mark one such shot in the picture.

-----Input-----
The first line of input contains three integers $R$, $S$ and $K$ ($3 \leq K \leq R$, $S \leq 100$) that denote the dimensions of Marin’s picture and the length of the side of the racket.

Each of the following $R$ lines contains $S$ characters that describe Marin’s picture. The picture’s pixels marked with ‘*’ denote the position of a fly, whereas all the other pixels are marked with ‘.’ and denote empty space. On his window, there is at least one fly that Marin can kill with his racket.

-----Output-----
The first line of output must contain the maximal number of flies Marin can kill in a single shot.

The folllowing $R$ lines must contain Marin’s picture, on it clearly marked a position of the racket that will ensure Marin kills as many flies as possible. The horizontal sides of the racket are denoted with a series of characters ‘-’ and the vertical ones with ‘|’, whereas angles are denoted with ‘+’. For a more detailed explanation, consult the sample tests.

Please note: Marin’s racket will affect only the flies located strictly inside the racket, and the racket must be located inside the window with all its parts. In other words, it is assumed that the flies located at the sides of the racket will have enough time to fly away.

-----Examples-----
Sample Input 1:
3 5 3
.....
.*.*.
.....
Sample Output 1:
1
+-+..
|*|*.
+-+..

Sample Input 2:
7 6 4
......
.*.*.*
......
.*.*..
..*...
..*...
*....*
Sample Output 2:
2
......
.*.*.*
+--+..
|*.|..
|.*|..
+--+..
*....*

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
Kevin and Nicky Sun have invented a new game called Lieges of Legendre. In this game, two players take turns modifying the game state with Kevin moving first. Initially, the game is set up so that there are n piles of cows, with the i-th pile containing a_{i} cows. During each player's turn, that player calls upon the power of Sunlight, and uses it to either:

  Remove a single cow from a chosen non-empty pile.  Choose a pile of cows with even size 2·x (x > 0), and replace it with k piles of x cows each. 

The player who removes the last cow wins. Given n, k, and a sequence a_1, a_2, ..., a_{n}, help Kevin and Nicky find the winner, given that both sides play in optimal way.


-----Input-----

The first line of the input contains two space-separated integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ 10^9).

The second line contains n integers, a_1, a_2, ... a_{n} (1 ≤ a_{i} ≤ 10^9) describing the initial state of the game. 


-----Output-----

Output the name of the winning player, either "Kevin" or "Nicky" (without quotes).


-----Examples-----
Input
2 1
3 4

Output
Kevin

Input
1 2
3

Output
Nicky



-----Note-----

In the second sample, Nicky can win in the following way: Kevin moves first and is forced to remove a cow, so the pile contains two cows after his move. Next, Nicky replaces this pile of size 2 with two piles of size 1. So the game state is now two piles of size 1. Kevin then removes one of the remaining cows and Nicky wins by removing the other.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
A girl named Sonya is studying in the scientific lyceum of the Kingdom of Kremland. The teacher of computer science (Sonya's favorite subject!) invented a task for her.

Given an array $a$ of length $n$, consisting only of the numbers $0$ and $1$, and the number $k$. Exactly $k$ times the following happens:   Two numbers $i$ and $j$ are chosen equiprobable such that ($1 \leq i < j \leq n$).  The numbers in the $i$ and $j$ positions are swapped. 

Sonya's task is to find the probability that after all the operations are completed, the $a$ array will be sorted in non-decreasing order. She turned to you for help. Help Sonya solve this problem.

It can be shown that the desired probability is either $0$ or it can be represented as $\dfrac{P}{Q}$, where $P$ and $Q$ are coprime integers and $Q \not\equiv 0~\pmod {10^9+7}$.


-----Input-----

The first line contains two integers $n$ and $k$ ($2 \leq n \leq 100, 1 \leq k \leq 10^9$) — the length of the array $a$ and the number of operations.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($0 \le a_i \le 1$) — the description of the array $a$.


-----Output-----

If the desired probability is $0$, print $0$, otherwise print the value $P \cdot Q^{-1}$ $\pmod {10^9+7}$, where $P$ and $Q$ are defined above.


-----Examples-----
Input
3 2
0 1 0

Output
333333336
Input
5 1
1 1 1 0 0

Output
0
Input
6 4
1 0 0 1 1 0

Output
968493834


-----Note-----

In the first example, all possible variants of the final array $a$, after applying exactly two operations: $(0, 1, 0)$, $(0, 0, 1)$, $(1, 0, 0)$, $(1, 0, 0)$, $(0, 1, 0)$, $(0, 0, 1)$, $(0, 0, 1)$, $(1, 0, 0)$, $(0, 1, 0)$. Therefore, the answer is $\dfrac{3}{9}=\dfrac{1}{3}$.

In the second example, the array will not be sorted in non-decreasing order after one operation, therefore the answer is $0$.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
Genos and Saitama went shopping for Christmas trees. However, a different type of tree caught their attention, the exalted Power Tree. 

A Power Tree starts out as a single root vertex indexed 1. A Power Tree grows through a magical phenomenon known as an update. In an update, a single vertex is added to the tree as a child of some other vertex.

Every vertex in the tree (the root and all the added vertices) has some value vi associated with it. The power of a vertex is defined as the strength of the multiset composed of the value associated with this vertex (vi) and the powers of its direct children. The strength of a multiset is defined as the sum of all elements in the multiset multiplied by the number of elements in it. Or in other words for some multiset S: 

<image>

Saitama knows the updates that will be performed on the tree, so he decided to test Genos by asking him queries about the tree during its growth cycle.

An update is of the form 1 p v, and adds a new vertex with value v as a child of vertex p.

A query is of the form 2 u, and asks for the power of vertex u.

Please help Genos respond to these queries modulo 109 + 7.

Input

The first line of the input contains two space separated integers v1 and q (1 ≤ v1 < 109, 1 ≤ q ≤ 200 000) — the value of vertex 1 and the total number of updates and queries respectively.

The next q lines contain the updates and queries. Each of them has one of the following forms: 

  * 1 pi vi, if these line describes an update. The index of the added vertex is equal to the smallest positive integer not yet used as an index in the tree. It is guaranteed that pi is some already existing vertex and 1 ≤ vi < 109. 
  * 2 ui, if these line describes a query. It is guaranteed ui will exist in the tree. 



It is guaranteed that the input will contain at least one query.

Output

For each query, print out the power of the given vertex modulo 109 + 7.

Examples

Input

2 5
1 1 3
1 2 5
1 3 7
1 4 11
2 1


Output

344


Input

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


Output

14
94

Note

For the first sample case, after all the updates the graph will have vertices labelled in the following manner: 1 — 2 — 3 — 4 — 5

These vertices will have corresponding values: 2 — 3 — 5 — 7 — 11

And corresponding powers: 344 — 170 — 82 — 36 — 11

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
There is a string, $unrecognized$, of lowercase English letters that is repeated infinitely many times.  Given an integer, $unrecognized$, find and print the number of letter a's in the first $unrecognized$ letters of the infinite string.

Example 

$unrecognized$ 

$unrecognized$  

The substring we consider is $unrecognized$, the first $unrecognized$ characters of the infinite string.  There are $unrecognized$ occurrences of a in the substring.  

Function Description  

Complete the repeatedString function in the editor below.  

repeatedString has the following parameter(s):  

s: a string to repeat  
n: the number of characters to consider  

Returns  

int: the frequency of a in the substring  

Input Format

The first line contains a single string, $unrecognized$. 

The second line contains an integer, $unrecognized$.

Constraints

$unrecognized$
$unrecognized$
For $unrecognized$ of the test cases, $unrecognized$.

Sample Input

Sample Input 0

aba
10

Sample Output 0

7

Explanation 0 

The first $unrecognized$ letters of the infinite string are abaabaabaa. Because there are $unrecognized$ a's, we return $unrecognized$.

Sample Input 1

a
1000000000000

Sample Output 1

1000000000000

Explanation 1 

Because all of the first $unrecognized$ letters of the infinite string are a, we return $unrecognized$.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
=====Function Descriptions=====
collections.deque()
A deque is a double-ended queue. It can be used to add or remove elements from both ends.

Deques support thread safe, memory efficient appends and pops from either side of the deque with approximately the same O(1) performance in either direction.

Example
Code
>>> from collections import deque
>>> d = deque()
>>> d.append(1)
>>> print d
deque([1])
>>> d.appendleft(2)
>>> print d
deque([2, 1])
>>> d.clear()
>>> print d
deque([])
>>> d.extend('1')
>>> print d
deque(['1'])
>>> d.extendleft('234')
>>> print d
deque(['4', '3', '2', '1'])
>>> d.count('1')
1
>>> d.pop()
'1'
>>> print d
deque(['4', '3', '2'])
>>> d.popleft()
'4'
>>> print d
deque(['3', '2'])
>>> d.extend('7896')
>>> print d
deque(['3', '2', '7', '8', '9', '6'])
>>> d.remove('2')
>>> print d
deque(['3', '7', '8', '9', '6'])
>>> d.reverse()
>>> print d
deque(['6', '9', '8', '7', '3'])
>>> d.rotate(3)
>>> print d
deque(['8', '7', '3', '6', '9'])

=====Problem Statement=====
Perform append, pop, popleft and appendleft methods on an empty deque d.

=====Input Format=====
The first line contains an integer N, the number of operations.
The next N lines contains the space separated names of methods and their values.

=====Constraints=====
0<N≤100

=====Output Format=====
Print the space separated elements of deque d.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
Neko is playing with his toys on the backyard of Aki's house. Aki decided to play a prank on him, by secretly putting catnip into Neko's toys. Unfortunately, he went overboard and put an entire bag of catnip into the toys...

It took Neko an entire day to turn back to normal. Neko reported to Aki that he saw a lot of weird things, including a trie of all correct bracket sequences of length $2n$.

The definition of correct bracket sequence is as follows:  The empty sequence is a correct bracket sequence,  If $s$ is a correct bracket sequence, then $(\,s\,)$ is a correct bracket sequence,  If $s$ and $t$ are a correct bracket sequence, then $st$ is also a correct bracket sequence. 

For example, the strings "(())", "()()" form a correct bracket sequence, while ")(" and "((" not.

Aki then came up with an interesting problem: What is the size of the maximum matching (the largest set of edges such that there are no two edges with a common vertex) in this trie? Since the answer can be quite large, print it modulo $10^9 + 7$.


-----Input-----

The only line contains a single integer $n$ ($1 \le n \le 1000$).


-----Output-----

Print exactly one integer — the size of the maximum matching in the trie. Since the answer can be quite large, print it modulo $10^9 + 7$.


-----Examples-----
Input
1

Output
1

Input
2

Output
3

Input
3

Output
9



-----Note-----

The pictures below illustrate tries in the first two examples (for clarity, the round brackets are replaced with angle brackets). The maximum matching is highlighted with blue. [Image] [Image]

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
There is a number x initially written on a blackboard. You repeat the following action a fixed amount of times: 

  1. take the number x currently written on a blackboard and erase it 
  2. select an integer uniformly at random from the range [0, x] inclusive, and write it on the blackboard 



Determine the distribution of final number given the distribution of initial number and the number of steps.

Input

The first line contains two integers, N (1 ≤ N ≤ 105) — the maximum number written on the blackboard — and M (0 ≤ M ≤ 1018) — the number of steps to perform.

The second line contains N + 1 integers P0, P1, ..., PN (0 ≤ Pi < 998244353), where Pi describes the probability that the starting number is i. We can express this probability as irreducible fraction P / Q, then <image>. It is guaranteed that the sum of all Pis equals 1 (modulo 998244353).

Output

Output a single line of N + 1 integers, where Ri is the probability that the final number after M steps is i. It can be proven that the probability may always be expressed as an irreducible fraction P / Q. You are asked to output <image>.

Examples

Input

2 1
0 0 1


Output

332748118 332748118 332748118


Input

2 2
0 0 1


Output

942786334 610038216 443664157


Input

9 350
3 31 314 3141 31415 314159 3141592 31415926 314159265 649178508


Output

822986014 12998613 84959018 728107923 939229297 935516344 27254497 413831286 583600448 442738326

Note

In the first case, we start with number 2. After one step, it will be 0, 1 or 2 with probability 1/3 each.

In the second case, the number will remain 2 with probability 1/9. With probability 1/9 it stays 2 in the first round and changes to 1 in the next, and with probability 1/6 changes to 1 in the first round and stays in the second. In all other cases the final integer is 0.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
After a hard quarter in the office you decide to get some rest on a vacation. So you will book a flight for you and your girlfriend and try to leave all the mess behind you.

You will need a rental car in order for you to get around in your vacation. The manager of the car rental makes you some good offers.

Every day you rent the car costs $40. If you rent the car for 7 or more days, you get $50 off your total. Alternatively, if you rent the car for 3 or more days, you get $20 off your total.

Write a code that gives out the total amount for different days(d).

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
You are given N non-negative integers A_1, A_2, ..., A_N and another non-negative integer K.
For a integer X between 0 and K (inclusive), let f(X) = (X XOR A_1) + (X XOR A_2) + ... + (X XOR A_N).
Here, for non-negative integers a and b, a XOR b denotes the bitwise exclusive OR of a and b.
Find the maximum value of f.
What is XOR?
The bitwise exclusive OR of a and b, X, is defined as follows:
 - When X is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if, when written in base two, exactly one of A and B has 1 in the 2^k's place, and 0 otherwise.
For example, 3 XOR 5 = 6. (When written in base two: 011 XOR 101 = 110.)

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N \leq 10^5
 - 0 \leq K \leq 10^{12}
 - 0 \leq A_i \leq 10^{12}

-----Input-----
Input is given from Standard Input in the following format:
N K
A_1 A_2 ... A_N

-----Output-----
Print the maximum value of f.

-----Sample Input-----
3 7
1 6 3

-----Sample Output-----
14

The maximum value is: f(4) = (4 XOR 1) + (4 XOR 6) + (4 XOR 3) = 5 + 2 + 7 = 14.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket costs 25 rubles. Can the booking clerk sell a ticket to each person and give the change if he initially has no money and sells the tickets strictly in the order people follow in the line?


-----Input-----

The first line contains integer n (1 ≤ n ≤ 10^5) — the number of people in the line. The next line contains n integers, each of them equals 25, 50 or 100 — the values of the bills the people have. The numbers are given in the order from the beginning of the line (at the box office) to the end of the line.


-----Output-----

Print "YES" (without the quotes) if the booking clerk can sell a ticket to each person and give the change. Otherwise print "NO".


-----Examples-----
Input
4
25 25 50 50

Output
YES

Input
2
25 100

Output
NO

Input
4
50 50 25 25

Output
NO

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.