Integer factorisation is hard. The RSA Factoring Challenge offered $100 000 for factoring RSA-1024, a 1024-bit long product of two prime numbers. To this date, nobody was able to claim the prize. We want you to factorise a 1024-bit number.

Since your programming language of choice might not offer facilities for handling large integers, we will provide you with a very simple calculator. 

To use this calculator, you can print queries on the standard output and retrieve the results from the standard input. The operations are as follows: 

  * + x y where x and y are integers between 0 and n-1. Returns (x+y) mod n. 
  * - x y where x and y are integers between 0 and n-1. Returns (x-y) mod n. 
  * * x y where x and y are integers between 0 and n-1. Returns (x ⋅ y) mod n. 
  * / x y where x and y are integers between 0 and n-1 and y is coprime with n. Returns (x ⋅ y^{-1}) mod n where y^{-1} is multiplicative inverse of y modulo n. If y is not coprime with n, then -1 is returned instead. 
  * sqrt x where x is integer between 0 and n-1 coprime with n. Returns y such that y^2 mod n = x. If there are multiple such integers, only one of them is returned. If there are none, -1 is returned instead. 
  * ^ x y where x and y are integers between 0 and n-1. Returns {x^y mod n}. 



Find the factorisation of n that is a product of between 2 and 10 distinct prime numbers, all of form 4x + 3 for some integer x.

Because of technical issues, we restrict number of requests to 100.

Input

The only line contains a single integer n (21 ≤ n ≤ 2^{1024}). It is guaranteed that n is a product of between 2 and 10 distinct prime numbers, all of form 4x + 3 for some integer x.

Output

You can print as many queries as you wish, adhering to the time limit (see the Interaction section for more details). 

When you think you know the answer, output a single line of form ! k p_1 p_2 ... p_k, where k is the number of prime factors of n, and p_i are the distinct prime factors. You may print the factors in any order.

Hacks input

For hacks, use the following format:. 

The first should contain k (2 ≤ k ≤ 10) — the number of prime factors of n. 

The second should contain k space separated integers p_1, p_2, ..., p_k (21 ≤ n ≤ 2^{1024}) — the prime factors of n. All prime factors have to be of form 4x + 3 for some integer x. They all have to be distinct. 

Interaction

After printing a query do not forget to output end of line and flush the output. Otherwise you will get Idleness limit exceeded. To do this, use:

  * fflush(stdout) or cout.flush() in C++;
  * System.out.flush() in Java;
  * flush(output) in Pascal;
  * stdout.flush() in Python;
  * see documentation for other languages.



The number of queries is not limited. However, your program must (as always) fit in the time limit. The run time of the interactor is also counted towards the time limit. The maximum runtime of each query is given below.

  * + x y — up to 1 ms. 
  * - x y — up to 1 ms. 
  * * x y — up to 1 ms. 
  * / x y — up to 350 ms. 
  * sqrt x — up to 80 ms. 
  * ^ x y — up to 350 ms. 



Note that the sample input contains extra empty lines so that it easier to read. The real input will not contain any empty lines and you do not need to output extra empty lines.

Example

Input

21

7

17

15

17

11

-1

15



Output

+ 12 16

- 6 10

* 8 15

/ 5 4

sqrt 16

sqrt 5

^ 6 12

! 2 3 7

Note

We start by reading the first line containing the integer n = 21. Then, we ask for: 

  1. (12 + 16) mod 21 = 28 mod 21 = 7. 
  2. (6 - 10) mod 21 = -4 mod 21 = 17. 
  3. (8 ⋅ 15) mod 21 = 120 mod 21 = 15. 
  4. (5 ⋅ 4^{-1}) mod 21 = (5 ⋅ 16) mod 21 = 80 mod 21 = 17. 
  5. Square root of 16. The answer is 11, as (11 ⋅ 11) mod 21 = 121 mod 21 = 16. Note that the answer may as well be 10. 
  6. Square root of 5. There is no x such that x^2 mod 21 = 5, so the output is -1. 
  7. (6^{12}) mod 21 = 2176782336 mod 21 = 15. 



We conclude that our calculator is working, stop fooling around and realise that 21 = 3 ⋅ 7.

Source: codeforces | Difficulty: VERY_HARD
Tags: Number theory

Mathematics


Solutions:
import sys
import random

def gcd(x, y):
	return x if y == 0 else gcd(y, x % y)

def isPrime(n):
	if n != int(n):
		return False
	n = int(n)
	if n == 0 or n == 1 or n == 4 or (n == 6) or (n == 8) or (n == 9):
		return False
	if n == 2 or n == 3 or n == 5 or (n == 7):
		return True
	s = 0
	d = n - 1
	while d % 2 == 0:
		d >>= 1
		s += 1
	assert 2 ** s * d == n - 1

	def trial_composite(a):
		if pow(a, d, n) == 1:
			return False
		for i in range(s):
			if pow(a, 2 ** i * d, n) == n - 1:
				return False
		return True
	for i in range(20):
		a = random.randrange(2, n)
		if trial_composite(a):
			return False
	return True
n = int(input())
divs = [n]
while not all([isPrime(x) for x in divs]):
	x = random.randint(1, n - 1)
	sys.stdout.write('sqrt %d\n' % (x * x % n))
	sys.stdout.flush()
	x += int(input())
	tmp = []
	for it in divs:
		g = gcd(x, it)
		if g != 1:
			tmp.append(g)
		if it // g != 1:
			tmp.append(it // g)
	divs = tmp
divs = list(set(divs) - {1})
sys.stdout.write('! %d' % len(divs))
for it in divs:
	sys.stdout.write(' %d' % it)
sys.stdout.write('\n')


import random
from sys import stdout

def is_Prime(n):
	if n != int(n):
		return False
	n = int(n)
	if n == 0 or n == 1 or n == 4 or (n == 6) or (n == 8) or (n == 9):
		return False
	if n == 2 or n == 3 or n == 5 or (n == 7):
		return True
	s = 0
	d = n - 1
	while d % 2 == 0:
		d >>= 1
		s += 1
	assert 2 ** s * d == n - 1

	def trial_composite(a):
		if pow(a, d, n) == 1:
			return False
		for i in range(s):
			if pow(a, 2 ** i * d, n) == n - 1:
				return False
		return True
	for i in range(20):
		a = random.randrange(2, n)
		if trial_composite(a):
			return False
	return True

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def findFactors(n, fac):
	if is_Prime(fac):
		return [fac]
	while True:
		x = random.randrange(n)
		if gcd(x, n) == 1:
			print('sqrt', x * x % n)
			stdout.flush()
			y = int(input())
			if y != -1:
				if (x + y) % fac != 0 and (x - y) % fac != 0:
					return findFactors(n, gcd(x + y, fac)) + findFactors(n, gcd(abs(x - y), fac))
n = int(input())
l = findFactors(n, n)
l = list(set(l))
print('!', len(l), *l)
stdout.flush()


import random

def isPrime(n):
	if n != int(n):
		return False
	n = int(n)
	if n == 0 or n == 1 or n == 4 or (n == 6) or (n == 8) or (n == 9):
		return False
	if n == 2 or n == 3 or n == 5 or (n == 7):
		return True
	s = 0
	d = n - 1
	while d % 2 == 0:
		d >>= 1
		s += 1
	assert 2 ** s * d == n - 1

	def trial_composite(a):
		if pow(a, d, n) == 1:
			return False
		for i in range(s):
			if pow(a, 2 ** i * d, n) == n - 1:
				return False
		return True
	for i in range(20):
		a = random.randrange(2, n)
		if trial_composite(a):
			return False
	return True

def gcd(x, y):
	return x if y == 0 else gcd(y, x % y)
n = int(input())
divs = [n]

def split(parts):
	global divs
	divs = [gcd(d, p) for d in divs for p in parts if gcd(d, p) != 1]
while not all([isPrime(x) for x in divs]):
	x = random.randint(0, n - 1)
	g = gcd(n, x)
	if gcd(n, x) != 1:
		split([g, n // g])
		continue
	y = int(input('sqrt {}\n'.format(x * x % n)))
	if x == y:
		continue
	(a, b) = (abs(x - y), x + y)
	g = gcd(x, y)
	split([a // g, b // g, g])
print('!', len(divs), ' '.join((str(d) for d in sorted(divs))))


from random import *
from math import gcd
from sys import stdout

def miller_rabin(n):
	if n % 4 != 3:
		return False
	d = n - 1
	s = 0
	while d % 2 == 0:
		d >>= 1
		s += 1
	for repeat in range(54):
		a = 0
		while a == 0:
			a = randint(0, n - 1)
		if not miller_rabin_pass(a, s, d, n):
			return False
	return True

def miller_rabin_pass(a, s, d, n):
	a_to_power = pow(a, d, n)
	if a_to_power == 1:
		return True
	for i in range(s - 1):
		if a_to_power == n - 1:
			return True
		a_to_power = a_to_power * a_to_power % n
	return a_to_power == n - 1

def Sqrt(n):
	print('sqrt', n)
	stdout.flush()
	return int(input())
ans = []
N = 0

def solve(n):
	if miller_rabin(n):
		ans.append(n)
		return
	while True:
		x = N
		while gcd(x, N) != 1:
			x = randint(1, N - 1)
		y = Sqrt(x * x % N) % n
		x %= n
		if x != y and x + y != n:
			break
	(x, y) = ((x + y) % n, (x - y) % n)
	solve(gcd(x, n))
	solve(gcd(y, n))
N = int(input())
solve(N)
ans.sort()
print('! {} {}'.format(len(ans), ' '.join(map(str, ans))))


import math
from random import randint
from sys import stdout

def gcd(a, b):
	if b == 0:
		return a
	if a == 0:
		return b
	if not a & 1 and (not b & 1):
		return gcd(a >> 1, b >> 1) << 1
	if a & 1 and (not b & 1):
		return gcd(a, b >> 1)
	if b & 1 and (not a & 1):
		return gcd(a >> 1, b)
	if a > b:
		return gcd(a - b, b)
	return gcd(b - a, a)

def factor(n):
	global N
	if n == 1:
		return []
	if n == 2 or n == 3 or n == 5 or (n == 7):
		return [n]
	k = 8
	for i in range(k):
		x = randint(1, N - 1)
		if math.gcd(n, x) != 1:
			y = 0
			break
		stdout.write('sqrt %d\n' % (x * x % N))
		stdout.flush()
		y = int(input()) % n
		if x != y and (x + y) % n != 0 and ((x - y) % n != 0):
			break
		if i == k - 1:
			return [n]
	d = math.gcd(n, abs(x - y))
	if d == 1 or d == n:
		return [n]
	d1 = factor(d)
	d2 = factor(n // d)
	return d1 + d2
N = int(input())
s = factor(N)
print('!', len(s), *s)