Harryxun/stf_run huggingface dataset:
n = int(input())
a = list(map(int,input().split()))
flag = [True for i in range(10**6)]
a.sort()
for i in range(n):
    if flag[a[i]-1] == False:
        continue
    if i >= 1:
        if a[i] == a[i-1]:
            continue
    for j in range(2,(10**6)//a[i]+1):
        flag[a[i]*j-1] = False
ans = 0
for i in range(n):
    if flag[a[i]-1]:
        if i >= 1:
            if a[i] == a[i-1]:
                continue
        if i == 0:
            if a[i] == a[i+1]:
                continue
        ans+=1
print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
if n == 1:
    print(1)
    exit()
flag = [True for i in range(10**6+1)]
a.sort()
for i in range(n):
    if flag[a[i]] == False:
        continue
    if i >= 1:
        if a[i] == a[i-1]:
            continue
    for j in range(2,(10**6)//a[i]+1):
        flag[a[i]*j] = False
ans = 0
for i in range(n):
    if flag[a[i]]:
        if i >= 1:
            if a[i] == a[i-1]:
                continue
        if i < n-1:
            if a[i] == a[i+1]:
                continue
        ans+=1
print(ans)
from fractions import gcd
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

def lcm(values):
    ans = values[0]
    for i in range(1, len(values)):
        ans = ans * values[i] // gcd(ans, values[i])
    return ans

def count_div2(value):
    count = 0
    while value % 2 == 0:
        count += 1
        value //= 2
    return count

min_value = lcm(A)
amount = M * 2 // min_value

div2 = count_div2(A[0])
if any([count_div2(a) != amount_div2 for a in A]):
    print(0)
else:
    print((amount + 1) // 2)


### FIXED CODE ###

from fractions import gcd
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

def lcm(values):
    ans = values[0]
    for i in range(1, len(values)):
        ans = ans * values[i] // gcd(ans, values[i])
    return ans

def count_div2(value):
    count = 0
    while value % 2 == 0:
        count += 1
        value //= 2
    return count

min_value = lcm(A)
amount = M * 2 // min_value

div2 = count_div2(A[0])
if any([count_div2(a) != div2 for a in A]):
    print(0)
else:
    print((amount + 1) // 2)
N,M=map(int,input().split())
store=[]
for _ in range(M):
  store.append([map(int,input().split())])
store.sort(key=lambda x: x[0])
res=0
for i in range(len(store)):
  if M-store[i][1]<=0:
    res+=store[i][0]*M
    break
  else:
    res+=store[i][0]*store[i][1]
    M-=store[i][1]
print(res)


### FIXED CODE ###

N, M = map(int, input().split())
shop = []
for i in range(N):
    a, b = map(int, input().split())
    shop.append([a, b])
shop.sort(key=lambda x: x[0])

amount = 0
quantity = 0
for s in shop:
    if quantity + s[1] < M:
        amount += s[0] * s[1]
        quantity += s[1]
    else:
        amount += (M - quantity) * s[0]
        quantity = M
        break

print(amount)
L,R=map(int, input().split())
n=R-L
x=[i+L for i in range(n)]
ans=[]

for i in range(n):
    l=L+i
    for j in range(i+1, n):
        r=l+j
        if r >= R:
            break
        ans.append((l*r) % 2019)
print(min(ans))

### FIXED CODE ###

L,R=map(int, input().split())
n=R-L
ans=[]
if n == 1:
    print((L*R)%2019)
elif n < 2019:
    for i in range(n+1):
        for j in range(1,n+1):
            l=L+i
            r=l+j
            if r > R:
                break
            ans.append((l*r) % 2019)
    print(min(ans))
else:
    print(0)
a=int(input())
li = list(map(int,input().split()))
 
n=1
for i in li:
	n=n*i
	if(n>1000000000000000000):
		n=-1
		break
print(n)

### FIXED CODE ###

x,y = map(int,input().split())	
print(x*y)
k, n = input().split()
k, n = int(k), int(n)
a = list(map(int, input().split()))

max = 0

for i in range(n - 1):
  if a[i + 1] - a[i] > max:
    max = a[i + 1] - a[i]

if (k - a[n]) + a[0] >= max:
  max = (k - a[n]) + a[0]

print(k - max)


### FIXED CODE ###

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

max = 0

for i in range(n - 1):
  if a[i + 1] - a[i] > max:
    max = a[i + 1] - a[i]

if (k - a[n - 1]) + a[0] >= max:
  max = (k - a[n - 1]) + a[0]

print(k - max)
a,b,c,d = map(int,input().split())

if abs(a-c) <= d or(abs(a-b)<=d and abs(c-b)<=d:
	print('Yes')
else:
	print('No')

### FIXED CODE ###


a,b,c,d = map(int,input().split())

if abs(a-c) <= d or(abs(a-b)<=d and abs(c-b)<=d):
    print('Yes')
else:
    print('No')
from _overlapped import NULL
n = int(input())
a = list(map(int,input().split()))
ans = NULL
for i in range(n):
    tmp = abs(sum(a[:i])-sum(a[i:]))
    if ans == NULL:
        ans = tmp
    if tmp < ans:
        ans = tmp
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = -1
sum_ = sum(a)
sunuke = 0
for i in range(n-1):
    sum_ -= a[i]
    sunuke += a[i]
    tmp = abs(sum_ - sunuke)
    if ans == -1:
        ans = tmp
    if ans > tmp:
        ans = tmp
print(ans)
N,K,X,Y=map(int,input().split(sep))
if N>K:
    print(int((K*X)+((N-K)*Y)))
else:
    print(int(N*X))

### FIXED CODE ###

N=int(input())
K=int(input())
X=int(input())
Y=int(input())
if N>K:
    print(K*X+(N-K)*Y)
else:
    print(N*X)
A. B = map(int,input().split())
print(A * B)

### FIXED CODE ###

A, B = map(int,input().split())
print(A * B)
s=input()
cnt=0
ans="No"
flag=True
while cnt<len(s):
  if s[cnt]=="h" and s[cnt+1]=="i":
    cnt+=2
    continue
  else:
    flag=False
    break
if flag:
  ans="Yes"
print(ans)

### FIXED CODE ###

s=input()
cnt=0
ans="No"
flag=True

while cnt<len(s):
  if len(s)==1 or len(s)%2==1:
    flag=False
    break
  if s[cnt]=="h" and s[cnt+1]=="i":
    cnt+=2
    continue
  else:
    flag=False
    break
if flag:
  ans="Yes"
print(ans)
n,m = int(input().split())
print((n-1)*(m-1))

### FIXED CODE ###

n,m = map(int, input().split())
print((n-1)*(m-1))
n, q = map(int, input().split(' '))

inf = [[] for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split(' '))
    inf[a-1].append(b-1)
    inf[b-1].append(a-1)
point = [0 for _ in range(n)]
for i in range(q):
    p, x = map(int, input().split(' '))
    point[p-1] += x
def add(num):
    if len(inf[num]) == 0:
        return 0
    for k in inf[num]:
        inf[k].remove(num)
        point[k] += point[num]
        add(k)

add(0)
print(*point)

### FIXED CODE ###

def main():
    n, q = map(int, input().split(' '))
    import sys
    from collections import deque
    sys.setrecursionlimit(10**7)

    visit = [True for _ in range(n)]
    point = [0 for _ in range(n)]
    dic = [[] for _ in range(n)]
    for _ in range(n-1):
        a, b = map(int, input().split(' '))
        dic[a-1].append(b-1)
        dic[b-1].append(a-1)
    for _ in range(q):
        p, x = map(int, input().split(' '))
        point[p-1] += x
    next_visit = deque()
    next_visit.append(0)
    visit[0] = False
    counter = 1
    while counter < n:
        t = next_visit.pop()
        for s in dic[t]:
            if visit[s]:
                point[s] += point[t]
                visit[s] = False
                counter += 1
                next_visit.append(s)
    print(*point)
if __name__ == '__main__':
    main()
import sys
l, r = map(int, input().split())
for i in range(l, r-1):
  for j in range(i+1, r):
    if i*j%2019 == 0:
      print(0)
      sys.exit()
    elif ans > i*j%2019:
      ans = i*j%2019
print(ans)

### FIXED CODE ###

import sys
l, r = map(int, input().split())
ans = l*r%2019
for i in range(l, r):
  for j in range(i+1, r+1):
    if i*j%2019 == 0:
      print(0)
      sys.exit()
    elif ans > i*j%2019:
      ans = i*j%2019
print(ans)
import sys
input = sys.stdin.readline

N = int(input())
A = [None]*N
B = [None]*N
K = 0

adj_list=[[] for _ in range(N)]
c_list = [[] for _ in range(N)]
c_min_list=[-1]*N #A[i]に隣接する中で使っている色の最小値をメモ

for i in range(N-1):
    A[i],B[i] = map(int,input().split())
    adj_list[A[i]-1].append(B[i]-1)
    adj_list[B[i]-1].append(A[i]-1)
    
#幅優先で着色
def bfs(node_num,p_num,p_col):
    for i in range(len(adj_list[node_num])):
        to=adj_list[node_num][i]
        #親以外につながる辺を塗る
        if to!=p_num:
            #色を決める
            c_to = c_min_list[node_num]+1
            if c_to==p_col:
                c_to+=1
            c_min_list[node_num] = c_to
            c_list[node_num].append((to,c_to))
            c_list[to].append((node_num,c_to))
            bfs(to,node_num,c_to)



#計算，出力
bfs(0,-1,N)
K = max(c_min_list)+1
print(K)
for i in range(N-1):
    for j in range(N-1):
        if c_list[A[i]-1][j][0]==B[i]-1:
            print(c_list[A[i]-1][j][1]+1)
            break

### FIXED CODE ###

#Edgeの組を拾う時に，辞書が良いかも？
import sys
input = sys.stdin.readline

N = int(input())
E=[[] for _ in range(N)]

index ={}

for i in range(N-1):
    a,b = map(int,input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)
    index[(a-1,b-1)]=i
    index[(b-1,a-1)]=i

K=0
#ここに答えを入れていく，
ans=[None]*(N-1)

#dfs,root=-1
#Q=[(node,pare)]
Q=[(0,-1)]
while(Q):
    node,p=Q.pop()
    col=1
    #根の時
    if p==-1:
        for to in E[node]:
            #ansの適切な位置に色情報を入れる
            ans[index[(node,to)]]=col
            col +=1
            K=max(col,K)
            Q.append((to,node))
    #根ではない時
    else:
        for to in E[node]:
            if to==p:
                continue
            #親の色と同じなら1を足す．
            col+=(col==ans[index[(node,p)]]) 
            ans[index[(node,to)]]=col
            col+=1
            K=max(col,K)
            Q.append((to,node))

print(K-1)
print(*ans,sep="\n")
import heapq
n,m=map(int,input().split())
a=[int(i) for i in input().split()]
d={}
l,q=[],[]
for i in a:
    if i in d: d[i]+=1
    else: d[i]=1

for i in d: heapq.heappush(q, i)

for i in range(m):
    b,c=map(int,input().split())
    l.append((c,b))
l.sort(reverse=True)

for c,b in l:
    while b:
        if c<=q[0] or len(q)==0: break
        x=min(b,d[q[0]])
        if c in d:
            d[c]+=x
        else:
            d[c]=x
        b-=x
        d[q[0]]-=x
        if d[q[0]]==0:
            heapq.heappop(q)
ans=0
for i in d:
    ans+=i*d[i]
print(ans)

### FIXED CODE ###

import heapq
def sol():
    n,m=map(int,input().split())
    a=[int(i) for i in input().split()]
    d={}
    w=[]
    q=[]
    for i in a:
        if i in d:
            d[i]+=1
        else:
            d[i]=1
            w.append(i)
    for i in w: heapq.heappush(q, i)
    for i in range(m):
        b,c=map(int,input().split())
        while b:
            if c>q[0]:
                x=min(b,d[q[0]])
                if c in d:
                    d[c]+=x
                    b-=x
                    d[q[0]]-=x
                    if d[q[0]]==0:
                        heapq.heappop(q)
                else:
                    d[c]=x
                    b-=x
                    d[q[0]]-=x
                    heapq.heappush(q,c)
                    if d[q[0]]==0:
                        heapq.heappop(q)
            else:
                break
    ans=chk=0
    for i in d:
        ans+=i*d[i]
    print(ans)

if __name__=="__main__":
    sol()
x=input()
X=int(x)
if (X>40||X<-40):
  return 0
elif(X=>30&&X=<40):
  print('Yes')
elif(X=>-40&&X<30):
  print('No')


### FIXED CODE ###

x=input()
X=int(x)
if(X>=30 and X<=40):
  print('Yes')
elif(X>=-40 and X<30):
  print('No')
# 初期入力
import numpy as np
import sys
input = sys.stdin.readline
N,M = (int(i) for i in input().split())
A = list(map(int, input().split()))
A =np.array(A,dtype=np.int64)
take =[[-1] for i in range(M)]
#num =[-1]*M
for x in range(M):
    B,C = (int(i) for i in input().split())
    take[x] =B,C
    #num[i] =C

#
A.sort()
#take =[0] +take
#num =[0] +num
take.sort(key=lambda x: x[1], reverse=True)
take =[(0,0)] +take
ind =[0]*(M+1)
for i in range(1,M+1): #初項に「０」足したから「M]まで
    ind[i] =ind[i-1] +take[i][0]
    if A[ind[i-1]] >take[i][1]:
        break
    A[ind[i-1]:ind[i]] =np.where(A[ind[i-1]:ind[i]] < take[i][1] ,take[i][1],A[ind[i-1]:ind[i]])
print(sum(A))

### FIXED CODE ###

# 初期入力
#import numpy as np
import sys
input = sys.stdin.readline
N,M = (int(i) for i in input().split())
A = list(map(int, input().split()))
take =[[-1] for i in range(M)]
for x in range(M):
    B,C = (int(i) for i in input().split())
    take[x] =B,C

#
A.sort()
take.sort(key=lambda x: x[1], reverse=True)
take =[(0,0)] +take
ind =[0]*(M+1)
for i in range(1,M+1): #初項に「０」足したから「M]まで
    ind[i] =ind[i-1] +take[i][0]
    if ind[i-1] >=N:
        break
    elif A[ind[i-1]] >=take[i][1]:
        break
    elif ind[i] <N and A[ind[i]] <take[i][1]: #全て一括で置き換える
        A[ind[i-1] :ind[i]] =[take[i][1] ] *(take[i][0]) 
    else:
        for j in range(ind[i-1],ind[i]): #最後は1つずつ確認しながら置き換える
            if N <= j:
                break
            if A[j] <take[i][1]:
                A[j] =take[i][1]
            else:
                break
print(sum(A))
import math

def reduce(function, iterable, initializer=None):
    it = iter(iterable)
    if initializer is None:
        value = next(it)
    else:
        value = initializer
    for element in it:
        value = function(value, element)
    return value

N, X = map(int,input().split())
city = list(map(int,input().split()))
X_diff = [0]*N
for i in range(N):
    X_diff[i] = abs(X-city[i])

ans = reduce(math.gcd, X_diff)
print(ans)

### FIXED CODE ###

def gcd(a,b):   #　ユーグリッドの互除法
    if b == 0:
        return a
    return gcd(b, a % b)

N, X = map(int,input().split())
city = list(map(int,input().split()))
X_diff = [0]*N
for i in range(N):
    X_diff[i] = abs(X-city[i])
    
ans = X_diff[0]
for i in range(1,N):
    ans = gcd(ans,X_diff[i])

print(ans)
import sys
from itertools import permutations

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N = int(input())
    assert N <= 8

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

    for i in range(N - 1):
        if X[i] + 1 == X[i + 1] and X[i] > 1 and X[i-1] < X[i] - 1:
            X[i] -= 1
    cnt = 0
    MOD = 10**9 + 7
    k = 0

    for pm in permutations(range(N)):
        Xc = X[:]
        flag = True

        for p in pm:
            for i in range(p-1, 0, -1):
                if Xc[i] == Xc[i - 1] + 1 and Xc[i - 1] == 1:
                    flag = False
                    break
            if flag:
                break
            Xc[p] = -(1 + 2*i)
            k += 1

        cnt += flag

        # if flag:
            # print(list(pm))

    print(cnt % MOD)


if __name__ == '__main__':
    solve()

### FIXED CODE ###

import sys
from math import factorial

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N = int(input())
    X = [int(i) for i in input().split()]
    MOD = 10**9 + 7
    ans = 1
    stack = 0

    for x in X:
        stack += 1
        if x < 2*(stack - 1) + 1:
            ans *= stack
            ans %= MOD
            stack -= 1

    ans *= (factorial(stack) % MOD)
    ans %= MOD

    print(ans)


if __name__ == '__main__':
    solve()
N=int(input())
A=list(map(int,input().split()))
from collections import Counter
two=0
a=Counter(A)
for k,v in a.items():
  if v==2:
    two=k
LR=[]
for i in range(N):
  if A[i]==two:
    LR.append(i)
L=LR[0]
R=LR[1]
mod=10**9+7
P=[1 for i in range(10**6+1)]
for i in range(10**6):
  P[i+1]=P[i]*(i+1)%mod
L+=1
R+=1
def comb(a,b):
  if a>=b:
    return P[a]*pow(P[a-b],mod-2,mod)*pow(P[b],mod-2,mod)%mod
  else:
    return 0

for i in range(1,N+2):
  print(comb(N+1,i)-comb(N+L-R,i-1))

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
from collections import Counter
two=0
a=Counter(A)
for k,v in a.items():
  if v==2:
    two=k
LR=[]
for i in range(N+1):
  if A[i]==two:
    LR.append(i)
L=LR[0]
R=LR[1]
mod=10**9+7
P=[1 for i in range(10**6+1)]
for i in range(10**6):
  P[i+1]=P[i]*(i+1)%mod
L+=1
R+=1
def comb(a,b):
  if a>=b:
    return P[a]*pow(P[a-b],mod-2,mod)*pow(P[b],mod-2,mod)%mod
  else:
    return 0

for i in range(1,N+2):
  print((comb(N+1,i)-comb(N+L-R,i-1))%mod)
m,n=map(int,input().split())
x=[]
for i in range(m):
  a=list(map(int,input().split()))
  x.append(a)
y=[]
for i in range(m):
  z=[0,0,0,0,0,0,0,0]
  z[0]=x[i][0]+x[i][1]+x[i][2]
  z[1]=x[i][0]+x[i][1]-x[i][2]
  z[2]=x[i][0]-x[i][1]+x[i][2]
  z[3]=x[i][0]-x[i][1]-x[i][2]
  z[4]=-x[i][0]+x[i][1]+x[i][2]
  z[5]=-x[i][0]+x[i][1]-x[i][2]
  z[6]=-x[i][0]-x[i][1]+x[i][2]
  z[7]=-x[i][0]-x[i][1]-x[i][2]
  y.append(z)
sort(y,axis=0)
z=[0,0,0,0,0,0,0,0]
for i in range(m-1,m-n-1):
  for j in range(8):
  	z[j]+=y[i][j]
sort(z)
print(z[7])

### FIXED CODE ###

import numpy as np
m,n=map(int,input().split())
x=[]
for i in range(m):
  a=list(map(int,input().split()))
  x.append(a)
y=[]
for i in range(m):
  z=[0,0,0,0,0,0,0,0]
  z[0]=x[i][0]+x[i][1]+x[i][2]
  z[1]=x[i][0]+x[i][1]-x[i][2]
  z[2]=x[i][0]-x[i][1]+x[i][2]
  z[3]=x[i][0]-x[i][1]-x[i][2]
  z[4]=-x[i][0]+x[i][1]+x[i][2]
  z[5]=-x[i][0]+x[i][1]-x[i][2]
  z[6]=-x[i][0]-x[i][1]+x[i][2]
  z[7]=-x[i][0]-x[i][1]-x[i][2]
  y.append(z)
p=np.array(y)
sidx = p.argsort(axis=0)
p=p[sidx, np.arange(sidx.shape[1])]
z=[0,0,0,0,0,0,0,0]
for i in range(m-1,m-n-1,-1):
  for j in range(8):
  	z[j]+=p[i][j]
print(max(z))
a, b, x = map(int, input().split())
n = 0
for i in range(a, b+1):
  if i%x == 0:
    p = i
    n += 1
    break

while p < b:
  p += x
  n += 1

n -= 1
print(n)
  
  

### FIXED CODE ###

a, b, x = map(int, input().split())

print(b//x-(a-1)//x)
h, w = map(int, input().split())

a = []
b = list([['#']*(w+2)]*(h+2)) #[]で囲うことが重要


for i in range(h):
    a.append(list(input())) #splitを入れなければOK

for j in range(h):
    for k in range(w):
    b[j+1][k+1] = a[j][k]

print(b)


### FIXED CODE ###

h, w = map(int, input().split())

sh = '#'

print(sh * (w+2))
[print(sh + input() + sh) for i in range(h)]
print(sh * (w+2))
S = input()
T = input()
tmp = ''
res = ''

count = 0
for i in range(len(S) - len(T) + 1):
    for j in range(len(T)):
        start = i
        end = i + j
        if S[i+j] == T[j]:
            tmp += T[j]
        elif S[i+j] == '?':
            tmp += '?'
        else:
            start = 0
            end = 0
            break
            
if (start == 0) and (end == 0):
    print('UNRESTORABLE')
    
else:
    j = 0
    for i in range(len(S)):
        if start <= i <= end:
            res += T[j]
            j += 1

        elif S[i] == '?':
            res += 'a'

        else:
            res += S[i]

    print(res)

### FIXED CODE ###

S = input()
T = input()


    
if True:
    tmp = -1
    for i in range(len(S) - len(T) + 1):
        start = -1
        for j in range(len(T)):
            if S[i+j] == T[j] or S[i+j] == '?':
                start = i
            else:
                start = -1
                break
                
        
        if start != -1:
                tmp = i
    if tmp == -1:
        print('UNRESTORABLE')
    else:
        res = ''
        count = 0
        for i in range(len(S)):
            if tmp <= i < tmp + len(T):
                res += T[count]
                count += 1
            elif S[i] == '?':
                res += 'a'
            else:
                res += S[i]

        print(res)
N = int(input())
V = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

XY = 0

for i in range(N):
    XY += np.maximum(0, V[i]-C[i])

print(XY)

### FIXED CODE ###


N = int(input())
V = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

XY = 0

for i in range(N):
    if (V[i]-C[i]) > 0 :
        XY += V[i]-C[i]

print(XY)
S = input()
S1 = S[:1]
S2 = S[2:]
month = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']

if S1 in month and S2 in month:
	print('AMBIGUOUS')
elif S1 in month:
	print('MMYY')
elif S2 in month:
	print('YYMM')
elif S1 == '00': 
	print('MMYY')
elif: S2 == '00':
	print('YYMM')
else:
	print('NA')

### FIXED CODE ###

S = input()
S1 = int(S[:2])
S2 = int(S[2:])

if (1 <= S1 <= 12) and (1 <= S2 <= 12):
	print('AMBIGUOUS')
elif (1 <= S1 <= 12):
	print('MMYY')
elif (1 <= S2 <= 12):
	print('YYMM')
else:
	print('NA')
x, a = list(map(inte, input().split()))
if x < a:
  print (0)
else:
  print(10)

### FIXED CODE ###

x, a = list(map(int, input().split()))
if x < a:
  print (0)
else:
  print(10)
b,s=-1e7,1e7
for _ in range(int(input())):
 r=int(input())
 b,s=max(b,c-s),min(s,c)
print(b)


### FIXED CODE ###

import sys
def f():
 s=1e10;b=-s
 input()
 for r in map(int,sys.stdin):
  if b<r-s:b=r-s
  if s>r:s=r
 print(b)
f()
import math
mod = 10**9+7
N = int(input())

iwashi01 = 0
iwashi10 = 0
iwashi00 = 0
iwashi = dict()
for i in range(N):
    a, b = map(int, input().split())
    g = math.gcd(abs(a), abs(b))
    a //= g; b //= g
    if a == 0 and b == 0:
        iwashi00 += 1
    elif a == 0:
        iwashi01 += 1
    elif b == 0:
        iwashi10 += 1            
    else:
        if a*b > 0:
            if a < 0 and b < 0:
                a *= -1
                b *= -1
            iwashi.setdefault((a, b), [0, 0])
            iwashi[(a, b)][0] += 1
        if a*b < 0:
            if a < 0 and b > 0:
                a *= -1
                b *= -1
            a, b = -b, a
            iwashi.setdefault((a, b), [0, 0])
            iwashi[(a, b)][1] += 1

r = 2**iwashi01 % mod - 1 + 2**iwashi10 % mod - 1 + 1
for s, t in iwashi.values():
    r *= 2**s % mod -1 + 2**t % mod -1 + 1
        r %= mod
    print(r + iwashi00 - 1)

### FIXED CODE ###

import math
mod = 10**9+7
N = int(input())

iwashi01 = 0
iwashi10 = 0
iwashi00 = 0
iwashi = dict()
for i in range(N):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        iwashi00 += 1
    elif a == 0:
        iwashi01 += 1
    elif b == 0:
        iwashi10 += 1            
    else:
        g = math.gcd(abs(a), abs(b))
        a //= g; b //= g
        if a*b > 0:
            if a < 0 and b < 0:
                a *= -1
                b *= -1
            iwashi.setdefault((a, b), [0, 0])
            iwashi[(a, b)][0] += 1
        if a*b < 0:
            if a < 0 and b > 0:
                a *= -1
                b *= -1
            a, b = -b, a
            iwashi.setdefault((a, b), [0, 0])
            iwashi[(a, b)][1] += 1

r = 2**iwashi01 % mod - 1 + 2**iwashi10 % mod - 1 + 1
for s, t in iwashi.values():
    r *= 2**s % mod -1 + 2**t % mod -1 + 1
    r %= mod
print((r + iwashi00 - 1) % mod)
N = int(input())
H = list(map(int, input().split()))
a = H[0]
for i in range(1,N-1):
    a = max(H[i], a)
    b = H[i+1]
    if a - b >= 2:
        print("No")
        break
print("Yes")

### FIXED CODE ###

A, B, C = map(int, input().split())
print(C-(A-B) if C >= (A-B) else '0')
N = int(input())
S = input()
temp=0
for i in range(N-1):
    S1=S[0:i+1]
    S2=S[i+1:N]
#    print(S1 + " " + S2)
    kaburi=[]
    for s in S1:
        if s in S2 and s not in kaburi:
            kaburi.append(s)
    print (kaburi)
    if len(kaburi)>temp:
        temp = len(kaburi)
print(temp)

### FIXED CODE ###

a,b = [int(i) for i in input().split()]
m = max(a+b,a-b,a*b)
print(m)