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

#coding:utf-8
import sys,os
from collections import defaultdict, deque
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    N = II()
    print(0)
    g = {'Vacant':0, 'Male':1, 'Female':2}
    a = top = g[input()]
    i = 1
    while True:
        print(i)
        a = g[input()]
        if a == 0:
            return
        if a != top:
            i *= 2
        else:
            i = i // 2 + 1 




if __name__ == '__main__':
    main()

### FIXED CODE ###

#coding:utf-8
import sys,os
from collections import defaultdict, deque
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    N = II()
    g = {'Vacant':0, 'Male':1, 'Female':2}



    print(0,flush=True)
    sl = g[input()]
    if sl == 0:
        return

    print(N-1,flush=True)
    sr = g[input()]
    if sr == 0:
        return
    
    l = 0
    r = N-1
    while r-l>1:

        m = (l+r)//2
        print(m,flush=True)
        a = g[input()]
        if a == 0:
            return
        
        if (m-l) % 2 == 1:
            if sl == a:
                r = m
                sr = a
            else:
                l = m
                sl = a

        else:
            if a != sl:
                r = m
                sr = a
            else:
                l = m
                sl = a
        

    print(-1)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))

dp = [False]*(K+1)

for i in range(K+1):
    for j in range(N):
        if i-A[j]>=0 and dp[i-A[j]] == False:
            dp[i] = True

        
if dp[K]:
    print("First")
else:
    print("Second")

### FIXED CODE ###

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

dp = [False]*(k+1)

for stones in range(k+1):
    for x in arr:
        if stones >= x and dp[stones-x] == False:
            dp[stones] = True

if dp[k]:
    print("First")
else:
    print("Second")
### BUGGY CODE ###

from heapq import heappush, heappop
import sys
input = sys.stdin.readline


def dijkstra(edges, size, source):
    distance = [float('inf')] * size
    distance[source] = 0
    visited = [False] * size
    pq = []
    heappush(pq, (0, source))
    while pq:
        dist_v, v = heappop(pq)
        visited[v] = True
        for u, weight in edges[v]:
            if not visited[u]:
                new_dist = dist_v + weight
                if distance[u] > new_dist:
                    distance[u] = new_dist
                    heappush(pq, (new_dist, u))
    return distance


N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
G = [[] for _ in range(N)]
edges = []
for i in range(N-1):
    for j in range(i+1, N):
        edges.append((A[i][j], i, j))
edges.sort(reverse=True)
ans = 0
while edges:
    d, u, v = edges.pop()
    dist = dijkstra(G, N, u)
    if d > dist[v]:
        ans = -1
        break
    if d < dist[v]:
        ans += d
        G[u].append((v, d))
        G[v].append((u, d))
print(ans)


### FIXED CODE ###

from copy import deepcopy
import sys
input = sys.stdin.readline


def floyd_warshall(dist):
    v = len(dist)
    for k in range(v):
        for i in range(v):
            for j in range(v):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])


N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
dist = deepcopy(A)
floyd_warshall(dist)
edges = []
for u in range(N-1):
    for v in range(u+1, N):
        edges.append((A[u][v], u, v))
edges.sort()
ans = 0
for d, u, v in edges:
    if dist[u][v] < d:
        ans = -1
        break
    ok = False
    for w in range(N):
        if w == u or w == v:
            continue
        if dist[u][w] + dist[w][v] == dist[u][v]:
            ok = True
            break
    if not ok:
        ans += d
print(ans)
### BUGGY CODE ###

import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re

def main_chk():
    N=int(input())
    C=input()

    chk = N - 1
    cnt = 0

    for i in range(N):
        if C[i] == 'W':
            for x in range(N-i):
                if C[chk-x] == 'R':
                    chk = chk - x
                    break
            if chk <= i:
                break
            else:
                cnt = cnt + 1
                chk = chk - 1
                if chk <= i + 1:
                    break

    print(cnt)

main_chk()


### FIXED CODE ###

import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re

def main_chk():
    N=int(input())
    C=input()

    chk = N - 1
    cnt = 0

    for i in range(N):
        if C[i] == 'W':
            p = chk
            chk = i
            for x in range(N-i):
                if C[p-x] == 'R':
                    chk = p - x
                    break
            if chk <= i:
                break
            else:
                cnt = cnt + 1
                chk = chk - 1
                if chk <= i + 1:
                    break

    print(cnt)

main_chk()
### BUGGY CODE ###

# n+2m=i
# 2n+m=j
# (4n+2m=2j)
# n=(2j-i)/3
# m=(2i-j)/3
# n+m C n (n+m)!/n!/m!

MOD = 10**9+7
MAX = (10**6)*2+5
fac = [0]*MAX
inv = [0]*MAX
finv = [0]*MAX
def COMinit():
    fac[0]=1
    fac[1]=1
    finv[0]=1
    finv[1]=1
    inv[1]=1
    for i in range(2,MAX):
        fac[i] = fac[i-1]*i%MOD
        inv[i] = MOD - inv[MOD%i]*(MOD//i)%MOD
        finv[i] = finv[i-1]*inv[i]%MOD
def COM(n,k):
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD

x,y=list(map(int,input().split()))
if (2*y-x)%3!=0 or (2*x-y)%3!=0:
    print(0)
else:
    n=(2*y-x)//3
    m=(2*x-y)//3
    if n<0 or m<0:
        print(0)
    else:
        COMinit()
        print(COM(n+m,n))

### FIXED CODE ###

# n+2m=i
# 2n+m=j
# (4n+2m=2j)
# n=(2j-i)/3
# m=(2i-j)/3
# n+m C n (n+m)!/n!/m!

MOD = 10**9+7
MAX = (10**6)*2+5
fac = [0]*MAX
inv = [0]*MAX
finv = [0]*MAX
def COMinit():
    fac[0]=1
    fac[1]=1
    finv[0]=1
    finv[1]=1
    inv[1]=1
    for i in range(2,MAX):
        fac[i] = fac[i-1]*i%MOD
        inv[i] = MOD - inv[MOD%i]*(MOD//i)%MOD
        finv[i] = finv[i-1]*inv[i]%MOD
def COM(n,k):
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD

x,y=list(map(int,input().split()))
if (2*y-x)%3!=0 or (2*x-y)%3!=0:
    print(0)
else:
    n=(2*y-x)//3
    m=(2*x-y)//3
    if n<0 or m<0:
        print(0)
    else:
        COMinit()
        print(COM(n+m,n))
### BUGGY CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))

# nの約数を求める。計算量O(sqrt(N))
def get_divisors(n):
    from math import sqrt, ceil
    from collections import deque
    divisors = deque([])
    for num in range(ceil(sqrt(n)), n+1):
        if n % num == 0:
            divisors.append(n//num)
            if n//num != n:
                divisors.appendleft(num)
    return list(divisors)

total = sum(A)
divisors = get_divisors(total)
ans = -1
for d in divisors:
    R = [a%d for a in A]
    R.sort(reverse=True)
    pr = 0
    nr = -sum(R)
    for i, r in enumerate(R):
        pr += d-r
        nr += r
        if (-nr) == pr:
            if pr <= K:
                ans = d
            break
    if ans != -1:
        print(ans)
        break
else:
    print(1)

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))

# nの約数を求める。計算量O(sqrt(N))
def get_divisors(n):
    from math import sqrt, ceil
    from collections import deque
    divisors = deque([])
    for num in range(ceil(sqrt(n)), n+1):
        if n % num == 0:
            divisors.append(n//num)
            if n//num != n:
                divisors.appendleft(num)
    return list(divisors)


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    divisors.sort(reverse=True)
    return divisors

total = sum(A)
divisors = make_divisors(total)
ans = -1
for d in divisors:
    R = [a%d for a in A]
    R.sort(reverse=True)
    pr = 0
    nr = -sum(R)
    for i, r in enumerate(R):
        pr += d-r
        nr += r
        if nr+pr >= 0:
            if pr <= K and nr+pr == 0:
                ans = d
            break
    if ans != -1:
        print(ans)
        break
else:
    print(1)
### BUGGY CODE ###

from sys import stdin
sin = stdin.readline().rstrip()
q = int(stdin.readline().rstrip())
li = [list(stdin.readline().rstrip().split()) for _ in range(q)]
point = 0
for i in li:
    if i[0] == "1":
        point += 1
    elif i[0] == "2":
        if i[1] == "1":
            if point%2 == 0:
                sin = i[2] + sin
            else:
                sin += i[2]
        else:
            if point%2 == 0:
                sin += i[2]
            else:
                sin = i[2] + sin
if point%2 == 1:
    sin = sin[::-1]
print(sin)

### FIXED CODE ###

from sys import stdin
sin = stdin.readline().rstrip()
q = int(stdin.readline().rstrip())
li = [list(stdin.readline().rstrip().split()) for _ in range(q)]
point = 0
omote = ""
ura = ""
for i in li:
    if i[0] == "1":
        point += 1
    elif i[0] == "2":
        if i[1] == "1":
            if point%2 == 0:
                omote += i[2]
            else:
                ura += i[2]
        else:
            if point%2 == 0:
                ura += i[2]
            else:
                omote += i[2]
if point%2 == 0:
    omote = omote[::-1]
    sin = omote + sin + ura
    print(sin)
else:
    sin = sin[::-1]
    ura = ura[::-1]
    sin = ura + sin + omote
    print(sin)
### BUGGY CODE ###

# python3
# -*- coding: utf-8 -*-
import sys
import math
#from math import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

INF = float('inf')

ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
sys.setrecursionlimit(1000000000)


def lcm(a, b):
    return (a * b) // gcd(a, b)


def ex(n):
    return sum(list(range(1, n+1))) / n

# main
N, K = mis()
p = lmis()

ex_max = 0
for i in range(N-K+1):
    ex_temp = 0
    for j in range(i, i+K):
        ex_temp += ex(p[j])

    if ex_max < ex_temp:
        ex_max = ex_temp

print(ex_max)


### FIXED CODE ###

# python3
# -*- coding: utf-8 -*-
import sys
import math
#from math import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

INF = float('inf')

ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
sys.setrecursionlimit(1000000000)


def lcm(a, b):
    return (a * b) // gcd(a, b)


def ex(s):
    n = int(s)
    nn = (n+1) * (n/2)
    return nn / n

# main
N, K = mis()
exs = list(map(ex, input().split()))

if N == K:
    print(sum(exs))
    exit(0)

ex_max = 0

for i in range(K):
    ex_max += exs[i]

left = 0
ex_temp = ex_max
for i in range(K, N):
    ex_temp = ex_temp - exs[left] + exs[i]
    left += 1
    if ex_max < ex_temp:
        ex_max = ex_temp

print('{:.7f}'.format(ex_max))
### BUGGY CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]

ans = []

for i in a:
    if ans.count(i) == 0:
        ans.append(i)

    else:
        ans.remove(i)

print(len(ans))

### FIXED CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]

a = sorted(a)
tmp = 0
ans = 0
for i in a:
    if i == tmp:
        ans -= 1
        tmp = 0
    else:
        ans += 1
        tmp = i

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

a,b,k=map(int,input().split())
d=[i for i in range(a,b+1)]
n=len(d)
if n>=2*k:
  ans=[0]*(2*k)
  for i in range(k):
    ans[i]=d[i]
    ans[2*k-1-i]=d[n-1-i]
  for j in ans:
    print(j)
  exit()
elif n<2*k:
  for i in range(n):
    print(d[i])
  exit()
    


### FIXED CODE ###

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

if b-a <= k:
  for i in range(a, b+1):
    print(i)
else:
  ans = []
  for i in range(a, a+k):
    if i not in ans:
      ans.append(i)
      print(i)
  for j in range(b-k+1, b+1):
    if j not in ans:
      print(j)
### BUGGY CODE ###

def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    a = sorted(a)
    ans = [1]*n
    for i in range(n):
        if ans[i] == 1:
            for j in range(i+1, n):
                if a[j] == a[i]:
                    ans[i] = 0
                if a[j]%a[i] ==0:
                    ans[j] = 0
    print(sum(ans))
resolve()

### FIXED CODE ###

def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    a1 = {}
    for i in range(len(a)):
        if a[i] in a1:
            a1[a[i]] += 1
        else:
            a1[a[i]] = 1
    a = sorted(list(a1.keys()))
    ans = [1] * a[-1]

    for i in a:
        if ans[i-1] == 1:
            for j in range(i-1, len(ans), i):
                ans[j] = 0
            ans[i-1] =1
    ans1 = 0
    for i in a:
        if a1[i] == 1:
            ans1 += ans[i-1]
    print(ans1)
resolve()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n,k = map(int,input().split())
s = input()
chk_0 = []
chk_1 = []
c0 = 0
c1 = 0
chk_0_append = chk_0.append
chk_1_append = chk_1.append
if s[0]=='0':
  c0 += 1
else:
  c1 += 1
  chk_0_append(0)

for i in range(n-1):
  if s[i]=='0' and s[i+1]=='0':
    c0 += 1
  if s[i]=='0' and s[i+1]=='1':
    chk_0_append(c0)
    c0 = 0
    c1 = 1
  if s[i]=='1' and s[i+1]=='0':
    chk_1_append(c1)
    c0 = 1
    c1 = 0
  if s[i]=='1' and s[i+1]=='1':
    c1 += 1

if c0 != 0:
  chk_0_append(c0)
  chk_1_append(0)
elif c1 != 0:
  chk_1_append(c1)
  chk_0_append(0)

if len(chk_0) <= k:
  print(n)
  exit()

ab = [x+y for x,y in zip(chk_0,chk_1)]
ab = tuple(ab)
chk_1 = tuple(chk_1)
#print(chk_0,chk_1,ab)
ans = 0
for i in range(len(chk_0)-k+1):
  chk = sum(ab[i:i+k])
  if i >= 1:
    chk += chk_1[i-1]
  ans = max(ans,chk)
print(ans)

### FIXED CODE ###

def main():  
  import sys
  input = sys.stdin.readline
  import numpy as np

  n,k = map(int,input().split())
  s = input()
  chk_0 = []
  chk_1 = []
  c0 = 0
  c1 = 0
  chk_0_append = chk_0.append
  chk_1_append = chk_1.append
  if s[0]=='0':
    c0 += 1
  else:
    c1 += 1
    chk_0_append(0)

  for i in range(n-1):
    if s[i]=='0' and s[i+1]=='0':
      c0 += 1
    if s[i]=='0' and s[i+1]=='1':
      chk_0_append(c0)
      c0 = 0
      c1 = 1
    if s[i]=='1' and s[i+1]=='0':
      chk_1_append(c1)
      c0 = 1
      c1 = 0
    if s[i]=='1' and s[i+1]=='1':
      c1 += 1

  if c0 != 0:
    chk_0_append(c0)
    chk_1_append(0)
  elif c1 != 0:
    chk_1_append(c1)
    chk_0_append(0)

  if len(chk_0) <= k:
    print(n)
    exit()

  chk_1 = tuple(chk_1)
  chk_0 = tuple(chk_0)
  ab = np.array([x+y for x,y in zip(chk_0,chk_1)])
  np.cumsum(ab,out=ab)
  ab = tuple(ab)
  #print(ab)
  ans = ab[k-1]
  for i in range(len(ab)-k):
    chk = ab[k+i]-ab[i]
    chk += chk_1[i]
    ans = max(ans,chk)
  print(ans)
if __name__ == '__main__':
    main()
### BUGGY CODE ###

def is_prime(n):
    if n == 2:
        return True
    if n < 2 or (n%2 == 0):
        return False
    i = 3
    while i <= n**0.5:
        if n % i == 0:
            return False
        i += 2
    return True


def find_nth_prime(n):
    """ n???????????§????´???°????±??????? """
    count = 0
    num = 2
    result = []
    while True:
        if is_prime(num):
            count += 1
            result.append(num)
        if count >= n:
            break
        num += 1
    return result


if __name__ == '__main__':
    # ??????????????\???
    while True:
        data = int(input())
        if data == 0:
            break

        # ????????¨???????????¨???
        result = find_nth_prime(data)
        print(sum(result))

### FIXED CODE ###

import random

def is_prime(q, k=50):
    """ ??????????????????????´???°?????????????????¨??????????????????????????°????´???°???????????????????????????
    http://d.hatena.ne.jp/pashango_p/20090704/1246692091
    """
    q = abs(q)
    # ?¨???????????????§?????????????????§????????????????????????
    if q == 2: return True
    if q < 2 or q & 1 == 0: return False

    # n-1=2^s*d??¨????????????a?????´??°???d????\???°)???d????±???????
    d = (q - 1) >> 1
    while d & 1 == 0:
        d >>= 1

    # ?????????k?????°?????????
    for i in range(k):
        a = random.randint(1, q - 1)
        t = d
        y = pow(a, t, q)
        # [0,s-1]??????????????????????????§??????
        while t != q - 1 and y != 1 and y != q - 1:
            y = pow(y, 2, q)
            t <<= 1
        if y != q - 1 and t & 1 == 0:
            return False
    return True


Primes = []
def find_nth_prime(n):
    """ n??????????´???°????±??????? """
    count = len(Primes)
    if count >= n:
        return
    if count > 0:
        num = Primes[-1] + 1
    else:
        num = 2
    while True:
        if is_prime(num):
            count += 1
            Primes.append(num)
        if count >= n:
            break
        num += 1


if __name__ == '__main__':
    # ??????????????\???
    while True:
        data = int(input())
        if data == 0:
            break

        # ????????¨???????????¨???
        find_nth_prime(data)
        # print(Primes)
        print(sum(Primes[:data]))
### BUGGY CODE ###

#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
dydx4 = ((-1,0),(0,-1),(0,1),(1,0))

h,w = map(int,input().split())
A = [list(input()) for i in range(h)]
dis = [[inf] * w for i in range(h)]
def bfs(si,sj):
  que = collections.deque()
  que.append((0,si,sj))
  dis[si][sj] = 0
  while que:
    cost,i,j = que.popleft()
    for di,dj in dydx4:
      ni = i + di
      nj = j + dj
      if not (0 <= ni < h and 0 <= nj < w):continue
      if A[ni][nj] == "#":continue
      if cost + 1 < dis[ni][nj]:
        dis[ni][nj] = cost+1
        que.append((cost+1,ni,nj))
for i in range(h):
  for j in range(w):
    if A[i][j] == "#":
      bfs(i,j)
print(max(map(max,dis)))




### FIXED CODE ###

#!/usr/bin/env python3
import sys
import heapq
from collections import deque
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7

h,w=map(int,input().split())
A=[list(input()) for i in range(h)]
# A=(tuple(input()) for i in range(h))
# print(A)
dis=[[-1]*w for i in range(h)]
hq=deque()
for i in range(h):
    for j in range(w):
        if A[i][j]=="#":
            hq.append((0,i,j))
            dis[i][j]=0
dii=[(1,0),(-1,0),(0,1),(0,-1)]
# heapq.heapify(hq)
ans=0
while hq:
    count,i,j=hq.popleft()
    for di,dj in dii:
        if not (0<=i+di<h and 0<=j+dj<w):
            continue
        if dis[i+di][j+dj]==-1:
            hq.append((count+1, i+di, j+dj))
            dis[i+di][j+dj]=count+1
            ans=max(ans,count+1)
#             # print(count+1)
# ans=0
# for Ai in dis:
#     ans=max(ans,max(Ai))
print(ans)
# for d in dis:
#     print(d)
### BUGGY CODE ###

from collections import deque

N, X, Y = [int(x) for x in input().split()]
result = {x: 0 for x in range(N)}

# 面倒なので0オリジンに修正
X -= 1
Y -= 1

# 全位置から移動できるパターンを幅優先探索で網羅する
for i in range(N):

    queue = deque()
    visited = set()

    # 開始位置と距離を初期値として入れる
    queue.appendleft((i, 0))

    while queue:
        now_pos, distance = queue.pop()

        # 訪れていない場合、その位置に移動するまでの距離に結果を加算
        # 訪問済フラグを立てる
        if not now_pos in visited:
            result[distance] += 1
            visited.add(now_pos)

        # 前、後ろ、X <-> Y の移動を実行
        # すでに訪問済の場合は追加しない
        if now_pos - 1 >= 0:
            if not now_pos - 1 in visited:
                queue.appendleft((now_pos - 1, distance + 1))

        if now_pos + 1 < N:
            if not now_pos + 1 in visited:
                queue.appendleft((now_pos + 1, distance + 1))

        if now_pos == X:
            if not Y in visited:
                queue.appendleft((Y, distance+1))

        if now_pos == Y:
            if not X in visited:
                queue.appendleft((X, distance+1))

for i in range(1, N):
    print(result[i] // 2)


### FIXED CODE ###

from collections import deque

N, X, Y = [int(x) for x in input().split()]
X -= 1
Y -= 1

result = {x: 0 for x in range(N)}


def push(v, d, queue, dist):
    if v in dist:
        return
    dist[v] = d
    queue.appendleft(v)


def check(i):
    queue = deque()
    dist = {}
    push(i, 0, queue, dist)

    while queue:
        pos = queue.pop()
        d = dist[pos]

        if pos - 1 >= 0:
            push(pos - 1, d + 1, queue, dist)
        if pos + 1 < N:
            push(pos + 1, d + 1, queue, dist)
        if pos == X:
            push(Y, d + 1, queue, dist)
        if pos == Y:
            push(X, d + 1, queue, dist)

    for i in range(N):
        result[dist[i]] += 1


for i in range(N):
    check(i)

for i in range(1, N):
    print(result[i] // 2)
### BUGGY CODE ###

import fractions
mod=10**9+7
n=int(input())
a=list(map(int,input().split()))

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

count=a[0]
for i in range(n-1):
    count=lcm(count,a[i+1])
ans=0
for i in range(n):
    ansa=count//a[i]
    ans+=ansa
    
print(ans%mod)

### FIXED CODE ###

import fractions
mod=10**9+7
n=int(input())
a=list(map(int,input().split()))

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

count=a[0]
for i in range(n-1):
    count=lcm(count,a[i+1])
ans=0
for i in range(n):
    ansa=count//a[i]
    ans+=ansa
    
print(ans%mod)
### BUGGY CODE ###

# your code goes here
a=int(input())
k = a
while k>0:
	if k %2== 0 and k % a ==0:
		print(k)
		quit()
	k = k +1

### FIXED CODE ###

a=int(input())
if a%2 == 0:
	print(a)
else:
	print(a*2)
### BUGGY CODE ###

T=input()
ans=""
for t in T:
    if t=="?":
        ans+="D"
    else:
        ans+=t
print(ans)

### FIXED CODE ###

T=input()
ans=""
for t in T:
    if t=="?":
        ans+="D"
    else:
        ans+=t
print(ans)