JerryL/AlgoSimBench huggingface dataset:
1176_E. Cover it!

You are given an undirected unweighted connected graph consisting of n vertices and m edges. It is guaranteed that there are no self-loops or multiple edges in the given graph.

Your task is to choose at most ⌊n/2⌋ vertices in this graph so each unchosen vertex is adjacent (in other words, connected by an edge) to at least one of chosen vertices.

It is guaranteed that the answer exists. If there are multiple answers, you can print any.

You will be given multiple independent queries to answer.

Input

The first line contains a single integer t (1 ≤ t ≤ 2 ⋅ 10^5) — the number of queries.

Then t queries follow.

The first line of each query contains two integers n and m (2 ≤ n ≤ 2 ⋅ 10^5, n - 1 ≤ m ≤ min(2 ⋅ 10^5, (n(n-1))/(2))) — the number of vertices and the number of edges, respectively.

The following m lines denote edges: edge i is represented by a pair of integers v_i, u_i (1 ≤ v_i, u_i ≤ n, u_i ≠ v_i), which are the indices of vertices connected by the edge.

There are no self-loops or multiple edges in the given graph, i. e. for each pair (v_i, u_i) there are no other pairs (v_i, u_i) or (u_i, v_i) in the list of edges, and for each pair (v_i, u_i) the condition v_i ≠ u_i is satisfied. It is guaranteed that the given graph is connected.

It is guaranteed that ∑ m ≤ 2 ⋅ 10^5 over all queries.

Output

For each query print two lines.

In the first line print k (1 ≤ ⌊n/2⌋) — the number of chosen vertices.

In the second line print k distinct integers c_1, c_2, ..., c_k in any order, where c_i is the index of the i-th chosen vertex.

It is guaranteed that the answer exists. If there are multiple answers, you can print any.

Example

Input


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


Output


2
1 3
3
4 3 6

Note

In the first query any vertex or any pair of vertices will suffice.

<image>

Note that you don't have to minimize the number of chosen vertices. In the second query two vertices can be enough (vertices 2 and 4) but three is also ok.

<image>

Example input:
2
4 6
1 2
1 3
1 4
2 3
2 4
3 4
6 8
2 5
5 4
4 3
4 1
1 3
2 3
2 6
5 6


Example output:
1
1 
3
3 4 6 


Tags: dfs and similar
dsu
graphs
shortest paths
trees
Difficulty rating: 1700

Solution:
kk=lambda:map(int,input().split())
k2=lambda:map(lambda x:int(x)-1, input().split())
ll=lambda:list(kk())
n,m=kk()
neighs=[[] for _ in range(n)]
for _ in range(m):
	u,v=k2()
	neighs[u].append(v)
	neighs[v].append(u)
m=v = 0
for i,ls in enumerate(neighs):
	if len(ls) > m: m,v = len(ls),i
seen = {v}
nex = [v]
while nex:
	newn = []
	for no in nex:
		for nei in neighs[no]:
			if nei not in seen:
				seen.add(nei)
				print(nei+1, no+1)
				newn.append(nei)
	nex = newn
p03707 AtCoder Grand Contest 015 - Nuske vs Phantom Thnook

Nuske has a grid with N rows and M columns of squares. The rows are numbered 1 through N from top to bottom, and the columns are numbered 1 through M from left to right. Each square in the grid is painted in either blue or white. If S_{i,j} is 1, the square at the i-th row and j-th column is blue; if S_{i,j} is 0, the square is white. For every pair of two blue square a and b, there is at most one path that starts from a, repeatedly proceeds to an adjacent (side by side) blue square and finally reaches b, without traversing the same square more than once.

Phantom Thnook, Nuske's eternal rival, gives Q queries to Nuske. The i-th query consists of four integers x_{i,1}, y_{i,1}, x_{i,2} and y_{i,2} and asks him the following: when the rectangular region of the grid bounded by (and including) the x_{i,1}-th row, x_{i,2}-th row, y_{i,1}-th column and y_{i,2}-th column is cut out, how many connected components consisting of blue squares there are in the region?

Process all the queries.

Constraints

* 1 ≤ N,M ≤ 2000
* 1 ≤ Q ≤ 200000
* S_{i,j} is either 0 or 1.
* S_{i,j} satisfies the condition explained in the statement.
* 1 ≤ x_{i,1} ≤ x_{i,2} ≤ N(1 ≤ i ≤ Q)
* 1 ≤ y_{i,1} ≤ y_{i,2} ≤ M(1 ≤ i ≤ Q)

Input

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


N M Q
S_{1,1}..S_{1,M}
:
S_{N,1}..S_{N,M}
x_{1,1} y_{i,1} x_{i,2} y_{i,2}
:
x_{Q,1} y_{Q,1} x_{Q,2} y_{Q,2}


Output

For each query, print the number of the connected components consisting of blue squares in the region.

Examples

Input

3 4 4
1101
0110
1101
1 1 3 4
1 1 3 1
2 2 3 4
1 2 2 4


Output

3
2
2
2


Input

5 5 6
11010
01110
10101
11101
01010
1 1 5 5
1 2 4 5
2 3 3 4
3 3 3 3
3 1 3 5
1 1 3 4


Output

3
2
1
1
3
2

Example input:
3 4 4
1101
0110
1101
1 1 3 4
1 1 3 1
2 2 3 4
1 2 2 4
5 5 6
11010
01110
10101
11101
01010
1 1 5 5
1 2 4 5
2 3 3 4
3 3 3 3
3 1 3 5
1 1 3 4

Example output:
3
2
2
2
3
2
1
1
3
2

Difficulty rating: 0

Solution:
A,B=raw_input,range;n,m,q=map(int,A().split());s=[map(int,A())for _ in[0]*n]
def f(a):
 z=[[x*y for(x,y)in zip(t,u)]+[0,0]for(t,u)in zip(s,a)]+[[0]*m,[0]*m]
 def g(p):
	for i in B(n):
	 for j in B(m):z[i][j]+=z[i-p][j-1+p]
 g(1);g(0);return z
a,b,c=f([[1]*m]*n),f(t[1:]for t in s),f(s[1:])
for _ in[0]*q:x,y,z,w=map(int,A().split());g=lambda d,p,q:d[x-2][y-2]+d[z-p][w-q]-d[x-2][w-q]-d[z-p][y-2];print g(a,1,1)-g(b,1,2)-g(c,2,1)
1316_E. Team Building

Alice, the president of club FCB, wants to build a team for the new volleyball tournament. The team should consist of p players playing in p different positions. She also recognizes the importance of audience support, so she wants to select k people as part of the audience.

There are n people in Byteland. Alice needs to select exactly p players, one for each position, and exactly k members of the audience from this pool of n people. Her ultimate goal is to maximize the total strength of the club.

The i-th of the n persons has an integer a_{i} associated with him — the strength he adds to the club if he is selected as a member of the audience.

For each person i and for each position j, Alice knows s_{i, j} — the strength added by the i-th person to the club if he is selected to play in the j-th position.

Each person can be selected at most once as a player or a member of the audience. You have to choose exactly one player for each position.

Since Alice is busy, she needs you to help her find the maximum possible strength of the club that can be achieved by an optimal choice of players and the audience.

Input

The first line contains 3 integers n,p,k (2 ≤ n ≤ 10^{5}, 1 ≤ p ≤ 7, 1 ≤ k, p+k ≤ n).

The second line contains n integers a_{1},a_{2},…,a_{n}. (1 ≤ a_{i} ≤ 10^{9}).

The i-th of the next n lines contains p integers s_{i, 1}, s_{i, 2}, ..., s_{i, p}. (1 ≤ s_{i,j} ≤ 10^{9})

Output

Print a single integer {res} — the maximum possible strength of the club.

Examples

Input


4 1 2
1 16 10 3
18
19
13
15


Output


44


Input


6 2 3
78 93 9 17 13 78
80 97
30 52
26 17
56 68
60 36
84 55


Output


377


Input


3 2 1
500 498 564
100002 3
422332 2
232323 1


Output


422899

Note

In the first sample, we can select person 1 to play in the 1-st position and persons 2 and 3 as audience members. Then the total strength of the club will be equal to a_{2}+a_{3}+s_{1,1}.

Example input:
4 1 2
1 16 10 3
18
19
13
15

3 2 1
500 498 564
100002 3
422332 2
232323 1

6 2 3
78 93 9 17 13 78
80 97
30 52
26 17
56 68
60 36
84 55


Example output:
44
422899
377

Tags: bitmasks
dp
greedy
sortings
Difficulty rating: 2300

Solution:
#include <bits/stdc++.h>
using namespace std;
long long n, p, k, pre[100005], f[100005][128];
struct mem {
  long long p[7], a;
  bool operator<(const mem &v) const { return a > v.a; }
} c[100005];
int main() {
  scanf("%lld%lld%lld", &n, &p, &k);
  for (int i = 1; i <= n; i++) scanf("%lld", &c[i].a);
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < p; j++) scanf("%lld", &c[i].p[j]);
  sort(c + 1, c + n + 1);
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < 1 << p; j++) {
      int sz = 0;
      for (int k = 0; k < p; k++) sz += (j >> k) & 1;
      f[i][j] = f[i - 1][j];
      if (k + sz >= i && sz <= i - 1) f[i][j] += c[i].a;
      for (int k = 0; k < p; k++)
        if ((j >> k) & 1) {
          int q = j - (1 << k);
          f[i][j] = max(f[i][j], f[i - 1][q] + c[i].p[k]);
        }
    }
  cout << f[n][(1 << p) - 1];
  return 0;
}
1043_F. Make It One

Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of n integers a_i.

It is allowed to select any subset of them, and the score is equal to the greatest common divisor of selected elements. The goal is to take as little elements as it is possible, getting the score 1. Now Janusz wonders, for given sequence, how much elements should the player choose?

Input

The first line contains an only integer n (1 ≤ n ≤ 300 000) — the number of integers in the sequence.

The second line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 300 000).

Output

If there is no subset of the given sequence with gcd equal to 1, output -1.

Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to 1.

Examples

Input

3
10 6 15


Output

3


Input

3
2 4 6


Output

-1


Input

7
30 60 21 42 70 15 30


Output

3

Note

In the first example, selecting a subset of all numbers gives a gcd of 1 and for all smaller subsets the gcd is greater than 1.

In the second example, for all subsets of numbers the gcd is at least 2. 

Example input:
3
2 4 6

7
30 60 21 42 70 15 30

3
10 6 15


Example output:
-1
3
3

Tags: bitmasks
combinatorics
dp
math
number theory
shortest paths
Difficulty rating: 2500

Solution:
#include <bits/stdc++.h>
using namespace std;
bool can[300010];
bool init[300010];
long long mods[300010];
void pass(int nmax) {
  for (int i = 1; i <= nmax; i++) {
    int a = 0, b = 0;
    for (int j = i; j <= nmax; j += i) a += can[j], b += init[j];
    mods[i] = 1LL * a * b;
  }
  for (int i = nmax; i >= 1; i--) {
    for (int j = 2 * i; j <= nmax; j += i) mods[i] -= mods[j];
    can[i] |= (mods[i] != 0);
  }
}
int main() {
  int n, c;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  while (n--) {
    cin >> c;
    can[c] = init[c] = 1;
  }
  int ans = 1;
  while (!can[1]) {
    if (ans > 10) return cout << -1, 0;
    pass(300000);
    ans++;
  }
  cout << ans << '\n';
  return 0;
}
1148_G. Gold Experience

Consider an undirected graph G with n vertices. There is a value a_i in each vertex.

Two vertices i and j are connected with an edge if and only if gcd(a_i, a_j) > 1, where gcd(x, y) denotes the [greatest common divisor (GCD)](https://en.wikipedia.org/wiki/Greatest_common_divisor) of integers x and y.

Consider a set of vertices. Let's call a vertex in this set fair if it is connected with an edge with all other vertices in this set.

You need to find a set of k vertices (where k is a given integer, 2 ⋅ k ≤ n) where all vertices are fair or all vertices are not fair. One can show that such a set always exists.

Input

The first line contains integers n and k (6 ≤ 2 ⋅ k ≤ n ≤ 10^5) — the number of vertices and parameter k.

The second line contains n integers a_1, a_2, …, a_n (2 ≤ a_i ≤ 10^7) — the values in the vertices.

Output

Print exactly k distinct integers — the indices of the vertices in the chosen set in any order.

Examples

Input


6 3
6 15 10 8 14 12


Output


2 4 5

Input


8 4
11 15 10 6 21 15 10 6


Output


5 7 1 2

Input


10 5
3003 17017 3230 49742 546 41990 17765 570 21945 36465


Output


1 2 4 5 6

Note

In the first test case, set \{2, 4, 5\} is an example of set where no vertices are fair. The vertex 2 does not share an edge with vertex 4 since gcd(15, 8) = 1. The vertex 4 does not share an edge with vertex 2. The vertex 5 does not share an edge with vertex 2.

In the second test case, set \{8, 5, 6, 4\} is an example of a set where all vertices are fair.

Example input:
10 5
3003 17017 3230 49742 546 41990 17765 570 21945 36465

6 3
6 15 10 8 14 12

8 4
11 15 10 6 21 15 10 6


Example output:
1 2 4 5 6 
1 2 3 
1 2 3 4 

Tags: constructive algorithms
graphs
math
number theory
probabilities
Difficulty rating: 3300

Solution:
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, k;
pair<int, int> a[N];
vector<int> d[4005];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i].first), a[i].second = i;
    int& t = a[i].first;
    for (int j = 2, e = a[i].first; j * j <= e; j++)
      if (t % j == 0) {
        d[j].push_back(i);
        while (t % j == 0) t /= j;
        if (d[j].size() == k) {
          for (auto x : d[j]) printf("%d ", x + 1);
          return 0;
        }
      }
  }
  if (n == 6 && k == 3 && a[1].first == 1) {
    puts("1 4 3");
    return 0;
  }
  sort(a, a + n);
  for (int i = 0; i < k; i++) printf("%d ", a[n - i - 1].second + 1);
  return 0;
}
1514_C. Product 1 Modulo N

Now you get Baby Ehab's first words: "Given an integer n, find the longest subsequence of [1,2, …, n-1] whose product is 1 modulo n." Please solve the problem.

A sequence b is a subsequence of an array a if b can be obtained from a by deleting some (possibly all) elements. The product of an empty subsequence is equal to 1.

Input

The only line contains the integer n (2 ≤ n ≤ 10^5).

Output

The first line should contain a single integer, the length of the longest subsequence.

The second line should contain the elements of the subsequence, in increasing order.

If there are multiple solutions, you can print any.

Examples

Input


5


Output


3
1 2 3 

Input


8


Output


4
1 3 5 7 

Note

In the first example, the product of the elements is 6 which is congruent to 1 modulo 5. The only longer subsequence is [1,2,3,4]. Its product is 24 which is congruent to 4 modulo 5. Hence, the answer is [1,2,3].

Example input:
5

8


Example output:

3
1 2 3 

4
1 3 5 7 

Tags: greedy
number theory
Difficulty rating: 1600

Solution:
from math import gcd;N=int(input());ANS=[];X=1
for i in range(1,N):
    if gcd(N,i)==1:ANS.append(i);X=X*i%N
if X!=1:del ANS[ANS.index(X)]
print(len(ANS));print(*ANS)
1536_C. Diluc and Kaeya

The tycoon of a winery empire in Mondstadt, unmatched in every possible way. A thinker in the Knights of Favonius with an exotic appearance.

This time, the brothers are dealing with a strange piece of wood marked with their names. This plank of wood can be represented as a string of n characters. Each character is either a 'D' or a 'K'. You want to make some number of cuts (possibly 0) on this string, partitioning it into several contiguous pieces, each with length at least 1. Both brothers act with dignity, so they want to split the wood as evenly as possible. They want to know the maximum number of pieces you can split the wood into such that the ratios of the number of occurrences of 'D' to the number of occurrences of 'K' in each chunk are the same.

Kaeya, the curious thinker, is interested in the solution for multiple scenarios. He wants to know the answer for every prefix of the given string. Help him to solve this problem!

For a string we define a ratio as a:b where 'D' appears in it a times, and 'K' appears b times. Note that a or b can equal 0, but not both. Ratios a:b and c:d are considered equal if and only if a⋅ d = b⋅ c. 

For example, for the string 'DDD' the ratio will be 3:0, for 'DKD' — 2:1, for 'DKK' — 1:2, and for 'KKKKDD' — 2:4. Note that the ratios of the latter two strings are equal to each other, but they are not equal to the ratios of the first two strings.

Input

Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 1000). Description of the test cases follows.

The first line of each test case contains an integer n (1 ≤ n ≤ 5 ⋅ 10^5) — the length of the wood.

The second line of each test case contains a string s of length n. Every character of s will be either 'D' or 'K'.

It is guaranteed that the sum of n over all test cases does not exceed 5 ⋅ 10^5.

Output

For each test case, output n space separated integers. The i-th of these numbers should equal the answer for the prefix s_{1},s_{2},...,s_{i}.

Example

Input


5
3
DDK
6
DDDDDD
4
DKDK
1
D
9
DKDKDDDDK


Output


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

Note

For the first test case, there is no way to partition 'D' or 'DDK' into more than one block with equal ratios of numbers of 'D' and 'K', while you can split 'DD' into 'D' and 'D'.

For the second test case, you can split each prefix of length i into i blocks 'D'.

Example input:
5
3
DDK
6
DDDDDD
4
DKDK
1
D
9
DKDKDDDDK


Example output:

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


Tags: data structures
dp
hashing
number theory
Difficulty rating: 1500

Solution:
import math
for s in[*open(0)][2::2]:
	D={};d=i=0
	for c in s[:-1]:
		if c<'K':d+=1
		i+=1;g=math.gcd(d,i);l=(d/g,(i-d)/g);D[l]=D.get(l,0)+1;print(D[l],end=' ')
616_D. Longest k-Good Segment

The array a with n integers is given. Let's call the sequence of one or more consecutive elements in a segment. Also let's call the segment k-good if it contains no more than k different values.

Find any longest k-good segment.

As the input/output can reach huge size it is recommended to use fast input/output methods: for example, prefer to use scanf/printf instead of cin/cout in C++, prefer to use BufferedReader/PrintWriter instead of Scanner/System.out in Java.

Input

The first line contains two integers n, k (1 ≤ k ≤ n ≤ 5·105) — the number of elements in a and the parameter k.

The second line contains n integers ai (0 ≤ ai ≤ 106) — the elements of the array a.

Output

Print two integers l, r (1 ≤ l ≤ r ≤ n) — the index of the left and the index of the right ends of some k-good longest segment. If there are several longest segments you can print any of them. The elements in a are numbered from 1 to n from left to right.

Examples

Input

5 5
1 2 3 4 5


Output

1 5


Input

9 3
6 5 1 2 3 2 1 4 5


Output

3 7


Input

3 1
1 2 3


Output

1 1

Example input:
5 5
1 2 3 4 5

9 3
6 5 1 2 3 2 1 4 5

3 1
1 2 3


Example output:
1 5

3 7

1 1


Tags: binary search
data structures
two pointers
Difficulty rating: 1600

Solution:
n=int(input())
d={}
b=[]
e=1
a=list(map(int,input().split()))
for i in range(n):
	if a[i] in d:
		b.append([e,i+1])
		e=i+2
		d.clear()
	else:
		d[a[i]]=i+1	 
if len(b)==0:
	print(-1)
	exit()		
print(len(b))
k=b[-1]
b[-1]=[k[0],n]
for i in b:
	print(*i)
977_F. Consecutive Subsequence

You are given an integer array of length n.

You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the required sequence should be equal to [x, x + 1, ..., x + k - 1] for some value x and length k.

Subsequence of an array can be obtained by erasing some (possibly zero) elements from the array. You can erase any elements, not necessarily going successively. The remaining elements preserve their order. For example, for the array [5, 3, 1, 2, 4] the following arrays are subsequences: [3], [5, 3, 1, 2, 4], [5, 1, 4], but the array [1, 3] is not.

Input

The first line of the input containing integer number n (1 ≤ n ≤ 2 ⋅ 10^5) — the length of the array. The second line of the input containing n integer numbers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9) — the array itself.

Output

On the first line print k — the maximum length of the subsequence of the given array that forms an increasing sequence of consecutive integers.

On the second line print the sequence of the indices of the any maximum length subsequence of the given array that forms an increasing sequence of consecutive integers.

Examples

Input

7
3 3 4 7 5 6 8


Output

4
2 3 5 6 


Input

6
1 3 5 2 4 6


Output

2
1 4 


Input

4
10 9 8 7


Output

1
1 


Input

9
6 7 8 3 4 5 9 10 11


Output

6
1 2 3 7 8 9 

Note

All valid answers for the first example (as sequences of indices): 

  * [1, 3, 5, 6] 
  * [2, 3, 5, 6] 



All valid answers for the second example: 

  * [1, 4] 
  * [2, 5] 
  * [3, 6] 



All valid answers for the third example: 

  * [1] 
  * [2] 
  * [3] 
  * [4] 



All valid answers for the fourth example: 

  * [1, 2, 3, 7, 8, 9] 

Example input:
4
10 9 8 7

6
1 3 5 2 4 6

7
3 3 4 7 5 6 8

9
6 7 8 3 4 5 9 10 11


Example output:
1
1 

2
1 4 

4
2 3 5 6 

6
1 2 3 7 8 9 


Tags: dp
Difficulty rating: 1700

Solution:
n=int(input())
g={}
s=[*map(int,input().split())]
for i in s:g[i]=g.get(i-1,0)+1
e=max(g,key=g.get)
m=g[e]
a=[]
while n:
    if s[n-1]==e:a+=n,;e-=1
    n-=1
print(m,*a[::-1])
912_E. Prime Gift

Opposite to Grisha's nice behavior, Oleg, though he has an entire year at his disposal, didn't manage to learn how to solve number theory problems in the past year. That's why instead of Ded Moroz he was visited by his teammate Andrew, who solemnly presented him with a set of n distinct prime numbers alongside with a simple task: Oleg is to find the k-th smallest integer, such that all its prime divisors are in this set. 

Input

The first line contains a single integer n (1 ≤ n ≤ 16).

The next line lists n distinct prime numbers p1, p2, ..., pn (2 ≤ pi ≤ 100) in ascending order.

The last line gives a single integer k (1 ≤ k). It is guaranteed that the k-th smallest integer such that all its prime divisors are in this set does not exceed 1018.

Output

Print a single line featuring the k-th smallest integer. It's guaranteed that the answer doesn't exceed 1018.

Examples

Input

3
2 3 5
7


Output

8


Input

5
3 7 11 13 31
17


Output

93

Note

The list of numbers with all prime divisors inside {2, 3, 5} begins as follows:

(1, 2, 3, 4, 5, 6, 8, ...)

The seventh number in this list (1-indexed) is eight.

Example input:
3
2 3 5
7

5
3 7 11 13 31
17


Example output:
8

93


Tags: binary search
dfs and similar
math
meet-in-the-middle
number theory
two pointers
Difficulty rating: 2400

Solution:
#include <bits/stdc++.h>
using namespace std;
vector<long long> a[2];
long long p[20], k;
int n;
void dfs(int m, int r, long long t, int q) {
  if (m > r) {
    a[q].push_back(t);
    return;
  }
  for (;;) {
    dfs(m + 1, r, t, q);
    if (1e18 / p[m] < t) return;
    t *= p[m];
  }
}
int main() {
  int i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) scanf("%lld", &p[i]);
  dfs(1, min(n, 6), 1, 0), dfs(min(n, 6) + 1, n, 1, 1);
  for (i = 0; i < 2; ++i) sort(a[i].begin(), a[i].end());
  reverse(a[0].begin(), a[0].end());
  long long l = 1, r = 1e18;
  scanf("%lld", &k);
  for (; l <= r;) {
    long long mid = (l + r) >> 1, cnt = 0;
    for (i = 0, j = 0; i < a[0].size(); ++i) {
      for (; j < a[1].size() && mid / a[0][i] >= a[1][j]; ++j)
        ;
      cnt += j;
    }
    cnt >= k ? r = mid - 1 : l = mid + 1;
  }
  printf("%lld", l);
}