Harryxun/stf_run huggingface dataset:
#define MAXSIZE 1000
  
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
  
char init_str[MAXSIZE]={};
  
  
int main()
{
    char str[MAXSIZE];
    int sum;
  
    while(1){
        strcpy(str,init_str);
        scanf("%s",&str);
        if((int)(str[0]-'0')!=0){
            sum=0;
            for(int i=0;(i<MAXSIZE&&(str[i]!='\0'));i++){
                sum += (int)(str[i]-'0');
            }
            cout << sum << endl;
        }
        else break;
    }
    return 0;
}


### FIXED CODE ###

while True :
  a = input()
  if(a == "0") :
    break
  else :
    b = list(map(int, a))  #1文字ずつ数値化して配列にする
    print(sum(b))
n = int(input())
nums = list(map(int, input().split()))
count = 0

for i in range(len(nums)):
    flag = True
    for j in range(i):
        if nums[j] > nums[i]:
            flag=  False
    if flag:
        count += 1
print(count)


### FIXED CODE ###

a,b=map(int,input().split())
print(max(a+b,2*a-1,2*b-1))
A = str(input())
B = str(input())
C = str(input())
X="a"
while True:
    if X == "a":
        if len(A) == 0:
            print("A")
            break
        X = A[0]
        A.pop(0)
    elif X == "b":
        if len(B) == 0:
            print("B")
            break
        X = B[0]
        B.pop(0)
    else:
        if len(C) == 0:
            print("C")
            break
        X = C[0]
        C.pop(0)

### FIXED CODE ###

A = list(str(input()))
B = list(str(input()))
C = list(str(input()))
X="a"
while True:
    if X == "a":
        if len(A) == 0:
            print("A")
            break
        X = A[0]
        A.pop(0)
    elif X == "b":
        if len(B) == 0:
            print("B")
            break
        X = B[0]
        B.pop(0)
    else:
        if len(C) == 0:
            print("C")
            break
        X = C[0]
        C.pop(0)
import math
from functools import reduce

N = int(input())
L = [ int(input()) for i in range(N)]


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

print(lcm_list(L))

### FIXED CODE ###

N = int(input())
L = [ int(input()) for i in range(N)]

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

x = L[0]
for i in range(len(L)-1):
    y = lcm(x, L[i+1])
    x = y
    
print(x)
from math import gcd
n,k = map(int,input().split())

def process(a,b):
	a = gcd(a,b)
	for i in range(1000):
		a = min(a,abs(a-b))
	return a
if n == 0:
	print(0)
elif k == 1 or n == 1:
	print(0)
else:
	print(process(n,k))




### FIXED CODE ###

from fractions import gcd
n,k = map(int,input().split())

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

	for i in range(100000):
		a = min(a,abs(a-b))
	return a
if n == 0:
	print(0)
elif n ==1:
	if k == 1:
		print(0)
	else:
		print(1)
elif k == 1:
	print(0)
else:
	print(process(n,k))
n = int(input())
a = list(map(int,input().split()))
x = min(3000,reduce(gcd,_ for _ in a))
m = [0]*x

for i in range(x):
    for j in a:
        m[i] += m%j

print(max(m))

### FIXED CODE ###

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

print(sum(a)-n)
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, A, B = lr()
MOD = 10 ** 9 + 7

def cmb(n, k):
    if k > n:
        return 0
    return fact[n] * fact_inv[k] % MOD * fact_inv[n-k] % MOD

def cumprod(arr, MOD):
    L = len(arr); Lsq = int(L**.5+1)
    arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
    for n in range(1, Lsq):
        arr[:, n] *= arr[:, n-1]; arr[:, n] %= MOD
    for n in range(1, Lsq):
        arr[n] *= arr[n-1, -1]; arr[n] %= MOD
    return arr.ravel()[:L]

def make_fact(U, MOD):
    x = np.arange(U, dtype=np.int64); x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64); x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact, fact_inv

def power_func(a,n,p):
    bi=str(format(n,"b"))#2進表現に
    res=1
    for i in range(len(bi)):
        res=(res*res) %p
        if bi[i]=="1":
            res=(res*a) %p
    return res

U = N+1 # 階乗テーブルの上限
fact, fact_inv = make_fact(U, MOD)
answer = power_func(2, N, MOD) - 1 - cmb(N, A) - cmb(N, B)
print(answer%MOD)

### FIXED CODE ###

import sys
from functools import reduce

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, A, B = lr()
MOD = 10 ** 9 + 7

def F(A):
    num = reduce(lambda x, y: x * y % MOD, range(N, N-A, -1))
    den = reduce(lambda x, y: x * y % MOD, range(1, A+1))
    return num * pow(den, MOD-2, MOD) % MOD

answer = pow(2, N, MOD) - F(A) - F(B) - 1
print(answer % MOD)
n, m = map(int, raw_input().split())
a = numpy.array(map(int, raw_input().split()))
for i in xrange(n-1):
	a = numpy.c_[a, (map(int, raw_input().split()))]
b = numpy.array(map(int, raw_input().split()))
for i in xrange(m-1):
	b = numpy.r_[b, (map(int, raw_input().split()))]
for i in xrange(n):
	print b.dot(a)[i]

### FIXED CODE ###

n, m = map(int, raw_input().split())
 
a = [[0]*m for i in xrange(n)]
 
b = [0]*m
 
for i in xrange(n):
    tmp = map(int, raw_input().split())
    for j in xrange(m):
        a[i][j] = tmp[j]
for i in xrange(m):
    b[i] = input()
for i in xrange(n):
    tmp = 0
    for j in xrange(m):
        tmp += a[i][j] * b[j]
    print tmp
a = int(input())
b = int(input())
print(max([a+b,a-b,a*b]))


### FIXED CODE ###

a, b = map(int, input().split())
print(max([a+b,a-b,a*b]))
def f():
        n,m = map(int,input().split(" "))
        s = []
        w = [[] for i in range(n+2)]
        for i in range(m):
            a,b = map(int,input().split(" "))
            
            if a==1:
                s.append(b)
            if b==1:
                s.append(a)
            w[a].append(b)
            w[b].append(a)
        for i in s:
            if n in w[i]:
                print("POSSIBLE")
                return 0
        print("IMPOSSIBLE")
        return 0
    f()

### FIXED CODE ###

def f():
    n,m = map(int,input().split(" "))
    s = []
    w = [[] for i in range(n+2)]
    for i in range(m):
        a,b = map(int,input().split(" "))
        
        if a==1:
            s.append(b)
        if b==1:
            s.append(a)
        w[a].append(b)
        w[b].append(a)
    for i in s:
        if n in w[i]:
            print("POSSIBLE")
            return 0
    print("IMPOSSIBLE")
    return 0
f()
import math
from functools import reduce

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


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


max_gcd = 0

for i in range(N):
    popped = A.pop(i)
    tmp_max_gcd = gcd_list(A)
    if tmp_max_gcd > max_gcd:
        max_gcd = tmp_max_gcd
    A.append(popped)

print(max_gcd)


### FIXED CODE ###

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)


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

gcd_l = [0] * N

gcd_l[0] = A[0]
for i in range(1, N):
    gcd_l[i] = gcd(gcd_l[i - 1], A[i])

gcd_r = [0] * N

gcd_r[N - 1] = A[N - 1]
for i in reversed(range(0, N - 1)):
    gcd_r[i] = gcd(gcd_r[i + 1], A[i])

gcd_lr = [0] * N

for i in range(N):
    if i == 0:
        gcd_lr[i] = gcd_r[i + 1]
    elif 1 <= i <= N - 2:
        gcd_lr[i] = gcd(gcd_l[i - 1], gcd_r[i + 1])
    elif i == N - 1:
        gcd_lr[i] = gcd_l[i - 1]

print(max(gcd_lr))
n = int(input())
p = list(map(int, input().split()))

cnt = 0
for i in range(n):
    if p[i] == i+1:
        if i < n:
            p[i], p[i+1] = p[i+1], p[i]
        cnt += 1
print(cnt)


### FIXED CODE ###

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

cnt = 0
for i in range(n):
    if p[i] == i+1:
        if i+1 < n:
            p[i], p[i+1] = p[i+1], p[i]
        cnt += 1
print(cnt)
n, k = list(map(int, input()))

print(n - k + 1)


### FIXED CODE ###

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

print(nk[0] - nk[1] + 1)
def listToStr(list):
    return ''.join(list)

def getChar(h, w):
    h_parity = h % 2
    w_parity = w % 2
    total_parity = (h_parity + w_parity) % 2
    
    if total_parity == 0:
        return "#"
    else:
        return "."

def getMatrix(h, w):
    result = []
    for i in range(h):
        result.append([])
        for j in range(w):
            result[i].append(getChar(i, j))
    return result

def input_parse():
    inputs = []
    while True:
        input_HW = input().split(",")
        (h, w) = (input_HW[0],input_HW[1])
        if h == 0 and w == 0:
            break
        inputs.append((h, w))

def output_matrix(matrix):
    for line in matrix:
        print(listToStr(line))
    print()

inputs = input_parse()
for input in inputs:
    matrix = getMatrix(input.0, input.1)
    output_matrix(matrix)

### FIXED CODE ###

def listToStr(list):
    return ''.join(list)

def getChar(h, w):
    h_parity = h % 2
    w_parity = w % 2
    total_parity = (h_parity + w_parity) % 2
    
    if total_parity == 0:
        return "#"
    else:
        return "."

def getMatrix(h, w):
    result = []
    for i in range(h):
        result.append([])
        for j in range(w):
            result[i].append(getChar(i, j))
    return result

def input_parse():
    inputs = []
    while True:
        input_HW = input().split(" ")
        (h, w) = (int(input_HW[0]),int(input_HW[1]))
        if h == 0 and w == 0:
            break
        inputs.append((h, w))
    return inputs

def output_matrix(matrix):
    for line in matrix:
        print(listToStr(line))
    print()

if __name__ == "__main__":
    inputs = input_parse()
    for input in inputs:
        matrix = getMatrix(input[0], input[1])
        output_matrix(matrix),0
N,M,Q=map(int,input().split())
a=[]
b=[]
c=[]
d=[]
for i in range(Q):
  ta,tb,tc,td=map(int,input().split())
  a+=[ta]
  b+=[tb]
  c+=[tc]
  d+=[td]
maxs=0
for i in range(10):
  for j in range(i,10):
    for k in range(j,10):
      for l in range(k,10):
        for m in range(l,10):
          for n in range(m,10):
            for o in range(n,10):
              for p in range(o,10):
                for q in range(p,10):
                  for r in range(q,10):
                    A[0]=i
                    A[1]=j
                    A[2]=k
                    A[3]=l
                    A[4]=m
                    A[5]=n
                    A[6]=o
                    A[7]=p
                    A[8]=q
                    A[9]=r
                    su=0
                    for i z in range(Q):
                      if A[b[i]]-A[a[i]]==c[i]:
                        su+=d[i]
                    if su>maxs:
                      maxs=su
print(maxs)

### FIXED CODE ###

N,M,Q=map(int,input().split())
a=[]
b=[]
c=[]
d=[]
for i in range(Q):
  ta,tb,tc,td=map(int,input().split())
  a+=[ta]
  b+=[tb]
  c+=[tc]
  d+=[td]
maxs=0
A=[0 for i in range(10)]
for i in range(M):
  for j in range(i,M):
    for k in range(j,M):
      for l in range(k,M):
        for m in range(l,M):
          for n in range(m,M):
            for o in range(n,M):
              for p in range(o,M):
                for q in range(p,M):
                  for r in range(q,M):
                    A[0]=i
                    A[1]=j
                    A[2]=k
                    A[3]=l
                    A[4]=m
                    A[5]=n
                    A[6]=o
                    A[7]=p
                    A[8]=q
                    A[9]=r
                    su=0
                    for z in range(Q):
                      if A[b[z]-1]-A[a[z]-1]==c[z]:
                        su+=d[z]
                    if su>maxs:
                      maxs=su
print(maxs)
import numpy as np

N=int(input())
S=str(input())
K=int(input())
target = S[K]
arr = ''

for i in range(N):
	if S[i]==target:
		arr+=target
	else:
		arr+=('*')

print(arr)


### FIXED CODE ###

N=int(input())
S=str(input())
K=int(input())
target = S[K-1]
arr = ''
 
for i in range(N):
	if S[i]==target:
		arr+=target
	else:
		arr+=('*')
 
print(arr)
N=int(input())
c=list(map(int, input().split()))
k = 1
count = 0
while True:
  for i in range(N):
    k = k*c[N]
  c_1 = (c % (2**N))
  if (c_1 == 0):
    for j in range(N):
      c[j] = c[j]/2
  else:
    break
  

### FIXED CODE ###

n = int(input())
c = list(map(int, input().split()))
k = 1
count = 0
while True:
  q = 0
  for i in range(n):
    if (c[i]%2 ==1):
      q += 1
  if (q > 0):
    break
  else:
    for j in range(n):
      c[j] = c[j] / 2
    count += 1
print(count)
n,m=map(int,input().split())
if(n==m)
	print('Yes')
else:
  print('No')


### FIXED CODE ###

n,m=map(int,input().split())
if(n==m):
  print('Yes')
else:
  print('No')
import bisect
n, q = [int(item) for item in input().split()]
a = [int(item) for item in input().split()]
cuma = [0] * (n+1)
bipartite_cuma = [0] * (n+2)
for i in range(0, n):
    cuma[i+1] = cuma[i] + a[i]
    bipartite_cuma[i+2] = bipartite_cuma[i] + a[i]
for i in range(q):
    x = int(input())
    small_id = bisect.bisect_left(a, x) - 1
    big_id = small_id + 1
    if x - a[small_id] <= a[big_id] - x:
        l = small_id
    else:
        l = big_id
    r = n
    l -= 1
    while r - l > 1:
        mid = (l + r) // 2
        t_turn = n - mid
        a_lower_value = x - (a[mid] - x)
        a_turn = mid - bisect.bisect_left(a, a_lower_value) + 1
        if a_turn >= t_turn:
            r = mid
        else:
            l = mid
    ll = bisect.bisect_left(a, x - (a[l] - x))
    if ll > l:
        ll = l
    if n -1 - l <= l+1 - ll:
        takahashi = cuma[n] - cuma[l+1] + bipartite_cuma[ll+1]
        aoki = cuma[l+1] - cuma[ll] + bipartite_cuma[ll]
    else:
        takahashi = cuma[n] - cuma[l+1] + bipartite_cuma[ll]
        aoki = cuma[l+1] - cuma[ll] + bipartite_cuma[ll+1]
    print(takahashi)

### FIXED CODE ###

import bisect
import sys
input = sys.stdin.readline

INF = 10**12
n, q = [int(item) for item in input().split()]
a = [int(item) for item in input().split()]

# Calc cumrative sum
sum_even = [0] * (n + 1)
sum_odd = [0] * (n + 1)
sum_all = [0] * (n + 1)
for i, item in enumerate(a):
    if i % 2 == 0:
        sum_odd[i+1] = sum_odd[i] + a[i]
        sum_even[i+1] = sum_even[i]
    else:
        sum_even[i+1] = sum_even[i] + a[i]
        sum_odd[i+1] = sum_odd[i]
    sum_all[i+1] = sum_all[i] + a[i]

# Iterate in query
a.append(INF)
ans = []
for i in range(q):
    # Get div of aoki - takahashi
    x = int(input())
    big = bisect.bisect_left(a, x)
    small = big - 1
    if (x - a[small]) ** 2 <= (x - a[big]) ** 2:
        l = small
    else:
        l = big
    r = n - 1
    while r - l > 1:
        m = (r + l) // 2
        rng = abs(x - a[m])
        taka = n - m
        aoki = n - taka - (bisect.bisect_left(a, x - rng))
        if taka <= aoki + 1:
            r = m
        else:
            l = m
    rng = abs(x - a[r])
    taka = n - r
    aoki = n - taka - (bisect.bisect_left(a, x - rng))
    taka_sum = sum_all[n] - sum_all[n - taka]
    aoki_sum = sum_all[r] - sum_all[r - taka]
    rest = n - taka * 2
    if rest > 0:
        if rest % 2 == 0:
            taka_sum += sum_even[rest]
            aoki_sum += sum_odd[rest]
        else:
            taka_sum += sum_odd[rest]
            aoki_sum += sum_even[rest]

    ans.append(taka_sum)
print("\n".join([str(item) for item in ans]))
import math
A, B, C, D = list(map(int, input().split()))
_all = B - A + 1
lcm = int(C * D / math.gcd(C, D))
x = (A-1) - ((A-1) // C) - ((A-1) // D) + ((A-1) // lcm)
y = B - (B // C) - (B // D) + (B // lcm)
print(y - x)


### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

A, B, C, D = list(map(int, input().split()))
_all = B - A + 1
lcm = int(C * D / gcd(C, D))
x = (A-1) - ((A-1) // C) - ((A-1) // D) + ((A-1) // lcm)
y = B - (B // C) - (B // D) + (B // lcm)
print(y - x)
import sys
from itertools import combinations, permutations, product, combinations_with_replacement, accumulate
from heapq import heapify, heappop, heappush, heappushpop
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from math import sqrt, log, floor, ceil, factorial, cos, sin, pi, gcd
from collections import deque
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
INF = float('inf')
LINF = 2**63-1
NIL = -LINF
MOD = 10**9+7
MGN = 4
def II(): return int(input())
def IF(): return float(input())
def IS(): return input()
def ILCI(n: int): return [II() for _ in range(n)]
def ILCF(n: int): return [IF() for _ in range(n)]
def ILI(): return list(map(int, input().split()))
def ILLI(n: int): return [[int(j) for j in input().split()] for i in range(n)]
def ILF(): return list(map(float, input().split()))
def ILLF(n: int): return [[float(j) for j in input().split()] for i in range(n)]
def LTOS(lst: list, sep: str = ' '): return sep.join(map(str, lst))
def DEC(lst: list): return list(map(lambda x: x-1, lst))
def INC(lst: list): return list(map(lambda x: x+1, lst))


def main():
    S = IS()

    ans = "Yes"
    if S[0] == S[1] and S[1] == S[2]:
        ans = "No"
    
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
INF = float('inf')
LINF = 2**63-1
NIL = -LINF
MOD = 10**9+7
MGN = 4
def II(): return int(input())
def IF(): return float(input())
def IS(): return str(input())
def ILCI(n: int): return [II() for _ in range(n)]
def ILCF(n: int): return [IF() for _ in range(n)]
def ILI(): return list(map(int, input().split()))
def ILLI(n: int): return [[int(j) for j in input().split()] for i in range(n)]
def ILF(): return list(map(float, input().split()))
def ILLF(n: int): return [[float(j) for j in input().split()] for i in range(n)]
def LTOS(lst: list, sep: str = ' '): return sep.join(map(str, lst))
def DEC(lst: list): return list(map(lambda x: x-1, lst))
def INC(lst: list): return list(map(lambda x: x+1, lst))


def main():
    S = IS()

    ans = "Yes"
    if S[0] == S[1] and S[1] == S[2]:
        ans = "No"
    
    print(ans)


if __name__ == '__main__':
    main()
a = int(input())
s = input()

print(s if a => 3200 else 'red')

### FIXED CODE ###

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

print(s if a >= 3200 else 'red')
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
    sum = sum(list(map(int, list(str(i)))))
    if a<= sum <=b:
        ans+=i

print(ans)


### FIXED CODE ###

n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
import numpy as np

h,w,m=nii()

h_b=[0 for i in range(h)]
w_b=[0 for i in range(w)]

l=[]
for i in range(m):
  h,w=nii()
  h-=1
  w-=1
  h_b[h]+=1
  w_b[w]+=1
  l.append([h,w])

h_s=np.argsort(h_b)
w_s=np.argsort(w_b)

ans=0
for i in range(min(100,len(h_s))):
  for j in range(min(100,len(w_s))):
    t_ans=h_b[i]+w_b[j]
    num=l.count([i,j])
    t_ans-=num
    ans=max(ans,t_ans)

print(ans)

### FIXED CODE ###

from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import Counter

h,w,m=nii()

h_bomb=[0 for i in range(h)]
w_bomb=[0 for i in range(w)]

l=set()
for i in range(m):
  th,tw=nii()
  th-=1
  tw-=1
  h_bomb[th]+=1
  w_bomb[tw]+=1
  l.add((th,tw))

h_max=max(h_bomb)
w_max=max(w_bomb)

h_cand=[]
w_cand=[]

for i in range(len(h_bomb)):
  if h_bomb[i]==h_max:
    h_cand.append(i)

for i in range(len(w_bomb)):
  if w_bomb[i]==w_max:
    w_cand.append(i)

for i in h_cand:
  for j in w_cand:
    if (i,j) not in l:
      print(h_max+w_max)
      exit()

print(h_max+w_max-1)
n, k = map(int, input().split())
mod = 10**9+7
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
#a/b = a*(b`)となるb`を求める
mod = 10**9+7
def mod_inv(a,mod):
    x = extgcd(a,mod)[0]
    return (mod+x%mod)%mod
N = n - k + 1
combi = [0 for i in range(N+1)]
combi[0] = 1
for i in range(1,N+1):
    combi[i] = (combi[i-1]*(N-i+1)*mod_inv(i,mod)) % mod
fact = [0 for i in range(n+1)]
fact[0] = 1
for i in range(1, n+1):
    fact[i] = (i * fact[i-1]) % mod
for i in range(1, k+1):
    print((combi[i] * fact[k-1] * pow(fact[k-i], -1, mod) * pow(fact[i-1], -1, mod)) % mod)


### FIXED CODE ###

import numpy as np
import math

n , k = list(map(int, input().split()))
def combi(a,b):
    return  math.factorial(a) // (math.factorial(b) * math.factorial(a-b))
i = 2
mod = 10 ** 9 + 7
for i in range(1, k + 1):
    if n - k + 1 >= i and k - 1 >= i - 1:
        print(int(combi(n - k + 1,i) * combi(k - 1, i - 1) % mod))
    else:
        print(0)
#-------------
N = int(input())
#-------------

if N%2 == 0:
  k = N//2
else:
  k = (N+1)//2

cmb = []
for i in range(1,k):
  cmb.append([i , N-i])

def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

ans = []
for i in range(k-1):
  X = digitSum(cmb[i][0])
  Y = digitSum(cmb[i][1])
  ans.append(X+Y)

print(min(ans))

### FIXED CODE ###

#-------------
N = int(input())
#-------------

if N%2 == 0:
  k = N//2
else:
  k = (N+1)//2

cmb = []
for i in range(1,k+1):
  cmb.append([i , N-i])
  
def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

ans = []
for i in range(k-1):
  X = digitSum(cmb[i][0])
  Y = digitSum(cmb[i][1])
  ans.append(X+Y)


if ans == []:
  print("2")
else:
  print(min(ans))
import math
L = list(map(int,open(0).read().split()))
Lm = min([i//10 for i in L])
print(sum([10*math.ceil(i/10) for i in L])-Lm)
import math
L = list(map(int,open(0).read().split()))
Lm = max([10-(i//10) for i in L])
print(sum([10*math.ceil(i/10) for i in L])-Lm)





### FIXED CODE ###

import math
L = [int(input()) for _ in range(5)]
Lm = []
for i in L:
    if i%10 == 0:
        Lm.append(0)
    else:
        Lm.append(10-i%10)
print(sum([10*math.ceil(i/10) for i in L])-max(Lm))
A1 = input()
A2 = input()
A3 = input()

if A1 + A2 + A3 < 22:
    print('win')
else :
    print('bust')


### FIXED CODE ###

A1,A2,A3 = (int(x) for x in input().split())
if A1 + A2 + A3 < 22:
    print('win')
else :
    print('bust')
N,K = map(int, input().split())
P = list(map(int,input().split()))
Px  =[0]*N
Pxx = []
for i in range(N):
    Px[i] = (1+P[i])/2
for j in range(N-K+1):
    temp_num = sum(Px[j:j+K])
    Pxx.append(temp_num)
print(Pxx)
print(f'{max(Pxx):.12f}')

### FIXED CODE ###

N,K = map(int, input().split())
P = list(map(int,input().split()))
Px  =[]
for i in range(N):
    Px.append((1+P[i])/2)
temp_num = sum(Px[0:K])
temp_max = sum(Px[0:K])
#print(Px)
for j in range(N-K):
    #print(temp_num)
    temp_num = temp_num-Px[j]+Px[j+K]
    if temp_max <temp_num:
        temp_max=temp_num
print(temp_max)
n,k=map(int,input().split())
s=str(input())
if s[k-1]=="A":
    s[k-1]="a"
elif s[k-1]=="B":
    s[k-1]="b"
elif s[k-1]=="C":
    s[k-1]="c"
print(s)


### FIXED CODE ###

n,k=map(int,input().split())
s=list(input())
if s[k-1]=="A":
    s[k-1]="a"
elif s[k-1]=="B":
    s[k-1]="b"
elif s[k-1]=="C":
    s[k-1]="c"
print("".join(s))