Harryxun/stf_run huggingface dataset:
import numpy as np

temp=list(map(int, input().split()))
N=temp[0]
M=temp[1]

AB=np.array([list(map(int, input().split())) for i in range(N)])
AB=np.c_[AB, np.zeros((AB.shape[0], 1))]

money=0
for i in range(1, M+1):
  temp=AB[AB[:, 0]<=i]
  temp=temp[temp[:, 2]==0]
  temp=temp[np.argmax(temp[:, 1])]
  money+=temp[1]
  
  x=0
  while x<AB.shape[0]:
    if sum(AB[x, :]==temp)==3:
      AB[x, 2]=1
      break
    x+=1
    
print(int(money))

### FIXED CODE ###

import heapq

N, M=map(int, input().split())
AB=[list(map(int, input().split())) for i in range(N)]
AB=sorted(AB, key=lambda x:x[0])
h=[0]*M
heapq.heapify(h)

out=0
j=0
for i in range(1, M+1):
  while j<N and AB[j][0]<=i:
    heapq.heappush(h, -1*AB[j][1])
    j+=1
    
  out+=-1*heapq.heappop(h)
  
print(out)
D, G = map(int, input().split())
PC = [list(map(int,input().split())) for i in range(D)]

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 0):
        ck.append(j)
      for k in range(PC[j][0]):
        t += (max(ck)+1)*100
        c += 1
        if t >= G:
          l.append(c)
      
print(min(l))


### FIXED CODE ###

D, G = map(int, input().split())
PC = [list(map(int,input().split())) for i in range(D)]

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 1):
        continue
      else:
        ck.append(j)
    if ck == []:
      continue
    ckm = max(ck)
    for k in range(PC[ckm][0]):
      t += (ckm+1)*100
      c += 1
      if t >= G:
        l.append(c)
        break
      
print(min(l))
import numpy

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

val = numpy.prod(A)

if val > 10**18:
    print('-1')
else:
    print(val)


### FIXED CODE ###

A, B = map(int, input().split())


print(A*B)
a = int(input())
if a > 3:
	if a % 4 == 0 or a % 7 == 0 or a % 7 == 4 or a % 7 == 1 or a % 4 == 3:
        print("Yes")
    else:
        print("No")
else:
  print("No")
  

### FIXED CODE ###

a = int(input())
for i in range(a//4+1):
    for j in range(a//7+1):
        if i * 4 + j * 7 == a:
            print("Yes")
            exit()
print("No")
N = int(input())

if N>=3200:
  print(s)
  
else:
    print("red")

### FIXED CODE ###

a = int(input())
s = input()

if a>=3200:
  print(s)
  
else:
    print("red")
n = int(input())

sayTable = []
for i in range(n):
	a = int(input())
	
	sayArray = []
	for j in range(a):
		x, y = [int(v) for v in input().split()]
		sayArray.append((x-1, y+1))
	sayTable.append(sayArray)

def count(honest):
	count = 0
	for v in honest:
		if v == 2:
			count += 1
	return count

def checkHonest(sayArray, honest):
	for x, y in sayArray:
		if y == 2 and honest[x] != 2:
			return False
	return True

def checkHonestAll(sayTable, honest):
	for i in range(n):
		h = honest[i]
		if h != 2:
			continue
		for x, y in sayArray:
		if honest[x] != y:
			return False
	return True

def setHonest(sayArray, honest):
	for x, y in sayArray:
		honest[x] = y

def search(sayTable, honest, i):
	if i >= n;
		if checkHonestAll(sayTable, honest):
			return count(honest)
		else:
			return 0

	count = 0
	h = honest[i]
    sayArray = sayTable[i]
	if (h == 0 or h == 2) and checkHonest(sayArray, honest):
		copyHonest = honest[:]
		setHonest(sayArray, copyHonest)
		copyHonest[i] = 2
		c = search(sayTable, copyHonest, i + 1)
		if count < c:
			count = c

	honest[i] = 1
	c = search(sayTable, honest, i+1)
	if count < c:
		count = c
	return count

print(search(sayTable, [0] * n, 0));


### FIXED CODE ###

n = int(input())

sayTable = []
for i in range(n):
	a = int(input())
	
	sayArray = []
	for j in range(a):
		x, y = [int(v) for v in input().split()]
		sayArray.append((x-1, y+1))
	sayTable.append(sayArray)

def countHonest(honest):
	count = 0
	for v in honest:
		if v == 2:
			count += 1
	return count

def checkHonest(sayArray, honest):
	for x, y in sayArray:
		if honest[x] == 0:
				continue
		if y == 2 and honest[x] != 2:
			return False
	return True

def checkHonestAll(sayTable, honest):
	for i in range(n):
		h = honest[i]
		if h != 2:
			continue
		sayArray = sayTable[i]
		for x, y in sayArray:
			if y != honest[x]:
				return False
	return True

def setHonest(sayArray, honest):
	for x, y in sayArray:
		honest[x] = y

def search(sayTable, honest, i):
	if i >= n:
		if checkHonestAll(sayTable, honest):
			return countHonest(honest)
		else:
			return 0

	count = 0
	h = honest[i]
	sayArray = sayTable[i]
	if (h == 0 or h == 2) and checkHonest(sayArray, honest):
		copyHonest = honest[:]
		setHonest(sayArray, copyHonest)
		copyHonest[i] = 2
		c = search(sayTable, copyHonest, i+1)
		if count < c:
			count = c

	honest[i] = 1
	c = search(sayTable, honest, i+1)
	if count < c:
		count = c
	return count

print(search(sayTable, [0] * n, 0))
import math


A, B = map(int, input().split())
gcd = math.gcd(A, B)

print((A * B) // gcd)

### FIXED CODE ###

import fractions


A, B = map(int, input().split())
gcd = fractions.gcd(A, B)

print((A * B) // gcd)
S = int(input())

if S < 3:
    print(0)
    exit()

x = [0] * (S + 1)
x[3] = x[4] = x[5] = 1
for i in range(6, S + 1):
    x[i] += 1
    for j in range(3, i - 3 + 1):
        x[i] += x[i - j]

print(x[S] % (10 ** 9 + 7))


### FIXED CODE ###

S = int(input())

if S < 3:
    print(0)
    exit()

if S < 6:
    print(1)
    exit()

x = [0] * (S + 1)
x[3] = x[4] = x[5] = 1
for i in range(6, S + 1):
    x[i] += 1
    for j in range(3, i - 3 + 1):
        x[i] += x[i - j]

print(x[S] % (10 ** 9 + 7))
K = int(input())
Is = [input() for i in range(K)]
Ns = [input() for i in range(K)]
atk_I = 0
atk_N = 0
#"mamoru", "tameru", "kougekida"
#"Isono-kun", "Nakajima-kun", "Hikiwake-kun"
for i, n in zip(Is, Ns):
	i_n = [i, n]
	if (i_n.count("mamoru") == 2):
		pass
	elif (i_n.count("mamoru") == 1):
		if (i_n.count("tameru") == 1):
			exec("atk_{} += 1".format(I if i[0] == "t" else N))
			if (atk_I > 5):
				atk_I = 5
			elif (atk_N > 5):
				atk_N = 5
		else:
			if (i[0] == "k"):
				if (atk_I == 5):
					print("Isono-kun")
					exit()
				elif (atk_I == 0):
					print("Nakajima-kun")
					exit()
				else:
					atk_I = 0
			elif (n[0] == "k"):
				if (atk_N == 5):
					print("Nakajima-kun")
					exit()
				elif (atk_N == 0):
					print("Isono-kun")
					exit()
				else:
					atk_N = 0
	else:
		if (i_n.count("kougekida") == 2):
			if (atk_I > atk_N):
				print("Isono-kun")
				exit()
			elif (atk_I == atk_N):
				atk_I = 0
				atk_N = 0
			else:
				print("Nakajima-kun")
				exit()
		elif (i_n.count("kougekida") == 1):
			if (i[0] == "k"):
				if (atk_I == 0):
					print("Nakajima-kun")
					exit()
				else:
					print("Isono-kun")
					exit()
			else:
				if (atk_N == 0):
					print("Isono-kun")
					exit()
				else:
					print("Nakajima-kun")
					exit()
		else:
			atk_I += 1 if atk_I != 5 else 0
			atk_N += 1 if atk_N != 5 else 0
else:
	print("Hikiwake-kun")


### FIXED CODE ###

K = int(input())
Is = [input() for i in range(K)]
Ns = [input() for i in range(K)]
atk_I = 0
atk_N = 0
#"mamoru", "tameru", "kougekida"
#"Isono-kun", "Nakajima-kun", "Hikiwake-kun"
for i, n in zip(Is, Ns):
	i_n = [i, n]
	if (i_n.count("mamoru") == 2):
		pass
	elif (i_n.count("mamoru") == 1):
		if (i_n.count("tameru") == 1):
			exec("atk_{} += 1".format('I' if i[0] == "t" else 'N'))
			if (atk_I > 5):
				atk_I = 5
			elif (atk_N > 5):
				atk_N = 5
		else:
			if (i[0] == "k"):
				if (atk_I == 5):
					print("Isono-kun")
					exit()
				elif (atk_I == 0):
					print("Nakajima-kun")
					exit()
				else:
					atk_I = 0
			elif (n[0] == "k"):
				if (atk_N == 5):
					print("Nakajima-kun")
					exit()
				elif (atk_N == 0):
					print("Isono-kun")
					exit()
				else:
					atk_N = 0
	else:
		if (i_n.count("kougekida") == 2):
			if (atk_I > atk_N):
				print("Isono-kun")
				exit()
			elif (atk_I == atk_N):
				atk_I = 0
				atk_N = 0
			else:
				print("Nakajima-kun")
				exit()
		elif (i_n.count("kougekida") == 1):
			if (i[0] == "k"):
				if (atk_I == 0):
					print("Nakajima-kun")
					exit()
				else:
					print("Isono-kun")
					exit()
			else:
				if (atk_N == 0):
					print("Isono-kun")
					exit()
				else:
					print("Nakajima-kun")
					exit()
		else:
			atk_I += 1 if atk_I != 5 else 0
			atk_N += 1 if atk_N != 5 else 0
else:
	print("Hikiwake-kun")
import itertools
N,M,Q = map(int,input().split())
L = [list(map(int,input().split())) for _ in range(Q)]
date = list(range(1,M+1))
A=list(itertools.combinations_with_replacement(data,N))
max_score = 0

for Ai in A:
  x = 0
  for a,b,c,d in L:
    if Ai[b] - Ai[a] == c:
      x += d
  max_score = max(max_score,x)
  
print(max_score)

### FIXED CODE ###

import itertools
N,M,Q = map(int,input().split())
L = [list(map(int,input().split())) for _ in range(Q)]
data = list(range(1,M+1))
A=list(itertools.combinations_with_replacement(data,N))
max_score = 0

for Ai in A:
  x = 0
  for a,b,c,d in L:
    if Ai[b-1] - Ai[a-1] == c:
      x += d
  max_score = max(max_score,x)

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

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

a.sort()

a_count = 0
bc_count = 0
bc_len = len(bc)
for b, c in bc:
        if c > a[a_count]:
                for i in range(b):
                        if c > a[a_count]:
                                a[a_count] = c
                                a_count += 1
                        else:
                                break
        else:
                break
        bc_count += 1
        if bc_count == bc_len:
                break
        

print(sum(a))

### FIXED CODE ###

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

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

a.sort()

a_count = 0
for b, c in bc:
        if c > a[a_count]:
                for i in range(b):
                        if c > a[a_count]:
                                a[a_count] = c
                                a_count += 1    
                        else:
                                break
                        if a_count == n:
                                        break

        else:
                break
        if a_count == n:
                break        

print(sum(a))
s = str(input())

    ans = 0

    for i in s:
        ans = ans + int(i)

    b = True if ans % 2 ==0 else False

    print(b)

### FIXED CODE ###

if __name__ == "__main__":
    s = str(input())

    ans = 0

    for i in s:
        ans = ans + int(i)

    b = "Yes" if int(s) % ans == 0 else "No"

    print(b)
W,H,x,y = map(int,input().split())
K.append((W*H)/2)
if x == W/2 and y == H/2:
  K.append(1)
else:
  K.append(0)
print(K[0],K[1])

### FIXED CODE ###

W,H,x,y = map(int,input().split())
K = []
K.append((W*H)/2)
if x == W/2 and y == H/2:
  K.append(1)
else:
  K.append(0)
print(K[0],K[1])
import sympy
N = int(input())

g = 0
for i in range(N):
    g += (i+1) * sympy.divisor_count(i+1)
print(g)

### FIXED CODE ###

n = int(input())
ans = 0
for i in range(1,n+1):
  k = n//i
  ans += i*(k*(k+1))//2
print(ans)
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
S = list(input())[:-1]
a = 10*int(S[0])+int(S[1])
b = 10*int(S[2])+int(S[3])
    print("NA")
if (a > 12 or a == 0) and (b > 12 or b == 0):
    print("NA")
elif a > 12 or a == 0:
    print("YYMM")
elif b > 12 or b == 0:
    print("MMYY")
else:
    print("AMBIGUOUS")

### FIXED CODE ###

import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
S = list(input())[:-1]
a = 10*int(S[0])+int(S[1])
b = 10*int(S[2])+int(S[3])
if (a > 12 or a == 0) and (b > 12 or b == 0):
    print("NA")
elif a > 12 or a == 0:
    print("YYMM")
elif b > 12 or b == 0:
    print("MMYY")
else:
    print("AMBIGUOUS")
n,m = map(int,input().split())
A = list(map(int,input(),split()))
a = int(sum(A))
 
if n >= a:
  print(n-a)
else:
  print(-1)

### FIXED CODE ###

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

if N>=a:
  print(N-a)
else:
  print(-1)
import sys

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

for ai in range(n):
    for aj in range(n):
        can = True
        for bi in range(m):
            if a_array[ai+bi][aj:aj+m] != b_array[bi]:
                can = False
                break
        if can:
            print('Yes')
            sys.exit()

print('No')


### FIXED CODE ###

import sys

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

for ai in range(n-m+1):
    for aj in range(n-m+1):
        can = True
        for bi in range(m):
            if a_array[ai+bi][aj:aj+m] != b_array[bi]:
                can = False
                break
        if can:
            print('Yes')
            sys.exit()

print('No')
H,W=map(int,input().split())
s=[list(input()) for _ in range(H)]

dp=[[0]*H]*W
#print(s)
answer=[]



for h in range(H):
    for w in range(W):
        #print(s[h][w],dp[h][w])
        if s[h][w]==".":
            if h!=0 and w==0:
                dp[h][w]=dp[h-1][w]
            elif h==0 and w!=0:
                dp[h][w]=dp[h][w-1]
            elif h==0 and w==0:
                pass
            else:
                dp[h][w]=min(dp[h-1][w],dp[h][w-1])
        else:
            if s[h][w]=="#":
                if h!=0 and w==0:
                    dp[h][w]=dp[h-1][w]+1
                elif h==0 and w!=0:
                    dp[h][w]=dp[h][w-1]+1
                elif h==0 and w==0:
                    dp[h][w]=1
                else:
                    dp[h][w]=min(dp[h-1][w],dp[h][w-1])+1
        #print(s[h][w],dp[h][w])
#print(dp)
print(dp[H-1][W-1])


### FIXED CODE ###

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

dp=[]
blacks=[]
whites=[]
black=0
white=0
#DP=[]
#print(s)

for h in range(H):
    dp.append([0]*W)
    #DP.append([0]*W)
    for w in range(W):
        #print(s[h][w],dp[h][w])
        if s[h][w]==".":
            if h!=0 and w==0:
                dp[h][w]=dp[h-1][w]
                #DP[h][w]=DP[h-1][w]+1
            elif h==0 and w!=0:
                dp[h][w]=dp[h][w-1]
                #DP[h][w]=DP[h][w-1]+1
            elif h==0 and w==0:
                dp[h][w]=0
                #DP[h][w]=1
            else:
                dp[h][w]=min(dp[h-1][w],dp[h][w-1])
                #DP[h][w]=min(DP[h-1][w],DP[h][w-1])+1
        else:
            if h!=0 and w==0:
                if s[h-1][w]=="#":
                    dp[h][w]=dp[h-1][w]
                else:
                    dp[h][w]=dp[h-1][w]+1
                #DP[h][w]=DP[h-1][w]
            elif h==0 and w!=0:
                if s[h][w-1]=="#":
                    dp[h][w]=dp[h][w-1]
                else:
                    dp[h][w]=dp[h][w-1]+1
                #DP[h][w]=DP[h][w-1]
            elif h==0 and w==0:
                dp[0][0]=1
                #DP[0][0]=0
            else:
                if s[h-1][w]=="." and s[h][w-1]=="#":
                    dp[h][w]=min(dp[h-1][w]+1,dp[h][w-1])
                elif s[h-1][w]=="#" and s[h][w-1]==".":
                    dp[h][w]=min(dp[h-1][w],dp[h][w-1]+1)
                elif s[h-1][w]=="#" and s[h][w-1]=="#":
                    dp[h][w]=min(dp[h-1][w],dp[h][w-1])
                elif s[h-1][w]=="." and s[h][w-1]==".":
                    dp[h][w]=min(dp[h-1][w]+1,dp[h][w-1]+1)
        #print(dp)
                
print(dp[H-1][W-1])
n = int(input())
res = list(enumerate(((s[0], int(s[1])) for s in input().split()), 1))

res.sort(key=lambda r: r[1])

[print(r[0]) for r in res]


### FIXED CODE ###

n = int(input())

res = []
for i in range(n):
    s, s_p = input().split()
    p = int(s_p)
    res.append(((s, -p), i + 1))

res.sort(key=lambda r: r[0])

for r in res:
    print(r[1])
import numpy as np

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

value = np.array(list(map(int, input().split())))
r_value = value[::-1]

max_value = max(value[0], r_value[0])
for i in range(1, k):
    total_value = 0
    if i > n:
        s = value
        s.sort()
        s = list(s)
        for j in range(k-n):
            if s[0] < 0:
                s.pop(0)
        total_value = sum(s)
    else:
        for j in range(i+1):
            a = value[0:j]
            b = r_value[0:i-j]
            c = np.concatenate((a, b))
            c.sort()
            c = list(c)
            for l in range(k-i):
                if c[0] < 0:
                    c.pop(0)
                if c == []:
                    break
            total_value = sum(c)
            if total_value > max_value:
                max_value = total_value
print(max_value)

### FIXED CODE ###

import numpy as np

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

value = np.array(list(map(int, input().split())))
r_value = value[::-1]

max_value = max(value[0], r_value[0])
for i in range(1, k):
    total_value = 0
    if i > n:
        s = value
        s.sort()
        s = list(s)
        for j in range(k-n):
            if s[0] < 0:
                s.pop(0)
        total_value = sum(s)
    else:
        for j in range(i+1):
            a = value[0:j]
            b = r_value[0:i-j]
            c = np.concatenate((a, b))
            c.sort()
            c = list(c)
            for l in range(k-i):
                if c[0] < 0:
                    c.pop(0)
                if c == []:
                    break
            total_value = sum(c)
            if total_value > max_value:
                max_value = total_value
print(max_value)
# -*- coding: utf-8 -*-
"""
Created on Sat Sep  8 15:51:53 2018

@author: maezawa
"""

n = int(input())
a = list(map(int, input().split()))
sa = 0
cnt = 0
for i in range(0,n-1):
    sa += a[i]
    na = -sa//abs(sa)*(abs(sa)+1)
    if abs(a[i+1]) > abs(na) and a[i+1]*na > 0:
        continue
    else:
        cnt += abs(na-a[i+1])
        a[i+1] = na

print(cnt)
    

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Sep  8 15:51:53 2018

@author: maezawa
"""

def sign(x):
    return x//abs(x)

def f(n, a0, s):
    cnt = 0
    cum = 0
    for i, ai in enumerate(a):
        cum += ai
        if cum == 0:
            cnt += 1
            cum = (-1)**i*s
        elif sign(cum) == (-1)**i*s:
            continue
        else:
            cnt += abs(cum)+1
            cum = (-1)**i*s
    return cnt

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

cnt = 0
cnt0 = f(n, a, -1)
cnt1 = f(n, a, 1)
cnt = min([cnt0,cnt1])
print(cnt)
n = int(input())
a = 1
for i range in (1,n+1):
    if i % 10 == 3:
        print('{0}'.format(i))
    elif i % 3 == 0:
        if i % 10 == 3:
            continue
        print('{0}'.format(i))
    a = i
    a = a + 1
    


### FIXED CODE ###

n = int(input())
for i in range(1, n+1):
    if i%3 == 0 :
        print(' {}'.format(i),end='')

    elif '3' in str(i):
        print(' {}'.format(i),end='')
print()
a,b,c=map(int,input().split())
print((a+b)*c//2)

### FIXED CODE ###

a,b,c=[int(input()) for i in range(3)]
print((a+b)*c//2)
import numpy as np

S = [v for v in input()]
N = len(S)
M = np.array([[0] * N for i in range(N)])
for i in range(N):
    if S[i] == 'L':
        M[i - 1][i] = 1
    else:
        M[i + 1][i] = 1

L = np.linalg.matrix_power(M, 10 ** 10)
a = np.dot(L, [1 for i in range(N)])

print(' '.join(map(str, a)))

### FIXED CODE ###

S = [v for v in input()]
N = len(S)
M = [0] * N
for i in range(N):
    if S[i] == 'L':
        M[i] = i - 1
    else:
        M[i] = i + 1

binary = format(10 ** 100, 'b')
Bin = []
for v in binary:
    a = int(v)
    Bin.append(a)

ans = [1] * N
while Bin:
    a = Bin.pop()
    if a == 0:
        L = [0] * N
        for j in range(N):
            L[j] = M[M[j]]
        M = L
    else:
        new_ans = [0] * N
        for j in range(N):
            new_ans[M[j]] += ans[j]
        ans = new_ans

        L = [0] * N
        for j in range(N):
            L[j] = M[M[j]]
        M = L

print(' '.join(map(str, ans)))
def gcd(a, b):
    if (a % b == 0):
        return b
    else:
        return gcd(b, a%b)

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

n = int(input())

time = 1
for i in range(n):
    t = int(input())
    time = lcm(time, t)

print (time)

### FIXED CODE ###

def gcd(a, b):
    if (a % b == 0):
        return b
    else:
        return gcd(b, a%b)

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

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(ans, t)

print (ans)
# AOJ 0504: Card Game II
# Python3 2018.7.1 bal4u

def calc(b, n):
	a = 1
	for i in range(n+1):
		if a >= b:
			d[i] += a//b
			a %= b
		if a == 0: break
		a *= 10

ans = ['0']*10005
while True:
	n, k, m, r = map(int, input().split())
	if n == 0: break
	r += 6
	d = [0]*10005
	calc(n, r)
	if m == 1:
		for i in range(1, n): calc(n*i, r)
	k = 0
	for i in range(r, -1, -1):
		k += d[i]
		if k >= 10:
			ans[i] = str(k%10)
			k //= 10
		else:
			ans[i] = str(k)
			k = 0
	print(ans[0], '.', ''.join(ans[1:r-5]), sep='')


### FIXED CODE ###

# AOJ 0504: Card Game II
# Python3 2018.7.1 bal4u

from decimal import *

while True:
	n, k, m, r = map(int, input().split())
	if n == 0: break
	
	setcontext(Context(prec=r, rounding=ROUND_HALF_UP))
	one = Decimal(1)
	
	ans = one/Decimal(n)
	if m == 1:
		s = 0
		for i in range(1, n): s += one/Decimal(i)
		ans *= 1+s
	ans = str(ans)[:r+2]
	if len(ans) < r+2: ans += '0'*(r+2-len(ans))
	print(ans)
a = input()
if a < 2:
        print(0)
elif a % 2 == 0:
        print(int(a / 2 - 1) )
else:
        print(int(a/2))

### FIXED CODE ###

a = int(input())
if a < 2:
        print(0)
elif a % 2 == 0:
        print(int(a / 2 - 1) )
else:
        print(int(a/2))
def main():
  S = input()
  day = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
  count = 7
  for i in day:
    if S == i:
        print(count)
    i -= 1

if __name__ == '__main__':
  main()


### FIXED CODE ###

def main():
  S = input()
  day = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
  count = 7
  for i in day:
    if S == i:
        print(count)
    count -= 1

if __name__ == '__main__':
  main()
a,s,d,f,g,h= map(int, input().split())

print(a+s+d+f+g+h)

### FIXED CODE ###

s=input()


 
print(s.count('1'))