Harryxun/stf_run huggingface dataset:
n = int(input())
s = input()
#white
i=0
numw=0
while s[i]==".":
    numw+=1
    i+=1
    if i == n:
        break
#  ..##.#..
w = s.count(".")
answ = w-numw

#black
j=-1
numb=0
while s[j]=="#":
    numb+=1
    j-=1
    if j*(-1) == n:
        break
b = s.count('#')
ansb=b-numb

#b&w
bw=0
k=numw-1
if k!=0:
    while s[k]=="#":
        k+=1
        bw+=1
        if k==n:
            break
wb=0
l=numb*(-1)-1
if l!=-1:
    while s[l]==".":
        l-=1
        wb+=1
        if l==n*(-1):
            break
ans3=bw+wb

print(min(ansb,answ,ans3))


### FIXED CODE ###

n = int(input())
s = input()

a = []
#  .##..#.##.
w = s.count(".")
b = s.count("#")
m = min(w,b)

bb=0

for i in range(n):
    if s[i]=='.':
        w-=1
        a.append(bb+w)
    if s[i]=='#':
        bb += 1
        a.append(bb+w)
if len(a)>0:
    I = min(a)
    print(min(m,I))
else:
    print(m)
value = input()
if value == "AAA" or "BBB":
  print("No")
 else:
  print("Yes")

### FIXED CODE ###

value = input()

if value == "AAA" or value == "BBB":
  print("No")
else:
  print("Yes")
#/usr/bin/env python3
N, Q = map(int, input().split())
     
adj = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    a, b = (a - 1, b - 1)
    adj[a].append(b)
    adj[b].append(a)
 
values = [0 for _ in range(N)]

for _ in range(Q):
    p, x = map(int, input().split())
    values[p - 1] += x

def dfs(node, parent):
    for child in adj[node]:
        if child == parent: continue
        values[child] += values[node]
        dfs(child, node)

dfs(0, -1)

print(" ".join(map(str, values)))

### FIXED CODE ###

#/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)

def input():
    return sys.stdin.readline()

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

adj = [[] for _ in range(N)]

for _ in range(N - 1):
    a, b = map(int, input().split())
    a, b = (a - 1, b - 1)
    adj[a].append(b)
    adj[b].append(a)
    
values = [0 for _ in range(N)]
    
for _ in range(Q):
    p, x = map(int, input().split())
    values[p - 1] += x

def dfs(node, parent):
    for child in adj[node]:
        if child == parent: continue
        values[child] += values[node]
        dfs(child, node)

dfs(0, -1)

print(" ".join(map(str, values)))
n=int(input())
if n%2==0:
    print((n//2)*(n//2+1)
else:
    print((n//2)**2)

### FIXED CODE ###

n=int(input())
if n%2==1:
    print((n//2)*(n//2+1))
else:
    print((n//2)**2)
n, m = sorted(map(int, input.split()))
print(1 if n==m==1 else m-2 if n==1 else (n-2)*(m-2))

### FIXED CODE ###

n, m = sorted(map(int, input().split()))
print(1 if n==m==1 else m-2 if n==1 else (n-2)*(m-2))
N = int(input())
light_rule = {n:int(input())-1 for n in range(N)}

light = ["1"]+["0"]*(N-1)

flag = 0
num = 0
bottun = 0
for _ in range(N):
    if light[2] == "1":
        flag = 1
        break
    num += 1
    # print(bottun, light_rule[bottun])
    light[bottun] = "0"
    light[light_rule[bottun]] = "1"
    bottun = light_rule[bottun]
    # print(light)
    
if flag:
    print(num)
else:
    print(-1)

### FIXED CODE ###

N = int(input())
light_rule = {n:int(input())-1 for n in range(N)}

light = ["1"]+["0"]*(N-1)

flag = 0
num = 0
bottun = 0
for _ in range(N):
    if light[1] == "1":
        flag = 1
        break
    num += 1
    # print(bottun, light_rule[bottun])
    light[bottun] = "0"
    light[light_rule[bottun]] = "1"
    bottun = light_rule[bottun]
    # print(light)
    
if flag:
    print(num)
else:
    print(-1)
n = int(input())
a = [int(i) for i in input().split()]
m = len(list(filter(lambda x: x < 0, a)))
s = sum(map(abs, a))
if m % 2 == 0 or a in 0:
    print(s)
else:
    print(s - 2 * min(a))


### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
m = len(list(filter(lambda x: x < 0, a)))
s = [abs(i) for i in a]
if m % 2 == 0 or 0 in a:
    print(sum(s))
else:
    print(sum(s) - 2 * min(s))
a=input().split('/')
if int(a[1]<=4):
  print("Heisei")
else:
  print("TBD")
  
  

### FIXED CODE ###

a=input().split('/')
if int(a[1])<=4:
  print("Heisei")
else:
  print("TBD")
from collections import *
d=defaultdict(list)
n=int(input())

for s in range(n-1):
    a,b,c=map(int,input().split())
    d[a].append([b,c])
    d[b].append([a,c])

#defaultdict(<class 'list'>, {1: [[2, 1], [3, 1]], 2: [[1, 1], [3, 3]], 3: [[1, 1], [2, 3]]})
 
def DIJKSTRA(point,d):
    cost      = {node:float("inf") for node in d.keys()}
    preference= {node:None         for node in d.keys()}#最適路のこと 
    Q         = set(d.keys())  #頂点のリスト
    cost[point]=0  #開始地点のコストをゼロとする（当たり前
    while True:
        prefnd=min(Q, key=lambda c:cost[c]) #最適な点探し
        Q.remove(prefnd)  #最適だった点を削除
        if len(Q)==0:
            break #全部の点消したら終了
        for p,c in d[prefnd]:  #次の点とそこまでのコスト
            temp=cost[prefnd]+c  #スタートからそこまでのコストを計算
            if temp<cost[p]:   #計算してみたコストがそこに行くまでの最小値ならば
                cost[p]=temp #最小値更新
                preference[p]=prefnd
    return preference,cost  #点のつながりとコスト例 1から１に０ １から２に１ １から３に２

q,k=map(int,input().split())
x,y=DIJKSTRA(k,d)

for i in range(q):
    a,b=map(int,input().split())
    print(y[a]+y[b])


### FIXED CODE ###

n=list(input())
s=[1 for i in range(len(n)//2) if n[i]==n[len(n)-i-1]]
print("Yes" if len(s)==len(n)//2 else "No")
n,m=map(int,input().split())
ac=[False]*(n+1)
wa=[0]*(n+1)
pena=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if s == "AC":
        ac[p] = True
    else:
        if False:
            wa[p] += 1
        else:
            continue
for i in ac:
    if i == True:
        pena += wa[index(i)]

### FIXED CODE ###

n,m=map(int,input().split())
AC=[0 for _ in range(n)]
WA=[0 for _ in range(n)]
pen=0
for _ in range(m):
    p,s=input().split()
    p=int(p)
    if s=="AC":
        if AC[p-1]==0:
            AC[p-1]=1
            pen += WA[p-1]
        else:
            pass
    else:
        if AC[p-1]==0:
            WA[p-1] +=1
        else:
            pass
print(AC.count(1),pen)
import numpy as np

n = int(input())
lists = []
limit = []
cost = []
for i in range(n):
    a, b = (map(int,input().split()))
    lists.append([a,b,True])

lists.sort(key=lambda x:x[1])

def dfs(que, sum_cost, in_list):
    if que == n:
        print('Yes')
        exit(0)
    for i in range(n):
        if lists[i][2]:
            sum_cost_out = sum_cost + lists[i][0]
            if sum_cost_out <= lists[i][1]:
                out_list = in_list[:]
                out_list[i][2] = False
                dfs(que+1,sum_cost_out,out_list)

dfs(0,0,lists)
print('No')

### FIXED CODE ###

n = int(input())
lists = []
limit = []
cost = [0 for _ in range(n)]
for i in range(n):
    a, b = (map(int,input().split()))
    lists.append([a,b])

lists.sort(key = lambda x:x[1])
sum_ = 0
for i in range(n):
    sum_ = sum_ + lists[i][0]
    if sum_ <= lists[i][1]:
        continue
    else:
        print('No')
        exit(0)
print('Yes')
from collections import Counter
N=int(input())
A=list(map(int,input().split()))
ans=0
if N%2!=0:
    c=list(Counter(A).items())
    c.sort(reverse=True)
    for a,b in c:
        if a!=0 and b==2:
            ans+=1
        elif a==0 and b==1:
            print(2**ans/(10**9+7))
        else:
            print(0)
            break
else:
    if A.count(0)>0:
        print(0)
    else:
        c=list(Counter(A).items())
        c.sort(reverse=True)
        for a,b in c:
            if a!=1 and b==2:
                ans+=1
            elif a==1 and b==2:
                ans+=1
                print(2**ans/(10**9+7))
            else:
                print(0)
                break


### FIXED CODE ###

from collections import Counter
N=int(input())
A=list(map(int,input().split()))
ans=0
if N%2!=0:
    c=list(Counter(A).items())
    c.sort(reverse=True)
    for a,b in c:
        if a!=0 and b==2:
            ans+=1
        elif a==0 and b==1:
            print(2**ans%(10**9+7))
        else:
            print(0)
            break
else:
    if A.count(0)>0:
        print(0)
    else:
        c=list(Counter(A).items())
        c.sort(reverse=True)
        for a,b in c:
            if a!=1 and b==2:
                ans+=1
            elif a==1 and b==2:
                ans+=1
                print(2**ans%(10**9+7))
            else:
                print(0)
                break
W, H, N = map(int, input().split())
x1 = y1 = 0
x2 = W
y2 = H
for _ in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        x1 = max(x1, x)
    elif a == 2:
        x2 = min(x2, x)
    elif a == 3:
        y1 = max(y1, y)
    else:
        y2 = min(y2, y)

print(max(0, (x2 - x1)) * max(0, (y2 - y1)))

### FIXED CODE ###

lst = sorted([int(x) for x in input().split()])
if lst[0] + lst[1] == lst[2]:
    print('Yes')
else:
    print('No')
N = int(input())
A = [int[i] for i in input().split()]

ans = 0
for i in range(N):
  if A[i] == i+1:
    ans += 1
print(ans)

### FIXED CODE ###

N = int(input())
A = [int(i)-1 for i in input().split()]

ans = 0
for i in range(N):
  if A[A[i]]==i: 
    ans += 1
print(ans//2)
import math

n=int(input())
t=int(input())
mint=t
t1=int(input())
if t1<t: mint=t1
maxtt=t1-t

for i in range(2,n):
    t=int(input())

    if t-mint>maxtt: maxtt=t-mint
    if t<mint: mint=# TEMP: 

print(int(maxtt))


### FIXED CODE ###

import math

n=int(input())
t=int(input())
mint=t
t1=int(input())
if t1<t: mint=t1
maxtt=t1-t

for i in range(2,n):
    t=int(input())

    if t-mint>maxtt: maxtt=t-mint
    if t<mint: mint=t

print(int(maxtt))
import sys

N = int(input())
A = list(map(int, sys.stdin.readline()[:-1]))

A.sort()
if len(A) == 1:
    print(1)
    sys.exit(0)
elif A[0] == A[-1]:
    print(0)
    sys.exit(0)
elif A[0] == 1:
    print(1)
    sys.exit(0)


d =[]

for i in range(len(A)):
    flag = True
    for j in d:
        if A[i] % j == 0:
            flag = False
            break
    if flag:
        d.append(A[i])

print(len(d))


### FIXED CODE ###

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

l = [0] *(10**6+1)

for i in range(N):
    num = A[i]
    if l[num] != 0:
        l[num] = 2
        continue
    for j in range(num, 10**6+1, num):
        l[j] += 1
ans = 0
for i in range(N):
    num = A[i]
    if l[num] == 1:
        ans += 1
print(ans)
m = 10**9 + 7
X, Y = map(int, input().split())
t = [[0] * (X + 2) for i in range(Y + 2)]
for i in range(Y):
    for j in range(X):
        t[i + 1][j + 2] += t[i][j] + 1
        t[i + 2][j + 1] += t[i][j] + 1
        t[i + 1][j + 2] %= m
        t[i + 2][j + 1] %= m

print(t[Y - 1][X - 1])


### FIXED CODE ###

def gcd1(a, b):
    def calc(a, b, first, second):
        if a < b:
            a, b = b, a
        r = a % b
        q = -(a - r)//b
        if r == 0:
            return b, second
        # first += q * second
        first = [x + q * y for (x, y) in zip(first, second)]
        return calc(r, b, second, first)
    first = [1, 0]
    second = [0, 1]
    return calc(a, b, first, second)

def mod_inv(n, mod):
    table = gcd1(n, mod)
    inv = table[1][1]
    if inv < 0:
        inv += mod
    return inv

def cmb(n, r, mod):
    ans = 1
    for i in range(r):
        ans = (ans * n) % mod
        n -= 1
    ans1 = 1
    for i in range(1, r + 1):
        ans1 = (ans1 * i) % mod
    return ans * mod_inv(ans1, mod)

def main():
    m = 10**9 + 7
    X, Y = map(int, input().split())
    XY = X + Y
    min_xy = XY // 3
    max_xy = XY - min_xy
    if XY % 3 != 0:
        print(0)
        return
    if X < min_xy or X > max_xy or Y < min_xy or Y > max_xy:
        print(0)
        return
    index_x = X - min_xy
    index_y = Y - min_xy
    # print(index_x, index_y)
    ans = cmb(min_xy, index_x, m)
    print(ans % m)


if __name__ == '__main__':
    main()
n = int(input())
s = list[input().split()]

if len(set(s)) == "Y":
  print("Four")
else:
  print("Three")

### FIXED CODE ###

n = int(input())
s = list(input().split())

if len(set(s)) == 3:
  print("Three")
else:
  print("Four")
import itertools

def findRoot(uf,value):
  if uf[value]==None:
    return value
  else:
    return findRoot(uf,uf[value])

n,m=[int(x) for x in input().split(' ')]

uf=[None]*n
b=[]
s=[1]*n
r=[]

for x in range(0,m):
  b.append([int(x)-1 for x in input().split(' ')])

for x in b[::-1]:
  r1=findRoot(uf,x[0])
  r2=findRoot(uf,x[1])

  if r1==r2:
    r.append(0)
  else:
    r.append(s[r1]*s[r2])
    uf[r2]=r1
    s[r1]+=s[r2]


for x in itertools.accumulate(r[::-1]):
  print(x)

### FIXED CODE ###

import itertools
import sys

def findRoot(uf,value):
  if uf[value]==None:
    return value
  else:
#経路圧縮
    uf[value]=findRoot(uf,uf[value])
    return uf[value]


sys.setrecursionlimit(50000)
n,m=[int(x) for x in input().split(' ')]

uf=[None]*n
b=[]
s=[1]*n
r=[]

for x in range(0,m):
  b.append([int(x)-1 for x in input().split(' ')])

for x in b[::-1]:
  r1=findRoot(uf,x[0])
  r2=findRoot(uf,x[1])

  if r1==r2:
    r.append(0)
  else:
    r.append(s[r1]*s[r2])
#木の結合
    uf[r2]=r1
    s[r1]+=s[r2]

for x in itertools.accumulate(r[::-1]):
  print(x)
N = int(input())
w = input()
W_list = [w]
for i in range(N-1):
  W = input()
  if w[-1] == W[0] and W not in W.list:
    W_list.append(w)
    w = W
  else:
    print("No")
    exit()
print("Yes")

### FIXED CODE ###

N = int(input())
W = [input() for _ in range(N)]
for i in range(N):
    for j in range(N):
        if i != j:
            if W[i] == W[j]:
                print("No")
                exit()
for k in range(N-1):
    if W[k][-1] != W[k+1][0]:
        print("No")
        exit()
print("Yes")
N = int(input())
S = ""
C0 = 0
C1 = 0
C2 = 0
C3 = 0

for i in range(N-1):
    S = input()
    if S == AC:
        C0 = C0 + 1
    elif S == WA:
        C1 = C1 + 1
    elif S == TLE:
        C2 = C2 + 1
    else:
        C3 = C3 + 1

### FIXED CODE ###

N = int(input())
C0, C1, C2, C3 = 0, 0, 0, 0

for i in range(N):
    S = str(input())
    if S == "AC":
        C0 = C0 + 1
    elif S == "WA":
        C1 = C1 + 1
    elif S == "TLE":
        C2 = C2 + 1
    else:
        C3 = C3 + 1

print("AC x " + str(C0))
print("WA x " + str(C1))
print("TLE x " + str(C2))
print("RE x " + str(C3))
import numpy as np

N = int(input())

temp = np.linspace(1, N-1, N-1)
answer = np.cumsum(temp)

print(int(answer[-1]))

### FIXED CODE ###

N = int(input())

answer = N * (N - 1) // 2

print(int(answer))
n,p=map(int,input().split())
s=input()

count=0
if p==2:
    for i in range(n):
        if int(s[i])%2==0:
            count+=i+1
elif p==5:
    for i in range(n):
        if int(s[i])%5==0:
            count+=i+1
else:
    u=[]
    num=0
    for i in range(n):
        u.append(int(s[i:n]%p))
    u.append(0)
    for i in range(n):
        for j in range(i,n):
            if (u[i]-u[j+1])%p==0:
                count+=1
print(count)

### FIXED CODE ###

seq=input()
a=0
b=0
for i in range(3):
    if seq[i]=="A":
        a+=1
    else:
        b+=1
if a>=1 and b>=1:
    print("Yes")
else:
    print("No")
from collections import *
mod=10**6+3
fac=[0 for i in range(mod)]
fac[0]=1
for i in range(0,len(fac)-1):
    fac[i+1]=(fac[i]*(i+1))%mod
fac[0]=0
Q=int(input())
for q in range(Q):
    x,d,n=map(int,input().split())
    D=pow(d,mod-2,mod)
    a=(x-d%mod)*D%mod
    b=a+n
    if a<b:
        if a>0:
            value=fac[b]*pow(fac[a],mod-2,mod)*pow(d,n,mod)
        else:
            value=fac[b]*pow(d,n,mod)
        print(value%mod)
    else:
        print(0)


### FIXED CODE ###

from collections import *
mod=10**6+3
fac=[0 for i in range(mod)]
fac[0]=1
for i in range(0,len(fac)-1):
    fac[i+1]=(fac[i]*(i+1))%mod
fac[0]=0
Q=int(input())
for q in range(Q):
    x,d,n=map(int,input().split())
    if d>0:
        D=pow(d,mod-2,mod)
        a=(x-d%mod)*D%mod
        b=(a+n)%mod
        if a<b and a+n<mod:
            if a>0:
                value=fac[b]*pow(fac[a],mod-2,mod)*pow(d,n,mod)
            else:
                value=fac[b]*pow(d,n,mod)
            print(value%mod)
        else:
            print(0)
    else:
        print(pow(x,n,mod))
s = input()
K = int(input())
s_dic = {c: [] for c in "abcdefghijklmnopqrstuvwxyz"}
for i, c in enumerate(s):
    s_dic[c].append(i)
substrings = set()
for lc in "abcdefghijklmnopqrstuvwxyz":
    for i in s_dic[lc]:
        for j in range(i + 1, len(s) + 1):
            substrings.add(s[i:j])
    if len(substrings) >= K:
        break
print(sorted(list(substrings))[K - 1])


### FIXED CODE ###

from collections import Counter


S = input()
C = Counter(S)
vs = sorted(list(C.values()))
if len(vs) == 1:
    print("YES") if vs[0] == 1 else print("NO")
elif len(vs) == 2:
    print("YES") if vs[0] == vs[1] and vs[0] == 1 else print("NO")
else:
    print("YES") if vs[2] - 1 <= vs[0] and vs[2] - 1 <= vs[1] else print("NO")
N=int(input())
a=list(map(int,input().split()))

l=[0]*10**5+2

for v in a:
    l[v]+=1
    l[v+1]+=1
    l[v+2]+=1

print(max(l))

### FIXED CODE ###

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

l=[0]*((10**5)+2)

for v in a:
    l[v]+=1
    l[v+1]+=1
    l[v+2]+=1

print(max(l))
n,*a,t=map(int,open(0).read().split()),sum(a)
v=w=1
for q in a:
  w=min(2*(w-q),t:=t-q);(v:=v+w)
  if w<0:print(-1);exit()
print(v)


### FIXED CODE ###

from itertools import accumulate
n=int(input())
a=list(map(int,input().split()))
c=list(accumulate(a))
b=[0]*(n+1)
#大きくしすぎてしまう場合がある
#いや上限を考えろや
def f():
    global n,a,b
    for i in range(n+1):
        if i==0:
            b[0]=min(c[n]-c[0],1)
        else:
            b[i]=min(2*(b[i-1]-a[i-1]),c[n]-c[i-1])

    if n==0:
        if a[0]!=1:
            print(-1)
        else:
            print(1)
    elif b[n]!=a[n]:
        print(-1)
    else:
        print(sum(b))
        #print(b)
f()
import math

N = input()
list = []
min = 0
for i in range(5)
	list.append(int(input()))
	if min > list[i] or i == 0:
      min = list[i]

print(math.ceil(N/min) + 4)


### FIXED CODE ###

import math

N = int(input())
list = []
min = 0
for i in range(5):
  list.append(int(input()))
  if min > list[i] or i == 0:
    min = list[i]

print(math.ceil(N/min) + 4)
import sys
from fractions import gcd
from itertools import permutations, combinations, accumulate
from collections import deque
from heapq import heappush, heappop, heapify
import math
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
MOD = 10**9 + 7

def main():
    c = ord(input())
    c += 1
    if c == 123:
        c = 97
    print(chr(c))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    c = ord(input())
    c += 1
    if c == 123:
        c = 97
    print(chr(c))

if __name__ == '__main__':
    main()
import sys
input = sys.stdin.readline
n = int(input())
x = int(input().rstrip(),2)
#print(x)
anslist = []

def popcount(x):
    '''xの立っているビット数をカウントする関数
    (xは64bit整数)'''

    # 2bitごとの組に分け、立っているビット数を2bitで表現する
    x = x - ((x >> 1) & 0x5555555555555555)

    # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f # 8bitごと
    x = x + (x >> 8) # 16bitごと
    x = x + (x >> 16) # 32bitごと
    x = x + (x >> 32) # 64bitごと = 全部の合計
    return x & 0x0000007f
def toggle_nth_bit(num: int, n: int):
    return num ^ (1 << n)


for i in range(n):
    '''
    b = list(x)
    if b[n-i] == '1':
        b[n-i] = '0'
    else:
        b[n-i] = '1'
    p = int(''.join(b),2)
    '''
    p = toggle_nth_bit(x,i)
    #print(p)
    ans = 0
    while True:
        if p == 0:
            break
        p = p%popcount(p)
        ans += 1
    anslist.append(ans)

for i in range(len(anslist)-1,-1,-1):
    print(anslist[i])


### FIXED CODE ###

import sys
input = sys.stdin.readline

def p_count(n):
    return bin(n)[2:].count('1')


n = int(input())
x = input().rstrip()
x_dec = int(x,base = 2)

pop_cnt = x.count('1')
pop_cnt_0 = (pop_cnt + 1)
pop_cnt_1 = (pop_cnt - 1)
x_0 = pow(x_dec,1,pop_cnt_0)
x_1 = pow(x_dec,1,pop_cnt_1) if pop_cnt_1 > 0 else 0

x_bit = [0]*n

for i in range(n-1,-1,-1):
    if x[i] == '0':
        x_bit[i] = (x_0 + pow(2,n-1-i,pop_cnt_0))%pop_cnt_0
        #x_bit[i] = (x_dec + pow(2,n-1-i))%pop_cnt_0
        
    else:
        if pop_cnt_1 > 0:
            x_bit[i] = (x_1 - pow(2,n-1-i,pop_cnt_1))
            x_bit[i] = x_bit[i] if x_bit[i] >= 0 else x_bit[i] + pop_cnt_1
        else:
            x_bit[i] = -1

anslist = []
for i in range(n):
    if x_bit[i] == -1:
        anslist.append(0)
        continue
    ans = 1 
    now = x_bit[i]
    while True:
        if now == 0:
            break
        now = now%p_count(now)
        
        ans += 1
    anslist.append(ans)


for ans in anslist:
    print(ans)
N = int(input())
A = list(map(int, input().split()))
a = (sum(A)**2)
b =  sum([(a**2) for a in A])
print(((a-b)%(10**9+7))//2)

### FIXED CODE ###

D, S, T = map(int, input().split())
if S*T >= D:
  print("Yes")
else:
  print("No")
nk = list(input().split())
n = nk[0]
k = nk[1]
a = []
for i in range(1,k+1):
  d = int(input())
  b = list(input().split())
  a.entend(b)
c = 0
for j in range(1,n+1):
  if j not in a:
    c = c+1
print(c)
  

### FIXED CODE ###

nk = list(input().split())
n = nk[0]
k = nk[1]
a = []
c = 0
for i in range(int(k)):
  d = int(input())
  b = list(input().split())
  a.extend(b)
for j in range(1,int(n)+1):
  if str(j) not in a:
    c = c+1
print(c)
a = input()[0]
if a == 3:
  print('bon;)
elif a == 0 or a==1 or a==6 or a==8:
  print('pon')
else:
  print('hon')

### FIXED CODE ###

a = input()[-1]
if a == '3':
  print('bon')
elif a == '0' or a=='1' or a=='6' or a=='8':
  print('pon')
else:
  print('hon')
if __name__ == '__main__':
    n,m = list(map(int, input().split()))
    a = list(map(int, input().split()))
    bc = []
    for i in range(m):
        bc.append(list(map(int, input().split())))

    bc.sort(key=lambda x: x[1], reverse=True)
    a.sort()

    bcn = 0
    for i in range(n):
        if(a[i] < bc[bcn][1]):
            a[i] = bc[bcn][1]
            bc[bcn][0] -= 1
            if(bc[bcn][0] == 0):
                bcn += 1
                if(bcn == m):
                    break

    print(sum(a))


### FIXED CODE ###


if __name__ == '__main__':
    a,b = list(map(int, input().split()))

    if(a <= 5):
        print(0)
    elif(a <= 12):
        print(b//2)
    else:
        print(b)
player_list = ['a', 'b', 'c']
s = {player_list[n]: list(raw_input()) for n in player_list}

current_turn = player_list[0]

get_winner = lambda x, s: not s[x] and x.upper() or get_winner(s[x].pop(0), s)

print get_winner(current_turn, s)

### FIXED CODE ###

# -*- coding: utf-8 -*-
s_a = [s for s in raw_input() if s != 'a']
s_b = [s for s in raw_input() if s != 'b']
s_c = [s for s in raw_input() if s != 'c']

x = 0
y = 0
z = 0
next_turn = 'A'

while x <= len(s_a) and y <= len(s_b) and z <= len(s_c):
    try:
        if next_turn == 'A':
            next_turn = s_a[x].upper()
            x += 1
        elif next_turn == 'B':
            next_turn = s_b[y].upper()
            y += 1
        else:
            next_turn = s_c[z].upper()
            z += 1
    except IndexError:
        print next_turn
        break
S=raw_input()
h=S//3600
r=S%3600//60
s=S%3600%60
print h:r:s

### FIXED CODE ###

S=input()
h=S/3600
r=S%3600/60
s=S-h*3600-r*60
print str(h)+':'+str(r)+':'+str(s)