Harryxun/stf_run huggingface dataset:
from math import factorial

N,A,B,K = map(int, raw_input().split())
mod=998244353

def product(iterable):
    prod = 1
    for n in iterable:
        prod *= n
    return prod

def npr(n, r):
    return product(range(n - r + 1, n + 1))

def ncr(n, r):
    if r > n // 2:
        r = n - r
    return npr(n, r) // factorial(r)

if K==0: print 1;quit()

y=None
ans=0
for x in range(1,N+1):
	if (K-A*x)%B==0:
		y=(K-A*x)/B
		ans+=(ncr(N,x))%mod*(ncr(N,y))%mod

print ans

### FIXED CODE ###

N,A,B,K = map(int, raw_input().split())


mod=998244353
fact, inv_fact = [1], [1]
fact_tmp = 1
for i in range(1, N+1):
    fact_tmp *= i
    fact_tmp %= mod
    fact.append(fact_tmp)
    inv_fact.append(pow(fact_tmp, mod-2, mod))


def ncr(n,r):
	if n < 0 or r < 0 or n < r:
		return 0
	else:
		return (fact[n] * inv_fact[r] * inv_fact[n-r]) %mod

y=0
ans=0
for x in range(N+1):
	if (K-A*x)%B==0:
		if K-A*x<0: break
		y=(K-A*x)/B
		if y>N: continue
		ans+=(ncr(N,x))%mod*(ncr(N,y))%mod

print ans%mod
_, *e = [[*map(int, t.split())] for t in open(0)]
ans = 1
mod = 10 ** 9 + 7
slope_dict = {}
zeros = 0
vect_x = 0
for x, y in e:
    if x == y == 0:
        zeros += 1
    elif y == 0:
        vect_x += 1
    else:
        slope_dict[x/y] = slope_dict.get(x/y, 0) + 1
ans = ans * (pow(2, vect_x, mod) + pow(2, slope_dict.get(0, 0), mod) - 1) % mod
slope_dict.pop(0)
for k in slope_dict:
    if -1/k in slope_dict:
        if k >= 1:
            ans = ans * (pow(2, slope_dict[k], mod) +
                         pow(2, slope_dict[-1/k], mod) - 1) % mod
    else:
        ans = ans * (pow(2, slope_dict[k], mod)) % mod
print(ans + zeros - 1 % mod)


### FIXED CODE ###

from math import gcd
from collections import defaultdict
mod = 10**9+7
_, *S = open(0)
mp = defaultdict(lambda: [0, 0])
O = 0
for s in S:
    a, b = map(int, s.split())
    if a == b == 0:
        O += 1
    else:
        g = gcd(a, b)
        a //= g
        b //= g
        if a < 0 or a == 0 < b:
            a, b = -a, -b
        f = 0
        if b < 0:
            a, b, f = -b, a, 1
        mp[(a, b)][f] += 1
ans = 1
for k in mp:
    x, y = mp[k]
    ans = ans*(pow(2, x, mod)+pow(2, y, mod)-1) % mod
print((ans+O-1) % mod)
def main():
    s = input()
    q = int(input())
    hanten = False
    for i in range(q):
        query = input().split()
        if query[0] == "1":
            hanten = not hanten
        else:
            if query[1] == "1":
                if hanten:
                    s = s + query[2]
                else:
                    s = query[2] + s
            if query[1] == "2":
                if hanten:
                    s = query[2] + s
                else:
                    s = s + query[2]
    print(s if not hanten else s[::-1])



if __name__ == '__main__':
    main()


### FIXED CODE ###


def main():
    n,blue,red = map(int,input().split())
    total = blue+red
    answer = 0
    answer += (n // total) * blue
    amari = min(blue,(n % total))
    answer += amari
    print(answer)




if __name__ == '__main__':
    main()
line = input().split()
x = line[1]
ans = 0
 
a = input().split().sort()
 
for i in len(a):
  if a[i] > x:
    print ans
    break
  else:
    x-=a[i]
    ans+=1
    continue
print ans

### FIXED CODE ###

line = input().split()
N = int(line[0])
x = int(line[1])
ans = 0

a = input().split()
a = [int(i) for i in a]
a.sort()

for i in range(N):
    if a[i] > x:
        print(ans)
        break
    else:
        x -= a[i]
        if i != (N - 1):
            ans += 1
        else:
            if x == 0:
                ans += 1
            print(ans)
b=input()

if b = 'A':
  print("T")
elif b = 'T':
  print('A')
elif b = 'C':
  print('G')
elif b = 'G':
  print('C')

### FIXED CODE ###

b=input()
 
if b == 'A':
  print("T")
elif b == 'T':
  print('A')
elif b == 'C':
  print('G')
elif b == 'G':
  print('C')
N=int(input())
la=list(range(2,10**2+1))
l=[]
for i in range(len(la)):
  l.append(la[i]**2)
for n in range(1,N+1):
  if n<6:
    print(0)
  else:
    c=0
    for x in range(len(l)):
      if l[x]*3>2*n:
        break
      else:
        for y in range(x,len(l)):
          if l[x]+2*l[y]>2*n:
            break
          else:
            for z in range(y,x+y+2):
              if l[x]+l[y]+l[z]>2*n:
                break
              else:
                
                if l[x]+l[y]+l[z]==2*n:
                  
                  if (x+y+z)%2==0: 
                      if l[x]==l[y] and l[y]==l[z]:
                        c+=1
                      elif l[x]==l[y] or l[y]==l[z]:
                        c+=3
                      else:
                        c+=6
                   
    print(c)
    

### FIXED CODE ###

n=int(input())
dp=[0]*(10**5)
for x in range(1,10**2):
  for y in range(1,10**2):
    for z in range(1,10**2):
      dp[x**2+y**2+z**2+x*y+y*z+z*x]+=1
for i in range(n):
  print(dp[i+1])
s = int(input())
f = input()
a = "ABCDEFGHIJKLNMOPQRSTUVWXYZ"
ans = ""
for i in f:
  ans += a[a.index(i)+s]

print(ans)


### FIXED CODE ###

s = int(input())
f = input()
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in f:
  ans += a[a.index(i)+s]

print(ans)
array = input().split().sort()

for i in range(len(array)):
    print(array[i], end="")


### FIXED CODE ###

#
# 2c
#

def main():
    l = list(map(int, input().split()))
    l.sort()
    print(*l)


if __name__ == '__main__':
    main()
K = int(input())

for i in range(K):
    if i = 0:
        N= 7%K
    else:
        N = (10*N+7)%K
    if N == 0:
        print(i+1)
        break
else:
    print(-1)

### FIXED CODE ###

K = int(input())

for i in range(K):
    if i == 0:
        N= 7%K
    else:
        N = (10*N+7)%K
    if N == 0:
        print(i+1)
        break
else:
    print(-1)
#D
N=int(input())
X=str(input())
   
CNT=0
for i in range(N):
    if X[i]=="1":
        CNT+=1
NUM=int(X,2)

R=[NUM%(CNT+1),NUM%(CNT-1)]
for i in range(N):
    if X[i]=="0":
        cnt=CNT+1
        r=(R[0]+2**(N-i-1))%cnt
    else:
        cnt=CNT-1
        r=(R[1]-2**(N-i-1))%cnt
    
    ans=1
    while True:
        if r==0:
            print(ans)
            break

        num=r
        cnt=0
        for i in bin(num)[2:]:
            if i=="1":
                cnt+=1
        r=num%cnt
        ans+=1

### FIXED CODE ###

#D
N=int(input())
X=str(input())
   
CNT=0
for i in range(N):
    if X[i]=="1":
        CNT+=1
NUM=int(X,2)

to0_cnt=[0 for i in range(N)]
for i in range(1,N):
    ans=0
    num=i
    while True:
        cnt=0
        for j in bin(num)[2:]:
            if j=="1":
                cnt+=1
        if cnt==0:
            break
        r=num%cnt
        ans+=1
        if r==0:
            break
        num=r
    to0_cnt[i]=ans
                
R=[NUM%(CNT+1),NUM%(CNT-1) if CNT!=1 else 0]
for i in range(N):
    if X[i]=="0":
        cnt=CNT+1
        r=(R[0]+pow(2,N-i-1,cnt))%cnt
    else:
        cnt=CNT-1
        if NUM-pow(2,N-i-1)==0:
            print(0)
            continue
        r=(R[1]-pow(2,N-i-1,cnt))%cnt
    
    ans=1+to0_cnt[r]
    print(ans)
n=int(input())
a=list(map(int,input().split()))
b=set(a)
if len(b)==3:
  print('Three')
if len(b)==4:
  print('Four)

### FIXED CODE ###

n=int(input())
a=list(input().split())
b=set(a)
if len(b)==3:
  print('Three')
if len(b)==4:
  print('Four')
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
ans = sum(a)
card = []
for i in range(m):
    b,c = map(int,input().split())
    card.append([b,c])

card.sort(key = lambda x: x[1])
card.reverse()
mini = a[0]
i = 0
now = 0 #aの参照インデックス
plus = 0
while i < m and mini < card[i][1]:
    while card[i][0] > 0 and now < n and card[i][1] > a[now]:
        plus += card[i][1]-a[now]
        card[i][0] -= 1
        now += 1
    if now < n and card[i][1] < a[now]:
        mini = card[i][1]
    else:
        mini = a[now]
    i += 1
print(ans+plus)

### FIXED CODE ###

n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
ans = sum(a)
card = []
for i in range(m):
    b,c = map(int,input().split())
    card.append([b,c])

card.sort(key = lambda x: x[1])
card.reverse()
mini = a[0]
i = 0
now = 0 #aの参照インデックス
plus = 0
while i < m and mini < card[i][1]:
    while card[i][0] > 0 and now < n and card[i][1] > a[now]:
        plus += card[i][1]-a[now]
        card[i][0] -= 1
        now += 1
    if now == n:
        now -= 1
        if card[i][1] < a[now]:
            mini = card[i][1]
        else:
            mini = a[now]
        break
    else:
        if card[i][1] < a[now]:
            mini = card[i][1]
        else:
            mini = a[now]
    i += 1
print(ans+plus)
import numpy as np

H, W, M = map(int, input().split())
h_t = [0]*300000
w_t = [0]*300000
t = np.zeros((H, W))
for i in range(M):
    h, w = map(int, input().split())
    t[h-1][w-1] = 1
    h_t[h-1]+=1
    w_t[w-1]+=1
h_max = max(h_t)
h_max_list = [i for i in range(len(h_t)) if h_t[i] == h_max]
w_max = max(w_t)
w_max_list = [i for i in range(len(w_t)) if w_t[i] == w_max]

for h in h_max_list:
    for w in w_max_list:
        if t[h][w] == 0:
            print(h_max + w_max)
            exit()
print(h_max + w_max - 1)

### FIXED CODE ###

import numpy as np

H, W, M = map(int, input().split())
h_t = [0]*H
w_t = [0]*W
t = {}
for i in range(M):
    h, w = map(int, input().split())
    t[(h-1, w-1)] = 1
    h_t[h-1]+=1
    w_t[w-1]+=1
h_max = max(h_t)
h_max_list = [i for i in range(len(h_t)) if h_t[i] == h_max]
w_max = max(w_t)
w_max_list = [i for i in range(len(w_t)) if w_t[i] == w_max]

for h in h_max_list:
    for w in w_max_list:
        if (h, w) not in t:
            print(h_max + w_max)
            exit()
print(h_max + w_max - 1)
H, W = [int(s) for s in input().rstrip().split()]
sqare = [list('.' * (W+2)) for _ in range(H+2)]
for i in range(1, H+1):
    S = list(input().rstrip())
    sqare[i][1:H+1] = S

bomb = [[0 for _ in range(W+2)] for _ in range(H+2)]

for i in range(1, H+1):
    for j in range(1, W+1):
        for x in range(i-1, i+2):
            for y in range(j-1, j+2):
                if not(x == i and y == j) and sqare[x][y] == '#':
                    bomb[i][j] += 1

for i in range(1, H+1):
    for j in range(1, W+1):
        if sqare[i][j] == '.':
            print(bomb[i][j], end='')
        else:
            print(sqare[i][j], end='')                        
    print('')

### FIXED CODE ###

H, W = [int(s) for s in input().rstrip().split()]
S = [list(input().rstrip()) for _ in range(H)]

for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            continue
        bomb = 0
        for x in range(i-1, i+2):
            for y in range(j-1, j+2):
                if 0 <= x < H and 0 <= y < W and S[x][y] == '#':
                    bomb += 1
        S[i][j] = str(bomb)

for s in S:
    print(''.join(s))
n,x,m=map(int, input().split())
a = x
ans = a
l=[a]

for i in range(1,n):
    tmp=(a*a)%m
    a=tmp  
    ans+=tmp
    if a in l:
        lp = l.index(a)
        break
    else:
        l.append(a)

l2 = l[lp:]
tmp = sum(l2)

b=int((n-len(l))/len(l2))
c=(n-len(l))%len(l2)

ans+=b*tmp+sum(l2[:c])
print(ans)

### FIXED CODE ###

n,x,m=map(int, input().split())
a=x
ans=a
flg=[0]*m
flg[a]=1
l=[a]
lp=-1

for i in range(1,m+1):   
    if n <= i:
        break
    tmp=(a*a)%m
    a=tmp
    if flg[a]==1:
        lp = l.index(a)
        break
    else:    
        ans+=tmp
        l.append(a)
        flg[a]=1

if lp != -1:
    l2 = l[lp:]
    tmp = sum(l2)
    b=(n-len(l))//len(l2)
    c=n-len(l)-b*len(l2)
    ans=ans+(b*tmp)+sum(l2[:c])

print(ans)
for i in range(10000)
	x= input()
	print("Case i: x)

	if x = 0:
	break

### FIXED CODE ###

import sys 

cnt =1

while 1:
    x = sys.stdin.readline().strip()
    if x == "0":
        break

    print("Case %d: %s"%(cnt,x))
    cnt+=1
N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
sum = 0
count = 0
while True:
  sum += a[0]
  if sum > x or len(a) == 0:
    break
  count += 1
  del a[0]
print(count)

### FIXED CODE ###

N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
sum = 0
count = 0
while True:
  sum += a[0]
  if sum > x:
    break
  count += 1
  del a[0]
  if len(a) == 0:
    break
if x > sum:
  print(count-1)
else:
  print(count)
N  = int(input())
p = 1
for i in range(1,N+1):
  p*=i
  
print(p/(10**9+7)  )

### FIXED CODE ###

N  = int(input())
#N = 10**5
p = 1
#x = [p*i for i in range(1,N+1)]
for i in range(1,N+1):
  p =i*p%(10**9+7)
#  print(p)
  
  
  
print(p)
A = input()

A = A.splitlines()

change_num = 0

Num = len(A[0])

S = list(A[0])
T = list(A[1])

for i in range(Num):
    if S[i] is not T[i]:
        change_num += 1

print(change_num)

### FIXED CODE ###

S = input()
T = input()

Num = len(S)

S = list(S)
T = list(T)

change_num = 0

for i in range(Num):
    if S[i] is not T[i]:
        change_num += 1

print(change_num)
from itertools import accumulate


def make_dp(vvv, n, k):
    dp = [-(10 ** 9) * (k + 1)]
    dp[0] = 0

    for i in range(min(n, k)):
        i += 1
        vv = vvv[:i]
        vv.sort(reverse=True)
        sm = sum(vv)
        dp[i] = max(dp[i], sm)
        while i < k and vv and vv[-1] < 0:
            sm -= vv.pop()
            i += 1
            dp[i] = max(dp[i], sm)

    return list(accumulate(dp, func=max))


n, k = list(map(int, input().split()))
vvv = list(map(int, input().split()))

acl = make_dp(vvv, n, k)
acr = make_dp(reversed(vvv), n, k)

ans = max(acl[i] + acr[k - i] for i in range(k + 1))
ans = min(ans, sum(v for v in vvv if v > 0))
print(ans)


### FIXED CODE ###

from itertools import accumulate

n, k = list(map(int, input().split()))
vvv = list(map(int, input().split()))

dpl, dpr = [-10 ** 9] * (k + 1), [-10 ** 9] * (k + 1)
dpl[0] = dpr[0] = 0

for i in range(min(n, k)):
    i += 1
    vv = vvv[:i]
    vv.sort(reverse=True)
    sm = sum(vv)
    dpl[i] = max(dpl[i], sm)
    # print(i, vv, dpl)
    while i < k and vv:
        sm -= vv.pop()
        i += 1
        dpl[i] = max(dpl[i], sm)
    # print(i, vv, dpl)

vvv.reverse()

for i in range(min(n, k)):
    i += 1
    vv = vvv[:i]
    vv.sort(reverse=True)
    sm = sum(vv)
    dpr[i] = max(dpr[i], sm)
    # print(i, vv, dpr)
    while i < k and vv:
        sm -= vv.pop()
        i += 1
        dpr[i] = max(dpr[i], sm)
    # print(i, vv, dpr)

# print(dpl)
# print(dpr)
acl = list(accumulate(dpl, func=max))
acr = list(accumulate(dpr, func=max))
# print(acl)
# print(acr)
ans = 0
for i in range(k + 1):
    ans = max(ans, acl[i] + acr[k - i])
max_ans = sum(v for v in vvv if v > 0)
ans = min(ans, max_ans)
print(ans)
A, B, C, D, E, F = map(int, input().split())
# A *= 100
# B *= 100

max_solvent = 0
max_solute = 0
max_strength = 0.0

for na in range(0, 31):
    for nb in range(0, 31):
        for nc in range(0, 101):
            for nd in range(0, 101):

                solute = nc * C + nd * D
                solvent = 100 * na * A + 100 * nb * B

                # if not (any([na, nb]) and any([nc, nd])):
                    # continue
                if solvent == 0:
                    break

                if solute + solvent > F:
                    # print("exceeded")
                    break

                else:
                    # if (solvent/100) * E < solute:
                    if solvent/100 * E >= solute:
                    # print("exceeded2")
                    # break
                        strength = 100 * solute / (solute + solvent)
                        # print(strength, solvent+solute, solute)
                        if max_strength <= strength:
                            max_strength = strength
                            max_solute = solute
                            max_solvent = solute + solvent

print(max_solvent, max_solute)

### FIXED CODE ###

n = int(input())
a = int(input())
print(n*n-a)
A_B = input().split()
print(-(-(int(A_B[1])-1)//int(A_B[0])))


### FIXED CODE ###

# Sを入力する
S = list(input())
# Lを入力する
L = list(input())
 
# 3つの要素に定義しなおす
S1 = S[0]
S2 = S[1]
S3 = S[2]
L1 = L[0]
L2 = L[1]
L3 = L[2]
 
# 全部同じ
if S1 == L1 and S2 == L2 and S3 == L3:
  print(3)
# 全部違う
elif S1 != L1 and S2 != L2 and S3 != L3:
  print(0)
# 一つだけ
elif (S1 == L1 and S2 != L2 and S3 != L3) or (S1 != L1 and S2 == L2 and S3 != L3) or (S1 != L1 and S2 != L2 and S3 == L3):
  print(1)
# その他
else:
  print(2)
def main():
    S = input()
    # S = "1" * 200000
    S = S[::-1]

    x = float(1)
    tot = 0
    cnt = [0] * 2019
    ans = 0

    for i in range(len(S)):
        # print("-----")
        # print(f"i: {i}")
        # print(f"tot: {tot}")
        # print(f"S[i]: {S[i]}")
        # print(f"x: {x}")
        # print(f"cnt: {cnt}")
        # print(f"cnt[tot]: {cnt[tot]}")
        # print(f"ans: {ans}")

        cnt[tot] += 1
        tot = int((tot + (int(S[i]) * x)) % 2019)
        ans += cnt[tot]
        x = x * 10
    
    # print("-----")
    # print(f"i: {i}")
    # print(f"tot: {tot}")
    # print(f"S[i]: {S[i]}")
    # print(f"x: {x}")
    # print(f"cnt: {cnt}")
    # print(f"cnt[tot]: {cnt[tot]}")
    # print(f"ans: {ans}")
    
    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    S = input()
    # S = "1" * 200000
    S = S[::-1]

    x = 1
    tot = 0
    cnt = [0] * 2019
    ans = 0

    for i in range(len(S)):
        # print("-----")
        # print(f"i: {i}")
        # print(f"tot: {tot}")
        # print(f"S[i]: {S[i]}")
        # print(f"x: {x}")
        # print(f"cnt: {cnt}")
        # print(f"cnt[tot]: {cnt[tot]}")
        # print(f"ans: {ans}")

        cnt[tot] += 1
        tot = (tot + (int(S[i]) * x)) % 2019
        ans += cnt[tot]
        x = (x * 10) % 2019
    
    # print("-----")
    # print(f"i: {i}")
    # print(f"tot: {tot}")
    # print(f"S[i]: {S[i]}")
    # print(f"x: {x}")
    # print(f"cnt: {cnt}")
    # print(f"cnt[tot]: {cnt[tot]}")
    # print(f"ans: {ans}")
    
    print(ans)


if __name__ == '__main__':
    main()
# coding: utf-8
# hello worldと表示する
import sys
import numpy
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

a,b,c,d,e,f=MI()
wasser=[]
g=f//100
for i in range(int(f/a)+1):
    for j in range(int(f/a)+1):
        if a*i+b*j<=f//100:
            wasser.append(100*(a*i+b*j))
water=list(set(wasser))
water.sort()
#print(water)
sugar=[]
for x in water:
    sugar.append((min(f-x,e*x//100)))
#print(sugar)
sugmx=[]
for s in sugar:
    mx=0
    for i in range(s//c+1):
        for j in range(s//c+1):
            if mx<=c*i+d*j<=s:
                mx=c*i+d*j
    sugmx.append(mx)
#print(sugmx)
mix=-inf
for i in range(1,len(water)):
    u=sugmx[i]/water[i]
    #print(u)
    if u>=mix:
        mix=u
        ans1=sugmx[i]
        ans2=water[i]
print(ans2+ans1,ans1)

### FIXED CODE ###

# coding: utf-8
# hello worldと表示する
import sys
import numpy
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

a,b,c,d,e,f=MI()
wasser=[]
g=f//100
for i in range(int(f/a)+1):
    for j in range(int(f/a)+1):
        if a*i+b*j<=f//100:
            wasser.append(100*(a*i+b*j))
water=list(set(wasser))
water.sort()
#print(water)
sugar=[]
for x in water:
    sugar.append((min(f-x,e*x//100)))
#print(sugar)
sugmx=[]
for s in sugar:
    mx=0
    for i in range(s//c+1):
        for j in range(s//c+1):
            if mx<=c*i+d*j<=s:
                mx=c*i+d*j
    sugmx.append(mx)
#print(sugmx)
mix=-inf
for i in range(1,len(water)):
    u=sugmx[i]/water[i]
    #print(u)
    if u>=mix:
        mix=u
        ans1=sugmx[i]
        ans2=water[i]
print(ans2+ans1,ans1)
import math
import collections
import copy
import sys

n = int(input())

a = list(map(int,input().split()))

sCheck = math.gcd(a[0],a[1])
if n == 2:
    if sCheck == 1:
        print("pairwise coprime")
    else:
        print("not coprime")
    sys.exit()
else:
    for i in range(2,n):
        sCheck = math.gcd(sCheck,a[i])


beforeQ = collections.deque([i for i in range(3,(10**6 + 1))])
D = dict()
p = 2
D[2] = 2
D[1] = 1

while p < math.sqrt(10**6):
    afterQ = collections.deque()
    while len(beforeQ) > 0:        
        k = beforeQ.popleft()
        if k % p != 0:
            afterQ.append(k)
        else:
            D[k] = p
    beforeQ = copy.copy(afterQ)
    p = beforeQ.popleft()
    D[p] = p
    
ansSet = set()
count = 0

for i in a:
    k = i
    kSet = set()
    while k != 1:
        if D[k] in ansSet:
            if not(D[k] in kSet):
                count = 1
                break
        else:
            ansSet.add(D[k])
            kSet.add(D[k])
        k = k // D[k]

if count == 0:
    print("pairwise coprime")
elif sCheck == 1:
    print("setwise coprime")
else:
    print("not coprime")


### FIXED CODE ###

import math
import collections
import copy
import sys

n = int(input())

a = list(map(int,input().split()))

limit = 10 ** 6

sCheck = math.gcd(a[0],a[1])
if n == 2:
    if sCheck == 1:
        print("pairwise coprime")
    else:
        print("not coprime")
    sys.exit()
else:
    for i in range(2,n):
        sCheck = math.gcd(sCheck,a[i])


beforeQ = collections.deque([int(i) for i in range(3,(limit + 1))])
D = dict()
p = 2
D[2] = 2
D[1] = 1

while p < math.sqrt(limit):
    afterQ = collections.deque()
    while len(beforeQ) > 0:        
        k = beforeQ.popleft()
        if k % p != 0:
            afterQ.append(k)
        else:
            D[k] = p
    beforeQ = copy.copy(afterQ)
    p = beforeQ.popleft()
    D[p] = p
while len(beforeQ) > 0:
    k = beforeQ.popleft()
    D[k] = k
    
ansSet = set()
count = 0

for i in a:
    k = i
    kSet = set()
    while k != 1:
        if D[k] in ansSet:
            if not(D[k] in kSet):
                count = 1
                break
        else:
            ansSet.add(D[k])
            kSet.add(D[k])
        k = int(k // D[k])
    if count == 1:
        break

if count == 0:
    print("pairwise coprime")
elif sCheck == 1:
    print("setwise coprime")
else:
    print("not coprime")
s = ''
for i in range(3):
  s += [j for j in input().split()][i]
print(s)


### FIXED CODE ###

s = ''
for i in range(3): s += input()[i]
print(s)
#!/usr/bin/env python3
a, b = map(int, input().split())
if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else:
    print("a == b")

### FIXED CODE ###

#!/usr/bin/env python3
for x in range(1, 10):
    for y in range(1, 10):
        print("{0}x{1}={2}".format(x, y, x * y))