Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
total = 1
for i in range(N):
    total *= A[i]

if 10**18 < total:
    print("-1")
else:
    print(total)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
total = 1
if 0 < A.count(0):
    print(0)
else:
    for i in range(N):
        total *= A[i]
        if 10 ** 18 < total:
            break
    if 10**18 < total:
        print("-1")
    else:
        print(total)
### BUGGY CODE ###

n, m, k = map(int , input().split())
dif = set([i for i in range(1, n+1)])
m_list = [[] for _ in range(n+1)]
uni = [[i,1] for i in range(n+1)]
ab = [list(map(int, input().split())) for _ in range(m)]
cd = [list(map(int, input().split())) for _ in range(k)]
for i in range(m):
    a, b = ab[i]
    m_list[a].append(b)
    m_list[b].append(a)
    if uni[a][0] != uni[b][0]:
        a, b = sorted([uni[a][0], uni[b][0]])
        uni[a][1] += uni[b][1]
        for j in range(1, n+1):
            if uni[j][0] == b:
                uni[j][0] = a
        uni[b][0] = uni[a][0]

k_list = [[] for _ in range(n+1)]
for i in range(k):
    a, b = cd[i]
    if uni[a][0] == uni[b][0]:
        m_list[b].append(a)
        m_list[a].append(b)

result = []
for i in range(1, n+1):
    r = set(m_list[i])
    result.append(uni[uni[i][0]][1]-len(r)-1)

print(*result)

### FIXED CODE ###

class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return 
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]


n, m, k = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
cd = [list(map(int, input().split())) for _ in range(k)]
con = [1 for _ in range(n+1)]
uni = UnionFind(n+1)


for i in range(m):
    a, b = ab[i]
    con[a] += 1
    con[b] += 1
    uni.Unite(a, b)

for i in range(k):
    c, d = cd[i]
    if uni.isSameGroup(c,d):
        con[c] += 1
        con[d] += 1

result = []
for i in range(1, n+1):
    result.append(uni.Count(i)-con[i])
print(*result)
### BUGGY CODE ###

N = int(input())
ax = list(map(int,input().split()))

memo = {}
memo_size = min(1000,N)
for i in range(1, memo_size+1):
    memo[i] = 0

boxin = []
for cnt in range(N, 0, -1):
    a = ax[cnt-1]
    if cnt < memo_size:
        memo_cnt = memo[cnt]
    else:
        i = 2
        memo_cnt = 0
        while 1:
            test_val = i * cnt
            if test_val > N:
                break
            if test_val in boxin:
                memo_cnt += 1
            i += 1
    if a != memo_cnt % 2:
        boxin.append(cnt)
        for i in range(1,memo_size+1):
            if cnt % i == 0:
                memo[i] += 1

box = len(boxin)
print(box)
if box != 0:
    boxin.reverse()
    print(' '.join(map(str, boxin)))

### FIXED CODE ###

import math
N = int(input())
ax = list(map(int,input().split()))

M = 0
boxin = []
bx = [0 for _ in range(N+1)]
for cnt in range(N, 0, -1):
    a = ax[cnt-1]
    tmp = 0
    for tmp_cnt in range(cnt*2, N+1, cnt):
        if bx[tmp_cnt] != 0:
            tmp += 1
    
    if tmp % 2 != a:
        bx[cnt] = 1
        boxin.append(cnt)

box = len(boxin)
print(box)
if box != 0:
    boxin.reverse()
    print(' '.join(map(str, boxin)))
### BUGGY CODE ###

A, B, N = [int(i) for i in input().split()]

def f(x: int) -> int:
    return (A * x) // B - A * (x // B)

print(max(f(x) for x in range(1, N + 1)))


### FIXED CODE ###

A, B, N = [int(i) for i in input().split()]

def f(x: int) -> int:
    return (A * x) // B - A * (x // B)

x = min(N, B - 1)
print(f(x))
### BUGGY CODE ###

n,m = map(int,input().split())
a = []

for i in range(m):
    a.append(int(input()))

dp = [0] * (n+1)
dp[0] = 1

if 1 not in a:
    dp[1] = 1
    
for i in range(2,n+1):
    if i not in a:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
        
print(dp[n])

### FIXED CODE ###

N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])
INF = 1000000007

dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
	dp[1] = 1
else:
	dp[1] = 0
for i in range(2, N + 1):
	if i in a:
		continue
	dp[i] = dp[i - 1] + dp[i - 2]
	dp[i] %= INF

print(dp[N])
### BUGGY CODE ###

from functools import reduce
n = int(input())
lis = list(map(int,input().split()))
num = reduce(lambda x,y: x * y, lis)
print(num if num <= 10**18 else -1)


### FIXED CODE ###

n = int(input())
lis = list(map(int, input().split()))

if 0 in lis:
    print(0)
    exit()

res = 1
for i in lis:
    if res > 10**18:
        print(-1)
        exit()
    else:
        res *= i
print(res if res <= 10**18 else -1)
### BUGGY CODE ###

import numpy as np

N = int(input())
B = [int(i)*2 for i in input().split()]

a = [[0]*N for i in range(N)]

for i in range(N-1):
    a[i][i] += 1
    a[i][i+1] += 1

a[-1][0] += 1
a[-1][-1] += 1

A = np.array(a)
b = np.array(B)

x = np.linalg.solve(A, b)

#for i in x:
#    print(int(i), end=" ")
print(*x.astype(int))

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

s = sum(a)
x = [None]*N
x[0] = s - 2 * (sum(a[1::2]))

for i in range(1,N):
    x[i] = 2 * a[i-1] - x[i-1]

print(*x)
### BUGGY CODE ###

n = int(input())
listA = list(map(int,input().split()))
count = 0
for k in range(n):
  a = listA[k]
  listA.pop(k)
  A = set(listA)
  for i in A:
    c = listA.count(i)
    count += int(c*(c-1)/2)
  print(count)
  listA.insert(k,a)
  count = 0


### FIXED CODE ###

from collections import Counter
n = int(input())
su = 0
l = list(map(int,input().split()))
l1 = Counter(l)
for k in l1.values():
  su += k*(k-1)//2
for t in l:
  a = l1[t]
  q = su-a*(a-1)//2+(a-1)*(a-2)//2
  print(q)
### BUGGY CODE ###

L,R = map(int, input().split())

result = 2019
for i in range(L,R):
    for j in range(i+1,R+1):
        result = min(result,(i*j)%2019)

print(result)

### FIXED CODE ###

L, R = map(int, input().split())

result = 2019

for i in range(2019):
    if L+i > R-1:
        break;
    for j in range(i+1, 2019):
        if(L+j > R):
            break
        else:
            result = min(result,((L+i)*(L+j))%2019)

print(result)
### BUGGY CODE ###

import sys
from collections import deque
sys.setrecursionlimit(1000000)
N, K, L = map(int, input().split())
pq = [list(map(int, input().split())) for _ in range(K)]
rs = [list(map(int, input().split())) for _ in range(L)]

G_r = [[] for _ in range(N+1)]
for elem in pq:
    G_r[elem[0]].append(elem[1])
    G_r[elem[1]].append(elem[0])
G_t = [[] for _ in range(N+1)]
for elem in rs:
    G_t[elem[0]].append(elem[1])
    G_t[elem[1]].append(elem[0])


field_r = [[] for _ in range(N+1)]


def dfs_r(i):
    q = deque()
    q.append(i)
    field_r[i].append(i)
    while q:
        tmp = q.pop()
        for pos in G_r[tmp]:
            if pos not in field_r[i]:
                field_r[i].append(pos)
                q.append(pos)
            else:
                continue
for i in range(1, N+1):
    if not field_r[i]:
        dfs_r(i)

field_t = [[] for _ in range(N+1)]
cnt = [1 for _ in range(N+1)]


def dfs_t(i):
    q = deque()
    q.append(i)
    field_t[i].append(i)
    while q:
        tmp = q.pop()
        for pos in G_t[tmp]:
            if pos not in field_t[i]:
                field_t[i].append(pos)
                if pos in field_r[i]:
                    cnt[i] += 1
                q.append(pos)
            else:
                continue
for i in range(1, N+1):
    if not field_t[i]:
        dfs_t(i)

ans = []
for i in range(1, N+1):
    ans.append(cnt[i])
print(' '.join(map(str, ans)))


### FIXED CODE ###

import sys
from collections import deque, Counter
sys.setrecursionlimit(1000000)
N, K, L = map(int, input().split())
pq = [list(map(int, input().split())) for _ in range(K)]
rs = [list(map(int, input().split())) for _ in range(L)]

G_r = [[] for _ in range(N+1)]
for elem in pq:
    G_r[elem[0]].append(elem[1])
    G_r[elem[1]].append(elem[0])
G_t = [[] for _ in range(N+1)]
for elem in rs:
    G_t[elem[0]].append(elem[1])
    G_t[elem[1]].append(elem[0])


field_r = [None]*(N+1)


def dfs_r(i, idx):
    q = deque()
    q.append(i)
    field_r[i] = idx
    while q:
        tmp = q.pop()
        for pos in G_r[tmp]:
            if field_r[pos] is None:
                field_r[pos] = idx
                q.append(pos)
            else:
                continue
idx = 0
for i in range(1, N+1):
    if field_r[i] is None:
        dfs_r(i, idx)
        idx += 1


field_t = [None]*(N+1)


def dfs_t(i, idx):
    q = deque()
    q.append(i)
    field_t[i] = idx
    while q:
        tmp = q.pop()
        for pos in G_t[tmp]:
            if field_t[pos] is None:
                field_t[pos] = idx
                q.append(pos)
            else:
                continue
idx = 0
for i in range(1, N+1):
    if field_t[i] is None:
        dfs_t(i, idx)
        idx += 1

m = list(zip(field_r[1:], field_t[1:]))
cnt = Counter(m)
ans = []
for elem in list(m):
    ans.append(cnt[elem])
print(' '.join(map(str, ans)))
### BUGGY CODE ###

n, t = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

ab.sort()

dp = [0] * t

ans = 0
for a, b in ab:
    for i in range(t - 1, -1, -1):
        if i + a <= t - 1:
            dp[i+a] = max(dp[i+a], dp[i] + b)
        else:
            ans = max(ans, dp[i] + b)

print(ans)


### FIXED CODE ###

n, t = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

ab.sort()

dp = [[0] * t for _ in range(n + 1)]

ans = 0
for i, (a, b) in enumerate(ab):
    for j in range(t):
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        if j + a <= t - 1:
            dp[i+1][j+a] = max(dp[i+1][j+a], dp[i][j] + b)
        else:
            ans = max(ans, dp[i][j] + b)

print(ans)
### BUGGY CODE ###

n, m = map(int, input().split())
a = [int(input()) for i in range(m)]

r = [0]*(n+1)
r[0] = 1
if 1 in a:
  r[1] = 0
else:
  r[1] = 1
for i in range(2, n+1):
  if i in a:
    continue
  r[i] = (r[i-1] + r[i-2])%1000000007

print(r[n])

### FIXED CODE ###

n, m = map(int, input().split())
a = [0]*m
for i in range(m):
  a[i] = int(input())

up = [0]*(m+1)
if m == 0:
  up[0] = n
else:
  up[0] = a[0]-1
  up[m] = n - a[m-1]-1
  for i in range(m-1):
    up[i+1] = a[i+1]-a[i]-2

ans = 1
if -1 in up:
  ans = 0
else:
  f = [0]*(max(up)+1)
  f[0] = 1
  if max(up) > 0:
    f[1] = 1
    for i in range(2, max(up)+1):
      f[i] = f[i-1] + f[i-2]
  for i in range(m+1):
    ans *= f[up[i]]

print(ans % 1000000007)
### BUGGY CODE ###

h, w = map(int, input().split())
data = []

for i in range(h):
    s = input()
    data.append(s)

ans = 0

def search_x(i, j, x):
    res = 0
    plus = x
    while (j - x >= 0 and j - x < w) and data[i][j - x] == ".":
        res += 1
        x += plus
    return res

def search_y(i, j, y):
    res = 0
    plus = y
    while (i - y >= 0 and i - y < h) and data[i - y][j] == ".":
        res += 1
        y += plus
    return res


for i in range(h):
    for j in range(w):
        if data[i][j] != "#":
            ans = max(ans, search_x(i, j, -1) + search_x(i, j, 1) + search_y(i, j, -1) + search_y(i, j, 1))

print(ans + 1)

### FIXED CODE ###

h, w = map(int, input().split())
data = [list(input()) for _ in range(h)]

cnt_l, cnt_r, cnt_u, cnt_d = [[0] * w for _ in range(h)], [[0] * w for _ in range(h)], [[0] * w for _ in range(h)], [[0] * w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if data[i][j] == "#":
            cnt_l[i][j] = 0
        else:
            cnt_l[i][j] = cnt_l[i][j - 1] + 1
    
        if data[i][w - j - 1] == "#":
            cnt_r[i][w - j - 1] = 0
        else:
            if j == 0:
                cnt_r[i][w - j - 1] = 1
            else:
                cnt_r[i][w - j - 1] = cnt_r[i][w - j] + 1

for j in range(w):
    for i in range(h):
        if data[i][j] == "#":
            cnt_u[i][j] = 0
        else:
            cnt_u[i][j] = cnt_u[i - 1][j] + 1

        if data[h - i - 1][j] == "#":
            cnt_d[h - i - 1][j] = 0
        else:
            if i == 0:
                cnt_d[h - i - 1][j] = 1
            else:
                cnt_d[h - i - 1][j] = cnt_d[h - i][j] + 1

ans = 0
for i in range(h):
    for j in range(w):
        total= cnt_l[i][j] + cnt_r[i][j] + cnt_u[i][j] + cnt_d[i][j] - 3
        ans = max(ans, total)

print(ans)
### BUGGY CODE ###

count = 0
INFTY = 10 ** 10

def merge(A, left, mid, right):
  global count
  n1 = mid - left;
  n2 = right - mid;

  L = []
  R = []

  for i in range(n1):
    L.append(A[left + i])
  for i in range(n2):
    R.append(A[mid + i])

  L.append(INFTY)
  R.append(INFTY)

  i = 0
  j = 0
  for k in range(left, right):
    count = count + 1
    if L[i] <= R[j]:
      A[k] = L[i]
      i = i + 1
    else:
      A[k] = R[j]
      j = j + 1

def mergeSort(A, left, right):
  if left+1 < right:
    mid = int((left + right)/2);
    mergeSort(A, left, mid)
    mergeSort(A, mid, right)
    merge(A, left, mid, right)

import sys

n = sys.stdin.readline()
for line in sys.stdin:
  items = line.strip().split()
  items = [ int(x) for x in items ]
  mergeSort(items, 0, len(items))
  print(" ".join(map(str, items)))
  print(count)

### FIXED CODE ###

count = 0 
INFTY = 10 ** 10

def merge(A, left, mid, right):
  global count
  n1 = mid - left;
  n2 = right - mid;

  L = []
  R = []

  L = A[left:left+n1]
  R = A[mid:mid+n2]

  L.append(INFTY)
  R.append(INFTY)

  i = 0
  j = 0
  for k in range(left, right):
    count = count + 1
    if L[i] <= R[j]:
      A[k] = L[i]
      i = i + 1
    else:
      A[k] = R[j]
      j = j + 1

def mergeSort(A, left, right):
  if left+1 < right:
    mid = int((left + right)/2);
    mergeSort(A, left, mid)
    mergeSort(A, mid, right)
    merge(A, left, mid, right)

import sys

n = sys.stdin.readline()
for line in sys.stdin:
  items = line.strip().split()
  items = [ int(x) for x in items ]
  mergeSort(items, 0, len(items))
  print(" ".join(map(str, items)))
  print(count)
### BUGGY CODE ###

N = int(input())
A_list = list(map(int,input().split()))

for i in range(N):
    li = []
    for l in range(N):
        li.append(A_list[l])
    del li[i]
    ans = abs(li[0]) + abs(li[N-2])
    for m in range(N-2):
        ans += abs(li[m] - li[m+1])
    print(ans)


### FIXED CODE ###

N = int(input())
A_list = list(map(int,input().split()))
a = [0]
b = [0]
point_list = a + A_list + b
S = 0
for i in range(N+1):
    S += abs(point_list[i]-point_list[i+1])

for i in range(1,N+1):
    print(S - abs(point_list[i-1] - point_list[i])
    -abs(point_list[i] - point_list[i+1])
    +abs(point_list[i-1] - point_list[i+1]))
### BUGGY CODE ###

n, W = list(map(int, input().split()))
dp = [[0] * (W + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
    w, v = list(map(int, input().split()))
    for j in range(W + 1):
        if w > j:
            dp[i][j] = dp[i - 1][j]
        else:
            dp[i][j] = max(dp[i - 1][j - w] + v, dp[i - 1][j])
print(dp[n][W])


### FIXED CODE ###

n, W = list(map(int, input().split()))
dp = [[0] * (W + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
    w, v = list(map(int, input().split()))
    for j in range(W + 1):
        if w > j:
            dp[i][j] = dp[i - 1][j]
        else:
            dp[i][j] = max(dp[i - 1][j - w] + v, dp[i - 1][j])
print(dp[n][W])
### BUGGY CODE ###

import sys
input=sys.stdin.readline
n,m = map(int, input().split())
pqc=[list(map(int,input().split())) for i in range(m)]
from collections import defaultdict
from heapq import heappush, heappop,heappushpop,heapify
def dks(g,start):
    INF=float('inf')
    visited = defaultdict(int)
    hq = []
    heappush(hq, (0,start))
    cost = defaultdict(lambda: float("inf"))
    while hq:
        shortest, i = heappop(hq)
        if visited[i] != 0:
            continue
        visited[i] = 1
        cost[i] = shortest
        for j, t in g[i]:
            if visited[j] != 0:
                continue
            heappush(hq, (shortest + t, j))
    return cost

link = defaultdict(list)
for tmp in pqc:
    p,q,c=tmp
    p-=1
    q-=1
    c-=1
    link[(p,-1)].append([(p,c),1])
    link[(p,c)].append([(p,-1),1])
    link[(p,c)].append([(q,c),0])
    link[(q,c)].append([(p,c),0])
    link[(q,-1)].append([(q,c),1])
    link[(q,c)].append([(q,-1),1])

cost=dks(link,(0,-1))
ans=cost[n-1,-1]
if ans == float("inf"):
    print(-1)
else:
    print(ans//2)

### FIXED CODE ###

import sys
input=sys.stdin.readline
from collections import defaultdict
from heapq import heappush, heappop,heappushpop,heapify
n,m = map(int, input().split())
link = defaultdict(list)
chg=10**8
for _ in range(m):
    p,q,c=map(int, input().split())
    link[p].append([p+chg*c,1])
    link[p+chg*c].append([p,1])

    link[q+chg*c].append([p+chg*c,0])
    link[p+chg*c].append([q+chg*c,0])

    link[q+chg*c].append([q,1])
    link[q].append([q+chg*c,1])

def dks(g,start):
    INF=float('inf')
    visited = set()
    hq = []
    heappush(hq, (0,start))
    while hq:
        shortest, i = heappop(hq)
        if i in visited:
            continue
        visited.add(i)
        for j, t in g[i]:
            if j in visited:
                continue
            if j==n:
                return (shortest+t)//2
            heappush(hq, (shortest + t, j))
    return -1
ans=dks(link,1)
print(ans)
### BUGGY CODE ###

# A, B = [int(i) for i in input().split(" ")]
# A = int(input())
# As = [int(i) for i in input().split(" ")]
# Ss = ["".join(sorted(input())) for _ in range(N)]

N, K, Q = [int(i) for i in input().split(" ")]
As = [int(input()) for _ in range(Q)]
buff = [K for _ in range(N)]
for a in As:
  for i in range(N):
    # if buff[i] == 0: continue
    if i + 1 == a:
      buff[i] += 0
    else:
      buff[i] -= 1
for b in buff:
    if b > 0: print("Yes")
    else: print("No")



### FIXED CODE ###

# A, B = [int(i) for i in input().split(" ")]
# A = int(input())
# As = [int(i) for i in input().split(" ")]
# Ss = ["".join(sorted(input())) for _ in range(N)]

N, K, Q = [int(i) for i in input().split(" ")]
As = [int(input()) for _ in range(Q)]
buff = [K for _ in range(N)]
for a in As:
  i = a - 1
  buff[i] += 1
for b in buff:
    if b - Q > 0: print("Yes")
    else: print("No")
### BUGGY CODE ###

n = int(input())
li = list(map(int, input().split()))

ans = 1
flag = 0
for i in li:
  if i == 0:
    flag = 1
    break
  ans *= i

if flag == 1:
  print(0)
elif ans > 10**18:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

n = int(input())
li = list(map(int, input().split()))

"""
ans = 1
flag = 0
for i in li:
  if i == 0:
    flag = 1
    break
  ans *= i

if flag == 1:
  print(0)
elif ans > 10**18:
  print(-1)
else:
  print(ans)
"""
ans = 1
flag = 0
li.sort()
if li[0] == 0:
  print(0)
else:
  for i in li[::-1]:
    ans *= i
    if ans > 10**18:
      flag = 1
      break

  if flag == 0:
    print(ans)
  elif flag == 1:
    print(-1)
### BUGGY CODE ###

# C
N = int(input())
A=[]
for i in range(N):
    A.append(int(input()))
for i in range(len(A)):
    temp = A[i]
    A[i] = 0
    print(max(A))
    A[i] = temp

### FIXED CODE ###

# C
N = int(input())
A=[]
for i in range(N):
    A.append(int(input()))
max1 = max(A)#一番手
max_index = A.index(max1)#index
A.remove(max1)
max2 = max(A)

for i in range(N):
    if i==max_index:
        print(max2)
    else:
        print(max1)
### BUGGY CODE ###

S = input()
Q = int(input())

for i in range(0,Q,1):
    q = input()
    if q[0]=="1":
        S=S[::-1]

    elif q[0]=="2":
        num,F,C = q.split(sep=" ")
        if F=="1":
            S=C+S
        elif F=="2":
            S=S+C
print(S)

### FIXED CODE ###

S = input()
Q = int(input())
q = [input() for i in range(Q)]
reverse = False
p =[]
f =[]
appP = p.append
appF = f.append

for i in range(0,Q,1):
    if q[i][0]=="1":
        reverse=not reverse

    elif q[i][0]=="2":
        num,F,C = q[i].split(sep=" ")
        if F=="1":
            if reverse == False:
                appP(C)
            else:
                appF(C)
        elif F=="2":
            if reverse == False:
                appF(C)
            else:
                appP(C)
if reverse:
    tmpP="".join(p)
    tmpF="".join(f[::-1])
    print(tmpF+S[::-1]+tmpP)
else:
    tmpF="".join(f)
    tmpP="".join(p[::-1])
    print(tmpP+S+tmpF)
### BUGGY CODE ###

a, b = map(int, input().split())
alist = []

def check_a(n):
  d = 2
  while n >= d:
    if (n % d == 0):
      if d not in alist:
        alist.append(d)
      n /= d
    else:
      d += 1
      
def check_b(n):
  count = 1
  last = 0
  d = 2
  while n >= d:
    if (n % d == 0):
      if d in alist:
        if d != last:
        	count += 1; last = d
      n /= d
    else:
      d += 1
  return count

check_a(a)
print(check_b(b))


### FIXED CODE ###

import fractions
a, b = map(int, input().split())
x = fractions.gcd(a, b)
t = x

i = 2
ans = 1;
while i * i <= t:
  if x % i == 0:
    while x % i == 0:
      x /= i
    ans += 1
  i += 1
if x != 1:
  ans += 1

print(ans)