Harryxun/stf_run huggingface dataset:
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n,k = map(int,readline().split())
MOD = 10**9+7

if n&1:
    ans = k + (pow(k,(n+1)//2,MOD)-k)*n
    print(ans%MOD)

else:
    assert 0
    def divisor_list(N): #約数のリスト
        if N == 1: return [1]
        res = []
        for i in range(1,N):
            if i*i >= N: break
            if N%i == 0:
                res.append(i)
                res.append(N//i)
        if i*i == N: res.append(i)
        return sorted(res)

    p = [1] + [i for i in divisor_list(n) if i%2==0 and i!=2]
    
    r = {pi:pow(k,(pi+1)//2,MOD) for pi in p}
    for pi in p:
        for pj in p:
            if pj >= pi: break
            if pi%pj==0:
                r[pi] -= r[pj]

    #print(r)
    ans = 0
    for pi,v in r.items():
        if pi==1:
            ans += v
        else:
            ans += v*(pi//2)
    ans %= MOD
        
        
    print(ans)        
        
        
    
    
    
    


    
    
    
    
    
    

### FIXED CODE ###

# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n,k = map(int,readline().split())
MOD = 10**9+7

def divisor_list(N): #約数のリスト
    if N == 1: return [1]
    res = []
    for i in range(1,N):
        if i*i >= N: break
        if N%i == 0:
            res.append(i)
            res.append(N//i)
    if i*i == N: res.append(i)
    return sorted(res)



if n&1:
    p = [i for i in divisor_list(n)]
    r = {pi:pow(k,(pi+1)//2,MOD) for pi in p}
    #print(r)
    for pi in p:
        for pj in p:
            if pj >= pi: break
            if pi%pj==0:
                r[pi] -= r[pj]
    #print(r)
    ans = 0
    for pi,v in r.items():
        ans += v*(pi)
    ans %= MOD
    print(ans)
    
    

else:
    p = [1] + [i for i in divisor_list(n) if i%2==0 and i!=2]
    
    r = {pi:pow(k,(pi+1)//2,MOD) for pi in p}
    for pi in p:
        for pj in p:
            if pj >= pi: break
            if pi%pj==0:
                r[pi] -= r[pj]

    #print(r)
    ans = 0
    for pi,v in r.items():
        if pi==1:
            ans += v
        else:
            ans += v*(pi//2)
    ans %= MOD
        
        
    print(ans)
import math
def main():
    h = int(input())
    cnt = 0
    ans = 0
    tmp = 1
    a = int(math.log2(h))
    cnt = 2 **a
    ans = (1-2**a)//(1-2)
    print(ans+cnt)
    # while True:
    #     h //=2
    #
    #     cnt += tmp
    #     tmp *= 2
    #     if h==1:
    #         break
    #
    # print(cnt+tmp)
if __name__=='__main__':
    main()


### FIXED CODE ###

import math
def main():
    h = int(input())
    cnt = 0
    ans = 0
    tmp = 1
    a = int(math.log2(h))
    cnt = 2 **a
    ans = (1-2**a)//(1-2)
    print(ans+cnt)
    
if __name__=='__main__':
    main()
N = input()
nums = map(int, input().split())

return 1 / sum(1 / num for num in nums)

### FIXED CODE ###

N = input()
nums = map(int, input().split())
 
print(1 / sum(1 / num for num in nums))
# -*- coding: utf-8 -*-

A = input()
B = input()
if len(A) > len(B):
    print('GREATER')
elif len(A) < len(B):
    print('LESS')
else:
    if A > B:
        print('GREATER')
    elif A < B:
        print('LESS')
    else:
        print('EQUAL')

### FIXED CODE ###

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

s1, s2, s3 = input().split()
print((''.join([s1[0], s2[0], s3[0]])).upper())
A,B =map(int,input().split())
 
# 元の価格ｘ,8%  y、１０％
x = A/0.08
x_1 =(A+1)/0.08
y = B/0.1
y_1 = (B+1)/0.1

x_2 = {i for i in range(int(x),int(x_1) if i<=100)}
y_2 = {i for i in range(int(y),int(y_1) if i<=100)}
moto_nedan = x_2 & y_2
if len(moto_nedan) == 0:
    print("-1")
else:
    print(min(moto_nedan))

### FIXED CODE ###

A,B =map(int,input().split())
 
# 元の価格ｘ,8%  y、１０％
import math
x = math.ceil(A/0.08)
x_1 = math.ceil((A+1)/0.08 )
y = math.ceil(B/0.1)
y_1 = math.ceil( (B+1)/0.1 )

x_2 = {i for i in range(int(x),int(x_1) ) }
y_2 = {i for i in range(int(y),int(y_1) ) }
moto_nedan = x_2 & y_2
if len(moto_nedan) == 0:
    print("-1")
else:
    print(min(moto_nedan))
#!/usr/bin/env python3

def main():
    import sys
    def I(): return int(sys.stdin.readline())
    def LI(): return list(map(int,sys.stdin.readline().split()))

    n = I()
    V = []
    W = []
    for _ in range(n):
        v, w = LI()
        V.append(v)
        W.append(w)
    
    q = I()
    vl = []
    maxL = 0
    for _ in range(q):
        v, l = LI()
        maxL = max(maxL, l)
        vl.append([v,l])
    
    m = min(n, 1 << 10)
    dp = [[0]*(maxL + 1) for _ in range(m + 1)]
    
    for i in range(1, m+1):
        v, w = V[i-1], W[i-1]
        for j in range(maxL+1):
            if j < w:
                dp[i][j] = dp[i>>1][j]
            else:
                dp[i][j] = max(dp[i>>1][j], dp[i>>1][j - w] + v)
    
    for i in range(q):
        v, L = vl[i]
        if v <= m:
            print(dp[v][L])
            continue
        cnt = 0
        tmp = v
        v_ = []
        w_ = []
        while tmp > m:
            v_.append(V[tmp-1])
            w_.append(W[tmp-1])
            tmp >>= 1
            cnt += 1
        ret = 0
        v_tmp = [0] * (1 << cnt)
        w_tmp = [0] * (1 << cnt)
        for b in range(1 << cnt):
            lsb = b & -b
            l = lsb.bit_length()
            w_tmp[b] = w_tmp[b - lsb] + w_[l-1]
            if w_tmp[b] <= L:
                v_tmp[b] = v_tmp[b - lsb] + v_[l-1]
                ret = max(ret, v_tmp[b] + dp[v][L - w_tmp[b]])
        print(ret)
    return

if __name__ == "__main__":
    main()

### FIXED CODE ###

#!/usr/bin/env python3

def main():
    import sys
    def I(): return int(sys.stdin.readline())
    def LI(): return list(map(int,sys.stdin.readline().split()))

    n = I()
    V = []
    W = []

    maxL = 10**5
    m = min(n, 1 << 10)
    dp = [[0]*(maxL + 1)]
    
    for i in range(n):
        v, w = LI()
        if i <= m:
            d_ = dp[(i+1)>>1][:]
            for j in range(w, maxL+1)[::-1]:
                d_[j] = max(d_[j], d_[j - w] + v)
            dp.append(d_)
        V.append(v)
        W.append(w)
    
    q = I()
    for i in range(q):
        v, L = LI()
        if v <= m:
            print(dp[v][L])
            continue
        cnt = 0
        v_ = []
        w_ = []
        while v > m:
            v_.append(V[v-1])
            w_.append(W[v-1])
            v >>= 1
            cnt += 1
        ret = dp[v][L]
        v_tmp = [0] * (1 << cnt)
        w_tmp = [0] * (1 << cnt)
        for b in range(1, 1 << cnt):
            lsb = b & -b
            l = lsb.bit_length()
            w_t = w_tmp[b - lsb] + w_[l-1]
            w_tmp[b] = w_t
            if w_t <= L:
                v_t = v_tmp[b - lsb] + v_[l-1]
                v_tmp[b] = v_t
                ret = max(ret, v_t + dp[v][L - w_t])
        print(ret)
    return

if __name__ == "__main__":
    main()
a,b=map(int,input().split());print('>' if a>b else '<' if a<b else '=')

### FIXED CODE ###

a,b=input().split();print('>' if a>b else '<' if a<b else '=')
X,Y,Z=map(int,input().split()))

print(Z, X, Y)






### FIXED CODE ###

X,Y,Z=list(map(int,input().split()))

print(Z, X, Y)
def main():
    n = int(input())

    l = []
    for i in range(n):
        l.append(list(map(int, input().split())))

    for cx in range(0, 101):
        for cy in range(0, 101):
            H = -1
            ll = []
            for i, xyh in enumerate(l):
                x,y,h = xyh
                if H == -1 and h == 0:
                    ll.append(list(x,y,h))
                    continue
                if H == -1:
                    H = h + abs(x-cx) + abs(y-cy)
                    if H < 1 or H != int(H):
                        break
                    continue
                if h != max((H - abs(x-cx) - abs(y-cy)), 0):
                    break
                if i == len(l) - 1:
                    for x,y,h in ll:
                        if h != max((H - abs(x-cx) - abs(y-cy)), 0):
                            break
                    print(cx,cy,H)
                    return

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    n = int(input())

    l = []
    for i in range(n):
        l.append(list(map(int, input().split())))

    l.sort(key = lambda x:-x[2])

    for cx in range(0, 101):
        for cy in range(0, 101):
            for i, xyh in enumerate(l):
                x,y,h = xyh
                if i == 0:
                    H = h + abs(x-cx) + abs(y-cy)
                    if H < 1 or H != int(H):
                        break
                    continue
                if h != max((H - abs(x-cx) - abs(y-cy)), 0):
                    break
                if i == n-1:
                    print(cx,cy,H)
                    return

if __name__ == "__main__":
    main()
n=input()
for i in range(3):
  if n[i]==1:
    n[i]=9
  else:
    n[i]=1
print("n")

### FIXED CODE ###

n=input()
ans=""
for i in range(3):
  if n[i]=="1":
    ans+="9"
  else:
    ans+="1"
print(ans)
n = int(input())
t = list(map(int, input().split()))
m = int(input())

for _ in range(m):
    new_t = t.copy()
    p, x = map(int, input().split())
    new_t[p-1] = x
    print(sum(new_t))


### FIXED CODE ###

n = int(input())
t = list(map(int, input().split()))
m = int(input())

for _ in range(m):
    new_t = t.copy()
    p, x = map(int, input().split())
    new_t[p-1] = x
    print(sum(new_t))
h,w = map(int,input().split())

s = ['-' * (w + 2)]
for i in range(h):
    s.append('-' + input() + '-')
s.append('-' * (w + 2))

for hi in range(1,h+1):
    ans=''
    for wi in range(1,h+1):
        if s[hi][wi] == '#':
            ans += '#'
        else:
            c = [s[hi-1][wi-1],s[hi][wi-1],s[hi+1][wi-1],s[hi-1][wi],s[hi+1][wi],s[hi-1][wi+1],s[hi][wi+1],s[hi+1][wi+1]]
            ans += str(c.count('#'))
    print(ans)

### FIXED CODE ###

h,w = map(int,input().split())

s = ['-'*(w+2)]
for i in range(h):
    s += ['-'+input()+'-']
s += ['-'*(w+2)]

for hi in range(1,h+1):
    ans = ''
    for wi in range(1,w+1):
        if s[hi][wi] == '#':
            ans += '#'
        else:
            c = [s[hi-1][wi-1],s[hi][wi-1],s[hi+1][wi-1],s[hi-1][wi],s[hi+1][wi],s[hi-1][wi+1],s[hi][wi+1],s[hi+1][wi+1]]
            ans += str(c.count('#'))
    print(ans)
init = input().split()
N = int(init[0])
K = int(init[1])
 
prices = [int(input()) for i in range(N)]
prices.sort()
 
sum = 0
for i, ele in enumerate(prices):
  if i >= K:
    break
  else
  	sum = sum + ele
print(sum)

### FIXED CODE ###

init = input().split()
N = int(init[0])
K = int(init[1])
 
prices = list(map(int, input().split()))
prices.sort()
 
sum = 0
for i, ele in enumerate(prices):
  if i >= K:
    break
  else:
  	sum = sum + ele
print(sum)
N = int(input())
emp = list(map(int,input().split()))
list.sort()
for i in range(N):
    print(emp.index(i+2)-emp.index(i+1))


### FIXED CODE ###

N = int(input())
emp = list(map(int,input().split()))
ans_l = [0]*(N+1)
for i in range(N-1):
    a = emp[i]
    ans_l[a] +=1
for i in range(1,N+1):
    print(ans_l[i])
n,m=map(int,input().split())
if m=0:
  print(0)
else:
  sc= [list(map(int,input().split())) for i in range(m)]
  ans = -1
  s=[[0 for i in range(2)] for i in range(n)]
  for j in range(10**n):
    k=str(j)
    for l in range(len(k)):
      s[l][0]=l+1
      s[l][1]=int(k[l])
    if all(elm in s for elm in sc) == 1:
      ans=j
      break
  print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
if m==0:
  if n ==1:
    print(0)
  else:
    print(10**(n-1))
else:
  sc= [list(map(int,input().split())) for i in range(m)]
  ans = -1
  for j in range(10**(n-1)-1,10**n):
    k=str(j)
    s=[[0 for i in range(2)] for i in range(len(k))]
    for l in range(len(k)):
      s[l][0]=l+1
      s[l][1]=int(k[l])
      if all(elm in s for elm in sc) == 1:
        ans=j
        break
    if ans==j:
      break
  print(ans)
def gcd(x,y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
N = int(input())
T = []
ans = 1
for i in range(N):
    T.append(int(input()))

for i in range(N):
    ans = (ans * T[i]) / gcd(ans, T[i]) 

print(int(ans))
    



### FIXED CODE ###

import math
        
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
ans = T[0]

for i in range(1, N):
    ans = ans * T[i] // math.gcd(ans, T[i])

print(ans)
zinput = int(input())
a = []
b = []
i = 1
while(i <= input):
  if i%3 == 0 and i%5 == 0:
    a[i] = "FizzBuzz"
  elif i%3 == 0:
    a[i] = "Fizz"
  elif i%5 == 0:
    a[i] = "Buzz"
  else:
    a[i] = "i"
  i += 1
sum = 0
for j in a:
  if a[j] != "FizzBuzz" and a[j] != "Fizz" and a[j] != "Buzz":
    sum = sum + int(a[j])
print(sum)



### FIXED CODE ###

input = input()
a = []
i = 1
while(i <= int(input)):
    if i%3 == 0 or i%5 == 0:
        pass
    else:
        a.append(i)
    i += 1
res = 0
for j in a:
  res = res + j
print(res)
a,b = int(input().split())

print(a*b)

### FIXED CODE ###

a = list(map(int, input().split()))
 
print(a[0]*a[1])
from math import gcd

# inputa
n , x , d = map(int, list(input().split()))

# process
if d == 0:
    if x == 0:
        print(1)
    else:
        print(n + 1)

else:
    # sが何通りあるかを求める
    
    # dを正にする
    if d < 0: d, x = -d, -x

    # d,xを互いに素にする   
    g = gcd(d, abs(x))
    d, x =  d//g, x//g
    
    # s=k*x+c*d
    # cは最小で0からk-1の和、最大でn-kからn-1の和
    # kを固定するとs//dは1ずつの単調増加なので、最小と最大で個数が分かる

    # sはs%d=k*x%dなので、それで分類する
    # →klistをk*x%dでソート
    klist = list(range(n + 1))
    klist.sort(key=lambda k: (k*x%d, k))

    # kを固定し、cの最小・最大を求め、加算していく
    ans = 0

    # 1つ前の値を保持
    pmin, pmax = 1, 0
    pmd = -1
    for k in klist:
        # s//dの最小・最大・s%d
        tmin = (k * x + (k - 1) * k // 2 * d) // d
        tmax = (k * x + (2 * n - k - 1) * k // 2 * d) // d
        tmd = k*x%d

        # s%dが前と同じ　かつ
        # s//dの最小<=前の最大　かつ　s//dの最大>=前の最小のとき
        # 最大・最小を更新
        if tmd == pmd and tmin <= pmax and tmax >= pmin:
            pmin, pmax = min(pmin, tmin), max(pmax, tmax)
        else:
            ans += pmax - pmin + 1
            pmin, pmax = tmin, tmax
        pmd = tmd
        #print(k, l, r, pl, pr, ans)
    
    ans += pmax - pmin + 1
    print(ans)


### FIXED CODE ###

from fractions import gcd

# inputa
n , x , d = map(int, list(input().split()))

# process
if d == 0:
    if x == 0:
        print(1)
    else:
        print(n + 1)

else:
    # sが何通りあるかを求める
    
    # dを正にする
    if d < 0: d, x = -d, -x

    # d,xを互いに素にする   
    g = gcd(d, abs(x))
    d, x =  d//g, x//g
    
    # s=k*x+c*d
    # cは最小で0からk-1の和、最大でn-kからn-1の和
    # kを固定するとs//dは1ずつの単調増加なので、最小と最大で個数が分かる

    # sはs%d=k*x%dなので、それで分類する
    # →klistをk*x%dでソート
    klist = list(range(n + 1))
    klist.sort(key=lambda k: (k*x%d, k))

    # kを固定し、cの最小・最大を求め、加算していく
    ans = 0

    # 1つ前の値を保持
    pmin, pmax = 1, 0
    pmd = -1
    for k in klist:
        # s//dの最小・最大・s%d
        tmin = (k * x + (k - 1) * k // 2 * d) // d
        tmax = (k * x + (2 * n - k - 1) * k // 2 * d) // d
        tmd = k*x%d

        # s%dが前と同じ　かつ
        # s//dの最小<=前の最大　かつ　s//dの最大>=前の最小のとき
        # 最大・最小を更新
        if tmd == pmd and tmin <= pmax and tmax >= pmin:
            pmin, pmax = min(pmin, tmin), max(pmax, tmax)
        else:
            ans += pmax - pmin + 1
            pmin, pmax = tmin, tmax
        pmd = tmd
        
    ans += pmax - pmin + 1
    print(ans)
s, ans = raw_input(), 0
for i in range(len(s) - 1):
    if (len(set(s[i : i + 2))) == 2):
        ans += 1
print cnt

### FIXED CODE ###

s, ans = raw_input(), 0
for i in range(len(s) - 1):
    if (len(set(s[i : i + 2])) == 2):
        ans += 1
print ans
# -*- coding: utf-8 -*-

X,Y=map(int, raw_input().split())

mod=10**9+7
fact, inv_fact = [1], [1]
fact_tmp = 1
for i in range(1, max(X,Y)+1):
    fact_tmp *= i
    fact_tmp %= mod
    fact.append(fact_tmp)
    inv_fact.append(pow(fact_tmp, mod-2, mod))
 
 
def ncr(n,r):
	if n < 0 or r < 0 or n < r:	return 0
	else:	return (fact[n] * inv_fact[r] * inv_fact[n-r]) %mod

if X==Y:
    if X%3!=0:
        print 0
    else:
        x=X/3
        print ncr(x*2,x)
else:
    if X<Y: X,Y=Y,x
    sho=X/2
    x=X-(sho*2)
    y=Y-sho
    if (x,y)!=(1,2):
        print 0
    else:
        print ncr(sho+1,sho)

### FIXED CODE ###

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

X,Y=map(int, raw_input().split())

mod=10**9+7
fact, inv_fact = [1], [1]
fact_tmp = 1
for i in range(1, max(X,Y)+1):
    fact_tmp *= i
    fact_tmp %= mod
    fact.append(fact_tmp)
    inv_fact.append(pow(fact_tmp, mod-2, mod))
 
 
def ncr(n,r):
	if n < 0 or r < 0 or n < r:	return 0
	else:	return (fact[n] * inv_fact[r] * inv_fact[n-r]) %mod

if (X+Y)%3!=0:
    print 0
else:
    m=(2*X-Y)/3
    n=(Y-m)/2
    print ncr(m+n,n)
n = int(input())
arr = input().split()


def mult():
    if 0 in arr:
        return 0
    else:
        a = 1
        for i in arr:
            a = a * int(i)
            if a > 1000000000000000000:
                return -1
            else: continue
        return a

print(mult())


### FIXED CODE ###

arr = input().split()

print(int(arr[0]) * int(arr[1]))
n = int(input())
n_list = [int(i) for i in input().split(" ")]
n_list.reverse()
print(' '.join(map(str, a)))

### FIXED CODE ###

n = int(input())
n_list = [int(i) for i in input().split(" ")]
n_list.reverse()
print(' '.join(map(str, n_list)))
n = int(input())
a = list(map(int,input().split()))
for i in range(1,n):
    print(a.count(i))
print(0)

### FIXED CODE ###

import math
r = int(input())
p = math.pi
print(2*r*p)
#!/usr/bin/env python
# coding: utf-8

# In[8]:


import math


# In[68]:


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


# In[71]:


ans = 0
for i in range(1,N+1):
    ans += (1/2)**(max(math.floor(math.log((K-1)/i, 2)) + 1, 0))/N


# In[72]:


print(ans)


# In[ ]:






### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[8]:


import math


# In[68]:


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


# In[73]:


ans = 0
if K > 1:
    for i in range(1,N+1):
        ans += (1/2)**(max(math.floor(math.log((K-1)/i, 2)) + 1, 0))/N
else:
    ans = 1


# In[74]:


print(ans)


# In[ ]:
yyyy = int(input())
mm = int(input())
dd = int(input())
if yyyy < 2019:
    print('Heisei')
elif yyyy > 2019:
    print('TBD')
else:
    if mm < 5:
        print('Heisei')
    else:
        print('TBD')

### FIXED CODE ###

S = input()
if S <= '2019/04/30' :
    print('Heisei' )
else:
    print('TBD')
def fact(i):
    a = 1
    for i in range(2,i+1):
        a *= i
    return a
def comb(i,j):
    return int(fact(i)/(fact(j)*fact(i-j)))

n = int(input())
l = list(map(int,input().split()))
l.sort()
a = []
b = []
d = []
for i in range(1,n):
    c = l[i]
    if l[0] >= int((c+1)/2):
        a.append(comb(c,l[0]))
        b.append(c)
        d.append(l[0])
    else:
        j = 0
        while l[j] < int((c+1)/2):
            j += 1
        else:
            if l[j] == int((c+1)/2):
                a.append(comb(c,int((c+1)/2)))
                b.append(c)
                d.append(int((c+1)/2))
            else:
                if l[j] - int((c+1)/2) < int((c+1)/2) -l[j-1]:
                    a.append(comb(c,l[j]))
                    b.append(c)
                    d.append(l[j])
                else:
                    a.append(comb(c,l[j-1]))
                    b.append(c)
                    d.append(l[j-1])
I = a.index(max(a))
print("{} {}".format(b[I],d[I]))


### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
l.sort()
a = l[-1]
j = 0
while l[j] < int((a+1)/2):
    j += 1
else:
    if l[j] - int((a+1)/2) < int((a+1)/2) - l[j-1]:
        b = l[j]
    else:
        b = l[j-1]
print("{} {}".format(a,b))
n=int(input())
a=list(map(int,input().split()))

def mp(a):
    b=[]
    if len(a)%2==0:
        for i in range(0,len(a),2):
            b.append(a[i]*a[i+1]) 
    else:
        for i in range(0,len(a),2):
            b.append(a[i]*a[i+1]) 
        b.append(a[len(a)//2+1]) 
    return b

b=a.copy()
while len(b)<=1:
    b=mp(b)   
    
if ap<=10**18:
    print(ap)
else:
    print(-1)

    

### FIXED CODE ###

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

def mp(a):
    b=[]
    if len(a)==1:
        b.append(a[0]) 
    elif len(a)%2==0:
        for i in range(0,len(a),2):
            b.append(a[i]*a[i+1]) 
    else:
        for i in range(0,len(a)-1,2):
#            print(i)
            b.append(a[i]*a[i+1]) 
#        print("1",a[len(a)//2+1])
        b.append(a[len(a)-1]) 
    return b

c=aa.copy()
while len(c)>1:
    c=mp(c)   
#    print(c)
    
if c[0]<=10**18:
    print(c[0])
else:
    print(-1)
a, b = map(input().split())
print(b + a)

### FIXED CODE ###

a, b = input().split()
print(b + a)
S = list(input())
s1 = list("keyence")

x = [1]
y = [1]
for i in range(7):
  if S[i] == s1[i]:
    x.append(x[i-1])
  if S[len(S)-1-i] == s1[6-i]:
    y.append(y[i-1])
  

if sum(x) + sum(y) >= 9:
  print("YES")  
else:
  print("NO")

### FIXED CODE ###

S = list(input())
s1 = list("keyence")

x = []
y = []
for i in range(7):
  if S[i] == s1[i]:
    x.append(1)
  if S[len(S)-1-i] == s1[6-i]:
    y.append(1)
  

if sum(x) + sum(y) >= 7:
  print("YES")  
else:
  print("NO")
a = int(intput())
b = int(intput())
c = int(intput())
d = int(intput()

print(min(a,b)+min(c,d))

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min(a,b)+min(c,d))
N, M = [int(_) for _ in input().split()]
INF = 10 ** 10
costs = [[INF] * 101 for _ in range(101)]

for i in range(N + 1):
    costs[i][i] = 0
paths = []
for i in range(M):
    a, b, c = [int(_) for _ in input().split()]
    costs[a][b] = c
    costs[b][a] = c
    paths.append((a, b, c))

for k in range(N + 1):
    for i in range(N + 1):
        for j in range(N + 1):
            costs[i][j] = min(costs[i][j], costs[i][k] + costs[j][k])
            costs[j][i] = costs[i][j]

for i in range(N):
    paths2 = paths.copy()
    for p in paths:
        # 点i から 経路p をつかってp[1]への経路をもつかチェック
        if costs[i][p[0]] + p[2] == costs[i][p[1]]:
            paths2.remove(p)
    paths = paths2
print(len(paths))

### FIXED CODE ###

N, M = [int(_) for _ in input().split()]
INF = 10 ** 10
costs = [[INF] * 101 for _ in range(101)]

for i in range(N + 1):
    costs[i][i] = 0
paths = []
for i in range(M):
    a, b, c = [int(_) for _ in input().split()]
    costs[a][b] = c
    costs[b][a] = c
    paths.append((a, b, c))

for k in range(N + 1):
    for i in range(N + 1):
        for j in range(N + 1):
            costs[i][j] = min(costs[i][j], costs[i][k] + costs[j][k])
            costs[j][i] = costs[i][j]

for i in range(1, N + 1):
    paths2 = paths.copy()
    for p in paths:
        # 点i から 経路p をつかってp[1]への経路をもつかチェック
        if costs[i][p[0]] >= INF or costs[i][p[1]] >= INF: continue
        if costs[i][p[0]] + p[2] == costs[i][p[1]]:
            paths2.remove(p)
    paths = paths2
print(len(paths))
# -*- coding: utf-8 -*-

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

def array_count(arr):
    arr_target = [[]]
    cnt = 1
    for i in range(1,len(arr)):
        if arr[i] == arr[i-1]:
            cnt += 1
        else:
            arr_target.append([arr[i-1],cnt])
            cnt = 1
    arr_target.append([arr[len(arr)-1],cnt])
    del arr_target[0]
    return arr_target

ss = array_count(s)

if ss[0][0] == 0:
    ss = [[1,0]] + ss

if ss[-1][0] == 1:
    ss.append([0,0])

ss_sum = []
temp = 0
for i in range(len(ss)):
    temp += ss[i][1]
    ss_sum.append(temp)

ans = -1
for i in range(len(ss_sum)):
    temp = 0
    if i % 2 == 0:
        if i + k * 2 < len(ss_sum):
            temp = ss_sum[i+k*2] - ss_sum[i]
    else:
        if i + k * 2 + 1 < len(ss_sum):
            temp = ss_sum[i+k*2+1] -  ss_sum[i]
    ans = max(temp,ans)

if k * 2 >= len(ss):
    ans = ss_sum[-1]

print(ans)

### FIXED CODE ###

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

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

coin = 0
if a >= b:
    coin += a
    a -= 1
else:
    coin += b
    b -= 1
if a >= b:
    coin += a
    a -= 1
else:
    coin += b
    b -= 1

print(coin)