Harryxun/stf_run huggingface dataset:
n = int(input())

print(sum(list(range(n))))

### FIXED CODE ###

n = int(input())

output = (n * (n - 1)) // 2
print(output)
"""
タグ：区間
"""
import sys
input = sys.stdin.readline
N, P = map(int, input().split())
S = input()

if P == 5:
    res = 0
    i = 0
    for s in reversed(S):
        if int(s)%5==0:
            res += N-i
        i += 1
    print(res)
elif P == 2:
    res = 0
    i = 0
    for s in reversed(S):
        if int(s)%2==0:
            res += N-i
        i += 1
    print(res)
else:
    T = [0]
    p = 1
    for s in reversed(S):
        T.append(int(s)*p + T[-1])
        p = p*10%P

    cnt = [0]*P
    for i in range(N+1):
        cnt[T[i]%P] += 1

    res = 0
    for c in cnt:
        res += c*(c-1)//2
    print(res)

### FIXED CODE ###

"""
タグ：区間
"""
import sys
input = sys.stdin.readline
N, P = map(int, input().split())
S = input().strip()

if P == 5:
    res = 0
    i = 0
    for s in reversed(S):
        if int(s)%5==0:
            res += N-i
        i += 1
    print(res)
elif P == 2:
    res = 0
    i = 0
    for s in reversed(S):
        if int(s)%2==0:
            res += N-i
        i += 1
    print(res)
else:
    T = [0]
    p = 1
    for s in reversed(S):
        T.append(int(s)*p + T[-1])
        p = p*10%P

    cnt = [0]*P
    for i in range(N+1):
        cnt[T[i]%P] += 1

    res = 0
    for c in cnt:
        res += c*(c-1)//2
    print(res)
N = int(input())
arr = [0] + map(int, input().split(' ')) #ずらしておく。
for i in range(N//2, 0, -1):
  arr[i] = sum(arr[i::i]) % 2
ans = [i for i, j in enumerate(arr) if j == 1]
print(len(ans))
print(*ans)


### FIXED CODE ###

def main():
    n = int(input())
    A = [0] + list(map(int, input().rstrip().split()))
    for i in range(n // 2, 0, -1):  # second half: no multiples
        A[i] = sum(A[i::i]) % 2
    ans = [i for i, j in enumerate(A) if j]
    print(len(ans))  # all cells: [1] -> len() (much faster than sum())
    print(*ans)


if __name__ == "__main__":
    main()
A, B, Q = map(int, input().split())
s = []
for i in range(A):
    s.append(int(input()))
s.sort()
t = []
t.sort()
for i in range(B):
    t.append(int(input()))
x = []
for i in range(Q):
    x.append(int(input()))

for i in range(Q):
    sx, tx, sy, ty = [], [], [], []
    for j in range(A):
        sx.append(abs(s[j] - x[i]))
    for j in range(B):
        tx.append(abs(t[j] - x[i]))
    sxi = sx.index(min(sx))
    txi = tx.index(min(tx))
    for j in range(B):
        ty.append(abs(t[j] - s[sxi]))
    for j in range(A):
        sy.append(abs(s[j] - t[sxi]))
    a = min(sx) + min(ty)
    b = min(tx) + min(sy)
    if a < b:
        print("a"+str(a))
    else:
        print("b"+str(b))


### FIXED CODE ###

import bisect

A, B, Q = map(int, input().split())
INF = 10**18
S = [-INF]
for i in range(A):
    S.append(int(input()))
S.append(INF)
T = [-INF]
for i in range(B):
    T.append(int(input()))
T.append(INF)
X = []
for i in range(Q):
    X.append(int(input()))

for x in X:
    a, b = bisect.bisect_right(S, x), bisect.bisect_right(T, x)
    print(min(abs(s-t) + min(abs(s-x), abs(t-x))
              for s in S[a-1:a+1] for t in T[b-1:b+1]))
N = int(input())
A = list(map(int,input().split()))
count = 0

for i in range((N+2)//2):
    if A[2*i ] % 2 == 1:
        count += 1

print(count)


### FIXED CODE ###

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

if N % 2 ==0:
    for i in range((N+2)//2 - 1):
        if A[2*i ] % 2 == 1:
            count += 1
else:
    for i in range((N+2)//2):
        if A[2*i ] % 2 == 1:
            count += 1

print(count)
n,k=map(int,input())
arr=list(map(int,input().split()))
ans=0
for i in range(1,n):
  if arr[i]+arr[i-1]<=k:
    continue
  elif arr[i-1]<=k<arr[i]+arr[i-1]:
    ans+=arr[i]+arr[i-1]-k
    arr[i]=k-arr[i-1]
  else:
    ans+=arr[i]
    arr[i]=0
    ans+=arr[i-1]-k
    arr[i-1]=k
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
arr=list(map(int,input().split()))
ans=0
for i in range(1,n):
  if arr[i]+arr[i-1]<=k:
    continue
  elif arr[i-1]<=k<arr[i]+arr[i-1]:
    ans+=arr[i]+arr[i-1]-k
    arr[i]=k-arr[i-1]
  else:
    ans+=arr[i]
    arr[i]=0
    ans+=arr[i-1]-k
    arr[i-1]=k
print(ans)
#-*-coding:utf-8-*-

def main():
    arry = list(map(int, input().split))
    if arry.count(5) == 2 and arry.count(7) == 1:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()

### FIXED CODE ###

#-*-coding:utf-8-*-

def main():
    arry = list(map(int, input().split()))
    if arry.count(5) == 2 and arry.count(7) == 1:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()
# レベルLのN番目
def solve(L,N):
    if L == 0 and N == 1:
        return 1
    if N == 1:
        return 0
    elif N <= 2**(L+1)-2:
        return solve(L-1,N-1)
    elif N == int(2**(L+1)-1):
        return 2**L
    return solve(L-1,N-2**(L+1)+1) + 2**L

N,X = map(int,input().split())
print(solve(N,X))

### FIXED CODE ###

# レベルLのN番目
def solve(L,N):
    if L == 0:
        return 1
    if N == 1:
        return 0
    elif N <= 2**(L+1)-2:
        return solve(L-1,N-1)
    elif N == int(2**(L+1)-1):
        return 2**L
    return solve(L-1,N-2**(L+1)+1)+2**L
    

N,X = map(int,input().split())
print(solve(N,X))
import sys
input = sys.stdin.readline

n = input()
n_list = [int(i) for i in input().split()]
value = 1
for i in n_list
    value = value * i


if value > 10**18:
    value = -1
print(value)

### FIXED CODE ###

import sys
input = sys.stdin.readline

n = input()
n_list = sorted([int(i) for i in input().split()])
value = 1
for i in n_list:
    value = value * i
    if value > 10 ** 18:
        value = -1
        break
print(value)
N, x = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
for i in range(N):
  if x < min(A):
    print(cnt)
    break
  elif i == N-1 and A[i]-x > 0:
    print(N-1)
  elif i == N-1 and A[i]-x == 0:
    print(N)
  else:
    x -= min(A)
    A.remove(min(A))
    cnt += 1


### FIXED CODE ###

N, x = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
for i in range(N):
  if x < min(A):
    print(cnt)
    break
  elif i == N-1 and x-A[0] > 0:
    print(N-1)
    break
  elif i == N-1 and x-A[0] == 0:
    print(N)
    break
  else:
    x -= min(A)
    A.remove(min(A))
    cnt += 1
n=input("east_west road:")
m=input("north_south road:")
block =(int(n)-1) * (int(m)-1)
print(block) 


### FIXED CODE ###

n,m = list(map(int,input().split()))
print((n-1)*(m-1))
S = input()
if S == "SUN" :
	answer = 7
elif S == "MON" :
	answer = 6
elif S == "THE" :
	answer = 5
elif S == "WED" :
	answer = 4
elif S == "THU" :
	answer = 3
elif S == "FRI" :
	answer = 2
elif S == "SAT" :
	answer = 1

print(answer)

### FIXED CODE ###

S = input()
if S == "SUN" :
	answer = 7
elif S == "MON" :
	answer = 6
elif S == "TUE" :
	answer = 5
elif S == "WED" :
	answer = 4
elif S == "THU" :
	answer = 3
elif S == "FRI" :
	answer = 2
elif S == "SAT" :
	answer = 1
 
print(answer)
# B - Bite Eating
# https://atcoder.jp/contests/abc131/tasks/abc131_b
"""
1~Nの数字がある
数列iの対応する値はL+i-1である

N = [1,2,3,4,5]
l = 1
対応する値=[2,3,4,5,6]

a = 対応する値の総和の絶対値を取得する
b = 1つだけ除外し、残った対応する値の総和の絶対値を取得する
aとbの差をなるべく小さくするには？
対応する値は負になることもある
"""

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

"""
L + i - 1の対応する値の配列を作成する 
"""
apple_taste = []
taste_total = 0
for i in range(1, n + 1):
    apple_taste.append(L + i - 1)
    taste_total += L + i - 1


"""
要素数が少ないので愚直に一つずつ除外していって差がより小さい箇所を探す
"""

abs_taste_total = abs(sum(apple_taste))
ans = 10 ** 9 # これを差の絶対値が少ないときに入れ替えるようにする

for i in apple_taste:
    current_total = taste_total - i # iを食べたときの合計値
    abs_current_total = abs(abs(taste_total) - abs(i)) # 現在の値の絶対値。マイナス同士で引くと右辺が正の数として扱われるので絶対値にする

    current_abs = abs(abs(abs_taste_total) - abs(current_total))
    if current_abs < diff:
        diff = current_abs
        ans = current_total

print(ans)


### FIXED CODE ###

# B - Bite Eating
# https://atcoder.jp/contests/abc131/tasks/abc131_b
"""
1~Nの数字がある
数列iの対応する値はL+i-1である

N = [1,2,3,4,5]
l = 1
対応する値=[2,3,4,5,6]

a = 対応する値の総和の絶対値を取得する
b = 1つだけ除外し、残った対応する値の総和の絶対値を取得する
aとbの差をなるべく小さくするには？
対応する値は負になることもある
"""

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

"""
L + i - 1の対応する値の配列を作成する 
"""
apple_taste = []
taste_total = 0
for i in range(1, n + 1):
    apple_taste.append(L + i - 1)
    taste_total += L + i - 1


"""
要素数が少ないので愚直に一つずつ除外していって差がより小さい箇所を探す
"""

abs_taste_total = abs(sum(apple_taste))
ans = 10 ** 9 # これを差の絶対値が少ないときに入れ替えるようにする
diff = 10 ** 9 # この子は差の絶対値を保持しておく

for i in apple_taste:
    current_total = taste_total - i # iを食べたときの合計値
    abs_current_total = abs(abs(taste_total) - abs(i)) # 現在の値の絶対値。マイナス同士で引くと右辺が正の数として扱われるので絶対値にする

    current_abs = abs(abs(abs_taste_total) - abs(current_total))
    if current_abs < diff:
        diff = current_abs
        ans = current_total

print(ans)
N = int(input())
if N % 4 == 0:
  h, n, w = (3 * N) // 4, (3 * N) // 4, (3 * N) // 4
elif N % 4 == 2:
  h, n, w = N, N, N // 2
elif N % 4 == 3:
  h, n, w = 2 * ((N // 4) + 1), 2 * ((N // 4) + 1), (2 * ((N // 4) + 1)) * N
elif N % 4 == 1:
  s = (N // 4) + 1
  if s % 3 == 0:
    h = s
    n = 2 * (s // 3) * (4 * s - 3)
    w = 2 * (s // 3) * (4 * s - 3)
  elif s % 3 == 2:
    h = N
    n = 4 * (s // 3) + 2
    w = (4 * (s // 3) + 2) * (12 * (s // 3) + 5)
print(h, n, w)

### FIXED CODE ###

N = int(input())
if N % 4 == 0:
  h, n, w = (3 * N) // 4, (3 * N) // 4, (3 * N) // 4
elif N % 4 == 2:
  h, n, w = N, N, N // 2
elif N % 4 == 3:
  s = N // 4 + 1
  h, n, w = 2 * s, 2 * s, s * N
elif N % 4 == 1:
  s = (N // 4) + 1
  if s % 3 == 0:
    h = s
    n = 2 * (s // 3) * (4 * s - 3)
    w = 2 * (s // 3) * (4 * s - 3)
  elif s % 3 == 2:
    h = N
    n = 4 * (s // 3) + 2
    w = (4 * (s // 3) + 2) * (12 * (s // 3) + 5)
  elif s % 3 == 1:
    l = (N+3)//4
    p = 0
    for i in range(l, 3501):
      m = (N*i)//(4*i-N)+1
      for j in range(m, 3501):
        #print(i, j, (N*i*j)%(4*i*j-N*(i+j)), 4*i*j-N*(i+j))
        if (N*i*j) % (4*i*j-N*(i+j)) == 0 and 4*i*j-N*(i+j) > 0:
          p = 1
          h, n, w = i, j, (N*i*j) // (4*i*j-N*(i+j))
          break
      if p == 1:
        break
print(h, n, w)
h,n=map(int,input().split())
INF=10**12
a=[]
b=[]
for i in range(n):
    A,B=map(int,input().split())
    a.append(A)
    b.append(B)
dp=[INF]*20010
dp[0]=0
for i in range(20010):
    for j in range(n):
        if i>=a[j]:
            dp[i]=min(dp[i],dp[i-a[j]]+b[j])
ans=min(dp[h:])
print(ans)


### FIXED CODE ###

h,a=map(int,input().split())
if h%a!=0:
    print(h//a+1)
else:
    print(h//a)
N = int(input())
S = input()

total = []

def yugo(st,x):
	if len(st) <= x + 1:
		return st[x],-1
	if st[x] == st[x + 1]:
		return yugo(st,x+1)
	else:
		return st[x] , x+1

x= 0
Y = []
for i in range(10000):
	y,x = yugo(S,x)
	if x == -1 :
		Y = Y + [y]
		break
	Y = Y + [y]
	
print(len(Y))


### FIXED CODE ###

N = int(input())
S = input()

total = []
Y = 0

for i in range(N):
	if i == N-1:
		Y = Y + 1
		break
	if S[i] == S[i+1]:
		continue
	else:
		Y = Y + 1
		
print(Y)
N,K = map(int, input().split())
A = list(map(int,input().split()))
MAX = 10**5+1
nxt = [-1 for i in range(MAX)]

last_index = [-1 for i in range(MAX)]
next_index = [-1 for i in range(MAX)]
first_index = [-1 for i in range(MAX)]
for i in range(N):
	a = A[i]
	last = last_index[a]
	if last >= 0:
		next_index[last] = i
	else:
		first_index[a] = i
	last_index[a] = i

start_stat = 0
while True:
	current = first_index[start_stat] + 1
	while current < N and next_index[current] != -1:
		current = next_index[current] + 1
	if current >= N:
		nxt[start_stat] = 0
		break
	else:
		stat = A[current]
		nxt[start_stat] = A[current]
		if nxt[A[current]] == -1:
			start_stat = A[current]
		else:
			break

order = [0]
in_order = [False for i in range(MAX)]
in_order[0] = True
last_stat = nxt[0]
while not in_order[last_stat]:
	order.append(last_stat)
	in_order[last_stat] = True
	last_stat = nxt[last_stat]
a,b = 0,len(order)
for x in order:
	if x == last_stat:
		break
	else:
		a += 1
		b -= 1
stat_index = K if K < a else (K-a) % b
init_status = order[stat_index]
before_stat = order[(stat_index - 1) % len(order)]
current = first_index[before_stat] + 1
if init_status == 0:
	print("")
	exit()
ans = []
while current < N:
	if next_index[current] != -1:
		current = next_index[current] + 1
	else:
		ans.append(A[current])
		current += 1
print( " ".join(list(map(str, ans))))


### FIXED CODE ###

N,K = map(int, input().split())
A = list(map(int,input().split()))
MAX = 2 * 10**5+1
nxt = [-1 for i in range(MAX)]

last_index = [-1 for i in range(MAX)]
next_index = [-1 for i in range(MAX)]
first_index = [-1 for i in range(MAX)]
for i in range(N):
	a = A[i]
	last = last_index[a]
	if last >= 0:
		next_index[last] = i
	else:
		first_index[a] = i
	last_index[a] = i

start_stat = 0
while True:
	current = first_index[start_stat] + 1
	while current < N and next_index[current] != -1:
		current = next_index[current] + 1
	if current >= N:
		nxt[start_stat] = 0
		break
	else:
		stat = A[current]
		nxt[start_stat] = A[current]
		if nxt[A[current]] == -1:
			start_stat = A[current]
			continue
		else:
			break

order = [0]
in_order = [False for i in range(MAX)]
in_order[0] = True
last_stat = nxt[0]
while not in_order[last_stat]:
	order.append(last_stat)
	in_order[last_stat] = True
	last_stat = nxt[last_stat]
a,b = 0,len(order)
for x in order:
	if x == last_stat:
		break
	else:
		a += 1
		b -= 1
stat_index = K if K < a else (K-a) % b
init_status = order[stat_index]
before_stat = order[(stat_index - 1) % len(order)]
current = first_index[before_stat] + 1
if init_status == 0:
	print("")
	exit()
ans = []
while current < N:
	if next_index[current] != -1:
		current = next_index[current] + 1
	else:
		ans.append(A[current])
		current += 1
print( " ".join(list(map(str, ans))))
N=input()
t=N
s=0
while t>0:
    s+=t%10
    t/=10

if N%s==0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N=input()
s=sum([int(i) for i in N])

print('Yes' if int(N)%s==0 else 'No')
import fractions
import sys
from functools import reduce
import math

input = sys.stdin.readline

def main():
    s = input_list()
    a_num = s.count('a')
    b_num = s.count('b')
    c_num = s.count('c')
    if abs(a_num - b_num) <= 1 and abs(b_num - c_num) <= 1 and abs(a_num - c_num) <= 1:
        print('YES')
    else:
        print('NO')



def divide_list(l, args):
    result = []
    pre = 0
    for i, a in enumerate(args):
        if i != 0:
            pre = args[i-1]
        result.append(l[pre:a])
        if i == len(args) - 1:
            result.append(l[a:])
    return result

def divide_two(n):
    c = 0
    while True:
        if c >= 2:
            break
        if n % 2 != 0:
            break
        n //= 2
        c += 1
    return c

def get_camulative(l):
    import itertools
    # 累積和
    return [0] + list(itertools.accumulate(l))

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


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


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


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


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


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
  s = input()
  ac = s.count('a')
  bc = s.count('b')
  cc = s.count('c')
  if abs(ac-bc) <= 1 and abs(bc-cc) <= 1 and abs(ac-cc) <= 1:
    print('YES')
  else:
    print('NO')
  
  
def input_list():
  return map(int, input().split())

def input_list_str():
  return map(str, input().split())

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

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

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

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

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c 

import math
import fractions
import collections
from functools import reduce
main()
a,b,c,d=map(int,input().split())
o1='+'
o2='+'
o3='+'
for x in (a+b,a-b):
  for y in (c,-c):
    for z in (d,-d):
      if x+y+z==7:
        if x==a-b:
          o1='-'
        if y==-c:
          o2='-'
        if z==-d:
          o3='-'
print("{}{}{}{}{}{}{}".format(a,o1,b,o2,c,o3,d))

### FIXED CODE ###

line=str(input())
line=list(line)
line=list(map(int,line))
a=line[0]
b=line[1]
c=line[2]
d=line[3]
o1='+'
o2='+'
o3='+'
count=0
for x in (a+b,a-b):
  for y in (c,-c):
    for z in (d,-d):
      if x+y+z==7 and count==0:
        if x==a-b:
          o1='-'
        if y==-c:
          o2='-'
        if z==-d:
          o3='-'
        count+=1
print("{}{}{}{}{}{}{}=7".format(a,o1,b,o2,c,o3,d))
N = int(input())
X = int(input())

#     1 2 3 4 5 6 7 8 9 0 1 2 3 4
# L0:     p   p       p   p
# L1:   b   p   b   b   p   b
# L2: b           p           b

def rec(n, x):

    if n==0: return 1  # レベル0ではpが１つ
    if x==1: return 0  

    all = (1<<(n+1)) - 3  # 1つ低レベルの総数
    p = (1<<(n)) - 1  # 1つ低レベルのパティ数
    
    # 今レベルは b + rec(n-1) + p + rec(n-1) + b
    if x <= all + 1: return rec(n-1, x-1)  #  低レベル + 1の大きさであれば今レベルから採るpはなし
    if x == all + 2: return p + 1  # 低レベル + 2の大きさであれば、低レベルのp数 + 今レベルの中間のp１つ
    if x <= all * 2 + 2: return p + 1 + rec(n-1, x-all-2)  # 上2つを通過しているので少なくとも低レベル1つと中間のpは食べている. 後は低レベル２つ目のp数に帰着
    if x == all * 2 + 3: return p * 2 + 1  # 低レベル2つまるごと + 中間のp
    return -1000000

print(rec(N, X))


### FIXED CODE ###


N, X = map(int, input().split())

#     1 2 3 4 5 6 7 8 9 0 1 2 3 4
# L0:     p   p       p   p
# L1:   b   p   b   b   p   b
# L2: b           p           b

def rec(n, x):

    if n==0: return 1  # レベル0ではpが１つ
    if x==1: return 0  

    all = (1<<(n+1)) - 3  # 1つ低レベルの総数
    p = (1<<(n)) - 1  # 1つ低レベルのパティ数
    
    # 今レベルは b + rec(n-1) + p + rec(n-1) + b
    if x <= all + 1: return rec(n-1, x-1)  #  低レベル + 1の大きさであれば今レベルから採るpはなし
    if x == all + 2: return p + 1  # 低レベル + 2の大きさであれば、低レベルのp数 + 今レベルの中間のp１つ
    if x <= all * 2 + 2: return p + 1 + rec(n-1, x-all-2)  # 上2つを通過しているので少なくとも低レベル1つと中間のpは食べている. 後は低レベル２つ目のp数に帰着
    if x == all * 2 + 3: return p * 2 + 1  # 低レベル2つまるごと + 中間のp
    return -1000000

print(rec(N, X))
n=int(input())
a=list(map(int,input().split()))
ans=1
for i in range(n):
    ans=ans*a[i]
if len(ans)>19:
    print("-1")
    exit()
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
if 0 in a:
    print("0")
    exit()
else:
    ans=1
    for i in range(n):
        ans*=a[i]
        if ans>10**18:
            print("-1")
            exit()
    print(ans)
num = list(map(int, input().split()))
if(b-a = c-b):
print('Yes')

a = num[0] + num[1]
print(int(a/24))


### FIXED CODE ###

num = list(map(int, input().split()))
if num[1]-num[0] == num[2]-num[1]:
	print('YES')
else:
	print('NO')
import math
A,B,C,D = map(int, input().split())


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

t = lcm(C, D)

m = B - (math.floor(B / C) + math.floor(B / D) - math.floor(B / (t)))
 
n = A-1 - (math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / (t)))

print(m-n)

### FIXED CODE ###

from fractions import gcd
 
A, B, C, D = map(int, input().split())
t = C * D // gcd(C, D)
print((B - (A - 1)) - (B//C + B//D - B//t) + ((A-1)//C + (A-1)//D - (A-1)//t))
a.b = map(int,input().split())
if 1<=a<=9 and 1<=b<=9:
    print(a*b)
elif:
    print("-1")

### FIXED CODE ###

a,b = map(int,input().split())
if 1<=a<=9 and 1<=b<=9:
    print(a*b)
else:
    print("-1")
x,a,b = [int(input()) for i in range(3)]
print((x-a)%bå)

### FIXED CODE ###

x,a,b = [int(input()) for i in range(3)]
print((x-a)%b)
import math

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

N -= K

ans = math.ceil(N / (K-1)) + 1

print (ans)

### FIXED CODE ###

li = list(input())

ans = 0

for i in range(4) :
	if li[i] == '+' : 
		ans += 1
	else:
		ans -= 1

print(ans)
a, b= input()
a=int(a)
b=float(b)
c=int(a*b)
print(c)

### FIXED CODE ###

from decimal import Decimal
a, b= input().split() 
a=int(a)
b=Decimal(b)
c=int(a*b)
print(c)
D, N = map(int, input().split())
nums = []
for i in range(1, 10**6):
    num = 100 ** D * i
    if num % 100 == D:
        nums.append(num)

print(nums[N - 1])


### FIXED CODE ###

D, N = map(int, input().split())
nums = []
for i in range(120):
    if i % 100 == 0:
        continue
    nums.append(100**D * i)

print(nums[N - 1])
n,k = map(int, input().split())
a=list(map(int,list(input().split())))

exist = [a[0]]
ex = {}

cnt = 1
while(True):
    if a[exist[-1]-1] in ex:
        idx = exist.index(a[exist[-1]-1])
        exist.append(a[exist[-1]-1])
        break
    exist.append(a[exist[-1]-1])
    ex[a[exist[-1]-1]] = 0
    
    cnt += 1
    if cnt >= k-1:
        print(exist[-1])
        exit()


#k = k-idx
#print(idx,exist,cnt)
d = (k-idx) % (cnt-idx)

print(exist[d+idx-1])


### FIXED CODE ###

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

exist = [1]
#exist.append(a[0])
ex = {}
ex[1] = 0
#ex[a[0]] = 0
if k == 1:
    print(a[0])
    exit()

cnt = 0
while(True):
    if a[exist[-1]-1] in ex:        
        idx = exist.index(a[exist[-1]-1])
        exist.append(a[exist[-1]-1])
        break
    ex[a[exist[-1]-1]] = 0
    exist.append(a[exist[-1]-1])
    
    cnt += 1
    if cnt-1 >= k-1:
        print(exist[-1])
        exit()


#k = k-idx
d = (k-idx) % (cnt-idx+1)

print(exist[d+idx])
a = raw_input()
b = raw_input()

if  a > b :
print("a > b")
if  a < b :
print("a < b")
if  a == b :
print("a == b")

### FIXED CODE ###

a,b=map(int,raw_input().split())
if a > b:
    print 'a > b'
elif a < b:
    print 'a < b'
else:
    print 'a == b'
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,K = IL()
if K == 1:
  print(0)
else:
  print(N-K)

### FIXED CODE ###

import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,K = IL()
if K == 1:
  print(0)
else:
  print(N-K)
N=int(input())
W=list(map(int, input().split()))

print(np.min([np.abs(np.sum(W[:t])-np.sum(W[t:]))) for t in range(1, N-1)]))

### FIXED CODE ###

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

output=abs(W[0]-sum(W[1:]))
for i in range(2, N):
  temp=abs(sum(W[:i])-sum(W[i:]))
  if output>temp:
    output=temp
    
print(output)
n = int(input())
ss = [input() for _ in range(n)]
ans = 0
count_ab = 0 # if ab exists
count_a = 0 # if end in a
count_b = 0 # if start in b
count_ba = 0 # if start in b and end in a
for s in ss:
  slen = len(s)
  if s[0] == 'B' and  s[-1] == 'A':
    count_ba +=1
  else:
      if s[0] == 'B':
        count_b +=1
      if s[-1] == 'A':
        count_a +=1
  count_ab += s.count("AB")

if count_ba == 0:
    print(count_ab + min(count_a, count_b))
elif count_a == 0 and count_b == 0:
    print(count_ab + count+ba -1)
elif count_a > 0 and count_b > 0:
    print(count_ab +  min(count_a, count_b) + count_ba)
else:
    print(count_ab + count_ba)

### FIXED CODE ###

n = int(input())
ss = [input() for _ in range(n)]
ans = 0
count_ab = 0 # if ab exists
count_a = 0 # if end in a
count_b = 0 # if start in b
count_ba = 0 # if start in b and end in a
for s in ss:
  slen = len(s)
  if s[0] == 'B' and  s[-1] == 'A':
    count_ba +=1
  else:
      if s[0] == 'B':
        count_b +=1
      if s[-1] == 'A':
        count_a +=1
  count_ab += s.count("AB")
 
if count_ba == 0:
    print(count_ab + min(count_a, count_b))
elif count_a == 0 and count_b == 0:
    print(count_ab + count_ba - 1)
elif count_a > 0 and count_b > 0:
    print(count_ab +  min(count_a, count_b) + count_ba)
else:
    print(count_ab + count_ba)