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

from fractions import gcd

Mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))

lm = A[0]
for a in A[1:]:
    lm = lm*a // gcd(lm,a)

ans = 0

for a in A:
    ans += ( lm//a )
    ans %= Mod

print(ans)

### FIXED CODE ###

from fractions import gcd

Mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))

lm = A[0]
for a in A[1:]:
    lm = lm*a//gcd(lm,a)

ans = 0
for i in range(N):
    ans += lm//A[i]
ans %= Mod

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

import sys,fractions
sys.setrecursionlimit(10**5)
def input():
    return sys.stdin.readline()[:-1]

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

u = 10**9+7

from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

G = l[0]
for i in range(1,N):
    G = fractions.gcd(G,l[i])
    if G==1:
        break
gcd = G
L = [l[i]//gcd for i in range(N)]
lcm = lcm_list(L)

# print(lcm,gcd,'aaa')
ANS = 0
for i in range(N):
    elm = L[i]
    ANS += (lcm//elm)
    ANS %= u
print(ANS)

### FIXED CODE ###

import sys
from fractions import gcd
sys.setrecursionlimit(10**5)
def input():
    return sys.stdin.readline()[:-1]

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

u = 10**9+7

lcm = 1
s = 0
for i in range(N):
    k = l[i]
    g = gcd(k,lcm)
    t = k//g
    lcm = lcm*t
    s = s*t + lcm//k
print(s%u)
### BUGGY CODE ###

import copy
k = int(input())

cnt = 0
for i in range(1, 100000):
  if i < 9:
    cnt += 1
  else:
    num = copy.copy(i)
    nei = []
    while num < 10:
      nei.append(num%10)
      num /= 10
    for j in range(len(nei)):
      if abs(nei[j] - nei[j+1]) > 1:
        break
      elif abs(nei[j] - nei[j+1]) <= 1 and nei[j] == nei[len(nei)-1]:
        cnt += 1
        
  if cnt == k:
    print(i)
    break

### FIXED CODE ###

from queue import Queue
q = Queue()

k = int(input())

for i in range(9):
  q.put(i+1)
for _ in range(k-1):
    x = q.get()
    mod = x%10
    
    if x%10 != 0:
      q.put(10*x + mod - 1)
      
    q.put(10*x + mod)
    
    if x%10 != 9:
      q.put(10*x + mod + 1)
      
print(q.get())
### BUGGY CODE ###

import sys

def count_prime(x):
    temp = 0
    for i in range(2,x+1):
        for j in range(2,i+1):
            if(j == i):
                temp += 1
            elif(i % j == 0):
                break
    return temp

l = []
for input in sys.stdin:
    l.append(input)
print l
for input in l:
    print count_prime(int(input))


### FIXED CODE ###

import sys

def is_prime(x):
    if(x <= 3 and x > 1):
        return 1
    elif(x == 5):
        return 1
    elif(x % 2 == 0 or x < 2):
        return 0
    a = 3
    while(a * a <= x):
        if(x % a == 0):
            return 0
        a += 2
    return 1

def generate_prime(x):
    list = []
    list.append(2)
    for i in range(3,x+1,2):
        if(is_prime(i) == 1):
            list.append(i)
    return list

def count_list(x,list):
    count = 0
    for i in range(0,len(list)):
        if(list[i] > x):
            break
        elif(list[i] <= x):
            count += 1
    return count

l = []
for input in sys.stdin:
    l.append(int(input))

prime = generate_prime(max(l))
for i in range(0,len(l)):
    print count_list(l[i],prime)
### BUGGY CODE ###

n, m, q = map(int, input().split())

cumlr = [[0] * n for i in range(n)]
for _ in range(m):
    l, r = map(int, input().split())
    cumlr[l-1][r-1] += 1

# print(cumlr)
for _ in range(q):
    l, r = map(int, input().split())
    ans = 0
    for i in range(l-1, r):
        for j in range(l-1, r):
            ans += cumlr[i][j]
    print(ans)


### FIXED CODE ###

n, m, Q = map(int, input().split())
M = [[0]*n for _ in range(n)]
for i in range(m):
    l, r = map(int, input().split())
    M[r-1][l-1] += 1

for q in range(n):
    for p in reversed(range(1, n)):
        M[q][p-1] += M[q][p]
for p in range(n):
    for q in range(n-1):
        M[q+1][p] += M[q][p]

for i in range(Q):
    p, q = map(int, input().split())
    print(M[q-1][p-1])
### BUGGY CODE ###

import sys
input = sys.stdin.readline
def main():  
    S = list(input())
    S.pop()
    length=len(S)
    dp = [0]*13
    dp[0]=1
    mul=1
    mod=1000000007
    for i in range(1,length+1):
        next_dp = [0]*13
        for j in range(13):
            if S[length-i] == "?":
                for k in range(10):
                    j_sub=(j+k*mul)%13
                    next_dp[j_sub]+=dp[j]
                    next_dp[j_sub]%=mod
            else:
                j_sub=(j+int(S[length-i])*mul)%13
                next_dp[j_sub]+=dp[j]
                next_dp[j_sub]%=mod
        dp=next_dp
        mul=mul*10
    print(dp[5]%1000000007)
if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
def main():  
    S = list(input())
    S.pop()
    length=len(S)
    dp = [0]*13
    dp[0]=1
    mul=1
    mod=1000000007
    for i in range(1,length+1):
        next_dp = [0]*13
        for j in range(13):
            if S[length-i] == "?":
                for k in range(10):
                    j_sub=(j+k*mul)%13
                    next_dp[j_sub]+=dp[j]
                    next_dp[j_sub]%=mod
            else:
                j_sub=(j+int(S[length-i])*mul)%13
                next_dp[j_sub]+=dp[j]
                next_dp[j_sub]%=mod
        dp=next_dp
        mul=mul*10%13
    print(dp[5]%1000000007)
if __name__ == "__main__":
    main()
### BUGGY CODE ###

n,m=map(int, input().split()) 
ab=[list(map(int, input().split())) for i in range(n)]
ans=0
 
x=sorted(ab, key=lambda x :x[1])
x.reverse()
 
v=[]
for i in range(1,m+1):
    v.append(i)
 
for i in range(min(m,n)):
    if len(v)==0:
        break
    if x[i][0]<=v[-1]:
        ans+=x[i][1]
        for j in range(m):
            if v[j]>=x[i][0]:
                del v[j]
                break
    else:
        continue
print(ans)

### FIXED CODE ###

import heapq
def heapify(x):
    for i in reversed(range(n//2)):
        _siftup(x, i)
 
n,m = map(int,input().split())
 
l = []
for i in range(n):
    ab = list(map(int,input().split()))
    l.append(ab)
l.sort()
q = []
ans = 0
cnt = 0
for i in range(1,m+1):
    while cnt < n and l[cnt][0] == i:
        heapq.heappush(q,-l[cnt][1])
        cnt += 1
    
    if len(q) != 0:
        ans += -heapq.heappop(q)
 
print(ans)
### BUGGY CODE ###

import numpy as np

N, K = map(int, input().split())
A = list(map(int, input().split()))
A = np.int32(A) - 1

nxt = np.zeros((60, N), dtype=int)
nxt[0] = A
for i in range(0, 59):
    for j in range(N):
        nxt[i + 1, j] = nxt[i, nxt[i, j]]

bits = reversed(bin(K)[2:])
pos = 0
for i, v in enumerate(bits):
    if v == '1':
        pos = nxt[i, pos]

print(pos + 1)

### FIXED CODE ###

import numpy as np

N, K = map(int, input().split())
A = list(map(int, input().split()))
A = np.int32(A) - 1

nxt = np.zeros((70, N), dtype=int)
nxt[0] = A
for i in range(0, 69):
    nxt[i + 1] = nxt[i, nxt[i]]

pos = 0
for i, v in enumerate(reversed(bin(K)[2:])):
    if v == '1':
        pos = nxt[i, pos]

print(pos + 1)
### BUGGY CODE ###

import math

A,B=map(int,input().split())
min=min(A,B)
#rng=math.ceil(math.sqrt(max))
divisor=[1]
for i in range(2,min+1):
    if A%i==0 and B%i==0:
        for x in divisor:
            if i%x==0 and x!=1:
                break
        else:
            divisor+=[i]

print(len(divisor))

### FIXED CODE ###

import math

divisor=[1]
stack=[]
#eiclidean algorithm
A,B=map(int,input().split())
p=max(A,B)
q=min(A,B)
int2=0
gcd=0
while True:
    int2=p%q
    if int2==0:
        gcd=q
        break
    else:
        p=q
        q=int2

if gcd!=1:
    stack.append(gcd)
    
for i in range(2,math.ceil(math.sqrt(gcd))+1):
    if gcd%i==0:
        p=gcd//i
        stack.append(p)
        for x in divisor:
            if i%x==0 and x!=1:
                break
        else:
            divisor+=[i]

while len(stack)!=0:
    p=stack.pop()
    for x in divisor:
        if p%x==0 and x!=1:
            break
    else:
        divisor+=[p]


print(len(divisor))
### BUGGY CODE ###

H, W = map(int,input().split())
S = [list(input()) for i in range(H)]

h_cnt = [[0]*W for i in range(H)]
w_cnt = [[0]*W for i in range(H)]

cnt = 0
z = []

for h in range(H):
    for w in range(W):
        if S[h][w] == ".":
            cnt += 1
            z.append(w)
        else:
            for i in range(len(z)):
                w_cnt[h][z.pop()] = cnt
            cnt = 0

    if cnt > 0:
        for i in range(len(z)):
            w_cnt[h][z.pop()] = cnt
        cnt = 0


for w in range(W):
    for h in range(H):
        if S[h][w] == ".":
            cnt += 1
            z.append(h)
        else:
            for i in range(len(z)):
                h_cnt[z.pop()][w] = cnt
            cnt = 0

    if cnt > 0:
        for i in range(len(z)):
            h_cnt[z.pop()][w] = cnt
        cnt = 0

ans = 0

for h in range(H):
    for w in range(W):
        ans = max(ans,h_cnt[h][w]+w_cnt[h][w])

print(ans-1)

### FIXED CODE ###

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

yoko = [[0]*W for _ in range(H)]
tate = [[0]*W for _ in range(H)]

def f(l):
    print("\n".join("".join(map(str, row)) for row in l))

for h in range(H):
    if S[h][0] == ".":
        yoko[h][0] = 1
    else:
        yoko[h][0] = 0

for h in range(H):
    for w in range(1, W):
        if S[h][w] == ".":
            yoko[h][w] = yoko[h][w-1]+1
        else:
            yoko[h][w] = 0

for h in range(H):
    for w in range(W-2, -1, -1):
        if S[h][w]=="." and S[h][w+1]==".":
            yoko[h][w] = yoko[h][w+1]

for w in range(W):
    if S[0][w] == ".":
        tate[0][w] = 1
    else:
        tate[0][w] = 0

for w in range(W):
    for h in range(1, H):
        if S[h][w] == ".":
            tate[h][w] = tate[h-1][w]+1
        else:
            tate[h][w] = 0

for w in range(W):
    for h in range(H-2, -1, -1):
        if S[h][w]=="." and S[h+1][w]==".":
            tate[h][w] = tate[h+1][w]

ans = 0

for h in range(H):
    for w in range(W):
        ans = max(yoko[h][w]+tate[h][w]-1, ans)

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

a,b = input().split()
a = int(a)
b = int(b)
x = [0]*(a+1)

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

for i in range(a-b+1):
  for j in range(b):
  	x[i] += (c[i+j]+1) / 2

print('{:.12f}'.format(max(x)))

### FIXED CODE ###

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

x = [(e + 1) / 2 for e in c]

t = sum(x[0:b])
res = t
for i in range(a - b):
  t -= x[i]
  t += x[i+b]
  res = max(res,t)

print('{:.12f}'.format(res))
### BUGGY CODE ###

n = int(input())

aa = []
for i in range(n):
	k,l = map(int,input().split())
	aa.append([k,l])
aa.sort(key = lambda x:x[1])
aa.reverse()
co = 0
ma = 0
kkk = 0
for i in range(n):
	if i % 2 == 0:
		ma = max(aa,key = lambda x:x[0])[0]
		for j in range(n-i):
			if ma == aa[j][0]:
				co += aa.pop(j)[0]
				break
	else:
		co -= aa.pop(0)[1]

print(co)


### FIXED CODE ###

import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""


n = onem()

po = []
su = 0
for i in range(n):
    a,b = m()
    po.append([a+b,a])
po.sort(reverse = True)

for i in range(n):
    if i % 2 == 0:
        su += po[i][1]
    else:
        su -= po[i][0] - po[i][1]
print(su)
### BUGGY CODE ###

from functools import reduce
from operator import mul

N,K,*A = map(int,open(0).read().split())
base = reduce(mul,A[:K])
for i in range(K,N):
    score = base // A[i-K] * A[i]
    print("Yes" if base < score else "No")
    base = score    
    

### FIXED CODE ###

from functools import reduce
from operator import mul

N,K,*A = map(int,open(0).read().split())
base = sum(A[:K])
for i in range(K,N):
    score = base - A[i-K] + A[i]
    print("Yes" if base < score else "No")
    base = score
### BUGGY CODE ###

# AC if using deque
from collections import deque

Y, X = map(int,input().split())
# sy, sx = map(int, input().split())
# gy, gx = map(int, input().split())
sy,sx = 1,1
gy,gx = Y,X
s = [["#"]*(X+2) for _ in range(Y+2)]
for y in range(Y):
    s[y+1] = list("#"+input()+"#")
inf = Y*X
c = [[inf]*X for _ in range(Y)]
c[sy-1][sx-1] = 0
drs = [[-1,0],[1,0],[0,0],[0,-1],[0,1]]
q = deque([(sy-1, sx-1)])

while q:
    y,x = q.popleft()
    cost = c[y][x]
    for dx,dy in drs:
        x2 = x+dx
        y2 = y+dy
        if s[y2+1][x2+1] == "." and c[y2][x2] > cost:
            c[y2][x2] = cost+1
            q.appendleft((y2,x2))
if c[gy-1][gx-1] == inf:
    print("-1")
else:
    dots = 0
    for s1 in s:
        dots +=s1.count(".")
    print(dots-c[gy-1][gx-1]-1)

### FIXED CODE ###

H, W = map(int,input().split())
c = [["#"]*(W+2) for _ in range(H+2)]
dots = 0
for y in range(H):
    c[y+1] = "#",*list(input()),"#" 
    dots += c[y+1].count(".")
inf = H*W
m = [[inf]*W for _ in range(H)]
m[0][0] = 0
drs = [[-1,0],[1,0],[0,-1],[0,1]]

s = 0
yx = [[1, 1]]
notgoal = True
while notgoal and yx:
    yx2 = []
    s += 1
    for y,x in yx:
        for dy, dx in drs:
            x2 = x+dx
            y2 = y+dy
            if c[y2][x2] == "." and m[y2-1][x2-1] == inf:
                m[y2-1][x2-1] = s
                if (y2,x2) == (H,W):
                    notgoal = False
                else:
                    yx2.append([y2, x2])
    yx = yx2

if notgoal:
    print("-1")
else:
    print(dots-s-1)
### BUGGY CODE ###

import sys
def p(*a):
  s=" ".join(map(str,a))
  #print(s)
  sys.stderr.write(s+"\n")
#-------------------------------------------------------------------
N, M = map(int, input().split())

G=[[] for _ in range(N+1) ]			#=> [[], [], [], [], [], [], [], []]
for _ in range(M):
	u,v = map(int, input().split())
	G[u].append(v)

S, T = map(int, input().split())

p("N,M",N,M)
p("G",G)
p("S,T",S,T)


# グラフGから、3つ先の到達点のグラフXを作る
X=[[] for _ in range(N+1) ]			#=> [[], [], [], [], [], [], [], []]

for i in range(N+1):
	g = G[i]

	for g1 in g:
		for g2 in G[g1]:
			for g3 in G[g2]:
				if (not g3 in X[i]):
					X[i].append(g3)

p("X",X)


# 訪問済み＆移動数の記録用マップ、Visitedを作る。未訪問は-1
V=[-1 for _ in range(N+1) ]			#=> [[], [], [], [], [], [], [], []]
V[S]=0

# キューに行き先候補を入れて、
from collections import deque

Q = deque()
Q.append(S)

while Q:
	fm = Q.popleft()
	p("fm, X[fm], Q ", fm, X[fm], Q)
	
	for to in X[fm]:
		p("  to, V[to], Q ",to, V[to], Q)
		
		b = (V[to]==-1)							# 未訪問である
		b = b or (V[to]>(V[fm]+1))	# より短いステップ数である(＝既存の方が大きい)
		if b:
			V[to] = V[fm]+1		# 訪問ステップ数の記録
			Q.append(to)			# 次の訪問先として、キューに追加

	p("V ",V)

ans = V[T] if V[T]>0 else -1
print(ans)



### FIXED CODE ###

import sys
def p(*a):
  s=" ".join(map(str,a))
  #print(s)
  sys.stderr.write(s+"\n")
#-------------------------------------------------------------------
N, M = map(int, input().split())

G=[[] for _ in range(N+1) ]			#=> [[], [], [], [], [], [], [], []]
for _ in range(M):
	u,v = map(int, input().split())
	G[u].append(v)

S, T = map(int, input().split())

#p("N,M",N,M)
#p("G",G)
#p("S,T",S,T)


# 訪問済み＆移動数の記録用マップ、Visitedを作る。未訪問は-1
V=[ [-1,-1,-1] for _ in range(N+1) ]			#=> [ [-1,-1,-1], [-1,-1,-1], ... [-1,-1,-1] ]
V[S][0]=0

# キューに行き先候補を入れて、
from collections import deque
Q = deque()
Q.append([S,0])

while Q:
	FM = Q.popleft()
	
	fm = FM[0]
	l =  FM[1]
	
	for to in G[fm]:
		nl = (l+1)%3
		b = (V[to][nl]==-1)							# 未訪問である
		#b = b or (V[to]>(V[fm]+1))	# より短いステップ数である(＝既存の方が大きい)
		if b:
			V[to][nl] = V[fm][l]+1		# 訪問ステップ数の記録
			Q.append([to,nl])			# 次の訪問先として、キューに追加

ans = V[T][0]
if ans > -1: ans //= 3
print(ans)
### BUGGY CODE ###

from itertools import combinations
s = input()
n = int(s)
l = len(s)
k = int(input())

if k == 1:
	print(9 * (len(s)-1) + int(s[0]))

elif k == 2:
	if len(s) == 1:
		print(0)
	elif len(s) == 2:
		print(n - 9 - n//10)
	else:
		ans = 81 * (l-1) * (l-2) // 2
		for i in range(1, 10):
			for x in range(l-1):
				for j in range(1, 10):
					if i * (10**(l-1)) + j * (10**x) <= n:
						ans += 1
		print(ans)

else:
	if len(s) < 3:
		print(0)
	elif len(s) == 3:
		ans = 0
		for i in range(100, n+1):
			if "0" not in list(str(i)):
				ans += 1
		print(ans)
	else:
		ans = 729 * (l-1) * (l-2) * (l-3) // 6
		for i in range(1, 10):
			for x, y in combinations(range(l-1), 2):
				for z in range(81):
					j, k = (z//9) + 1, (z%9) + 1
					if i * (10**(l-1)) + j * (10**x) + k * (10**y) <= n:
						ans += 1
		print(ans)

### FIXED CODE ###

from itertools import combinations

s = input()
n = int(s)
l = len(s)
k = int(input())


if k == 1:
	print(9 * (len(s)-1) + int(s[0]))

elif k == 2:
	if len(s) == 1:
		print(0)
	elif len(s) == 2:
		print(n - 9 - n//10)
	else:
		ans = 81 * (l-1) * (l-2) // 2
		for i in range(1, 10):
			for x in range(l-1):
				for j in range(1, 10):
					if i * (10**(l-1)) + j * (10**x) <= n:
						ans += 1
		print(ans)

else:
	if len(s) < 3:
		print(0)
	elif len(s) == 3:
		ans = 0
		for i in range(100, n+1):
			if "0" not in list(str(i)):
				ans += 1
		print(ans)
	else:
		ans = 729 * (l-1) * (l-2) * (l-3) // 6
		ans += (int(s[0])-1) * (l-1) * (l-2) * 81 // 2
		for x, y in combinations(range(l-1), 2):
			for z in range(81):
				j, k = (z//9) + 1, (z%9) + 1
				if int(s[0]) * (10**(l-1)) + j * (10**x) + k * (10**y) <= n:
					ans += 1
		print(ans)
### BUGGY CODE ###

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

d = {}
def kitaichi(n):
	if n in d.keys(): return d[n]
	else:
		sum = n * (n+1) / 2
		d[n] = sum / n
		return d[n]

ans = 0
for i in range(len(p)):
	pp = p[i:i+k]
	if len(pp) != k: break
	tmp = 0
	for j in pp:
		tmp += kitaichi(j)
	ans = max(ans, tmp)


print(ans)

### FIXED CODE ###

from itertools import accumulate
n, k = map(int, input().split())
p = [-~int(i)/2 for i in input().split()]
a = [0] + list(accumulate(p))
print(max(j-i for i, j in zip(a, a[k:])))
### BUGGY CODE ###

from scipy.sparse.csgraph import csgraph_from_dense,dijkstra

N = int(input())
edge = [ [10**10 for j in range(N+1)] for i in range(N+1) ]

for i in range(N-1):
  a,b,c = map(int,input().split())
  edge[a][b] = c
  edge[b][a] = c
  
Q,K = map(int,input().split())

G = csgraph_from_dense(edge, null_value=10**10)
d = dijkstra(G,indices = K)

for i in range(Q):
  x,y = map(int,input().split())
  print(int(d[x]+d[y]))

### FIXED CODE ###

from collections import deque

N = int(input())

gr = { i:[] for i in range(N+1)}

for i in range(N-1):
  a,b,c = map(int,input().split())
  gr[a].append([b,c])
  gr[b].append([a,c])  
  
Q,K = map(int,input().split())

sta = deque([K])
dis = [10**10 for i in range(N+1)]
dis[K] = 0
sumi = [-1 for i in range(N+1)]

while len(sta) >= 1:
  a = sta.pop()
  sumi[a] += 1
  
  for j in gr[a]:
    if sumi[ j[0] ] != -1:
      continue
    else:
      sta.append(j[0])
      dis[j[0]] = dis[a] + j[1]
    
for i in range(Q):
  x,y = map(int,input().split())
  
  print(int(dis[x] + dis[y] ))
### BUGGY CODE ###

def main():
    x,y = map(int,input().split())
    tmp = []
    i = 2
    ans = 0
    # if x == y:
    #     ans += 1
    for i in range(2,min(x,y)):


        if i > x or i > y:
            break
        if x % i ==0 and y % i == 0:
            tmp.append(i)
            while True:
                if x % i == 0:
                    x = x//i
                else:
                    break
            while True:
                if y % i == 0:
                    y = y//i
                else:
                    break
        i += 1
    ans += len(tmp) + 1

    print(ans)
    # print(tmp)
if __name__=='__main__':
    main()


### FIXED CODE ###

def main():
    x,y = map(int,input().split())
    tmp = [1]
    i = 2
    ans = 0
    # if x == y:
    #     ans += 1
    # a = factorization(x)
    # print(a)
    tempx = x

    for i in range(2, int(-(-x**0.5//1))+1):
        if tempx % i == 0:
            tmp.append(i)
            while tempx % i == 0:

                tempx //= i
    if tempx!=1:
        tmp.append(tempx)
    # print(tmp)

    for i,a in enumerate(tmp):
        if y % a == 0:
            tmp[i] = 1
        else:
            tmp[i] = 0
    print(sum(tmp))


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

def main():
    K = int(input())
    if K%2 == 0:
        return -1

    amari_sum = 0
    i = 1
    amari = 7 % K
    amari_sum += amari
    if amari == 0:
        return i

    while True:
        i += 1
        amari = (amari*10) % K
        amari_sum += amari
        if amari_sum % K == 0:
            return i
        #else:
            #amari_sum %= K

print(main())


### FIXED CODE ###

def main():
    K = int(input())
    if K%2 == 0:
        return -1
    ans = 1
    amari_reserve = 7%K
    amari = amari_reserve
    if amari_reserve == 0:
        return ans

    while (ans <= K):
        ans += 1
        amari = (10*amari+7) % K
        if amari == 0:
            return ans
        if amari == amari_reserve:
            return -1

    return -1


print(main())
### BUGGY CODE ###

def main():
    n, k, c = map(int,input().split())
    s = input()
    schedule = [w == "o" for w in s]
    left = []
    l_day = 0
    right = []
    r_day = n - 1
    for i_1 in range(n):
        if schedule[l_day]:
            left.append(l_day)
            l_day += c
        l_day += 1
        if len(left) == k:
            break

    for i_2 in range(n):
        if schedule[r_day]:
            right = [r_day] + right
            r_day -= c
        r_day -= 1
        if len(right) == k:
            break
    for i in range(k):
        if left[i] == right[i]:
            print(left[i] + 1)



if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n, k, c = map(int,input().split())
    s = input()
    schedule = [w == "o" for w in s]
    left = []
    l_day = 0
    right = []
    r_day = n - 1
    while len(left) < k:
        if schedule[l_day]:
            left.append(l_day)
            l_day += c
        l_day += 1

    while len(right) < k:
        if schedule[r_day]:
            right.append(r_day)
            r_day -= c
        r_day -= 1

    right.reverse()


    for i in range(k):
        if left[i] == right[i]:
            print(left[i] + 1)



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

import sys
from operator import itemgetter
input = sys.stdin.readline

_s = input()


def chker(s):
    slist = []
    i = 1
    while len(s) >= i:
        if s[i - 1:i + 1] == '><':
            slist.append(s[:i])
            s = s[i:]
            i = 1
        else:
            i += 1

    slist.append(s)

    minisum = 0
    for item in slist:
        l, r = item.count('<'), item.count('>')
        l, r = (l, r) if l > r else (r, l)
        minisum += sum([num for num in range(l + 1)]) + sum([num for num in range(r)])

    print(minisum)


chker(_s)


### FIXED CODE ###

import sys
from operator import itemgetter
input = sys.stdin.readline

_s = input()


def chker(s):
    l, r, minisum = 0, 0, 0
    if s[0] == '<':
        l += 1
    elif s[0] == '>':
        r += 1
    for i in range(1, len(s)):
        if s[i - 1] == '>' and s[i] == '<':
            l, r = (l, r) if l > r else (r, l)
            minisum += l * (l + 1) / 2 + r * (r - 1) / 2
            l, r = 1, 0
        else:
            if s[i] == '<':
                l += 1
            elif s[i] == '>':
                r += 1

    l, r = (l, r) if l > r else (r, l)
    minisum += l * (l + 1) / 2 + r * (r - 1) / 2

    print(int(minisum))


chker(_s)