Harryxun/stf_run huggingface dataset:
from memory_profiler import profile
# Single Source Shortest Path
infty = 99999

[vertex, edge, r] = list(map(int, input("").split()))
D = [[infty for j in range(vertex)] for i in range(vertex)]
for i in range(edge):
    data = list(map(int, input("").split()))
    D[data[0]][data[1]] = data[2]

@profile
def Dijkstra(root, n):
    visited_order = 0
    label = [0 for i in range(n)]
    global D
    global infty
    d = D[root]
    visited_order += 1
    label[root] = visited_order

    while visited_order < n:
        min_cost = infty

        for i in range(n):
            if label[i] != 0:
                continue

            if min_cost > d[i]:
                min_cost = d[i]
                min_node = i

        if min_cost == infty:
            break

        visited_order += 1
        label[min_node] = visited_order

        for i in range(n):
            if label[i] != 0:
                continue
            if d[i] > d[min_node] + D[min_node][i]:
                d[i] = d[min_node] + D[min_node][i]

    del visited_order
    del label
    del D
    del min_cost

    d[root] = 0
    return d

result = Dijkstra(r, vertex)

for i in range(vertex):
    if result[i] == infty:
        result[i] = "INF"
    print(result[i])




### FIXED CODE ###

# Single Source Shortest Path
import heapq

[vertex, edge, r] = list(map(int, input("").split()))
infty = 999999999
final_c = [infty for i in range(vertex)]
dict_c = [[] for i in range(vertex)]

for i in range(edge):
    [e1, e2, c] = list(map(int, input("").split()))
    dict_c[e1].append((e2, c))

final_c[r] = 0
root_c = [(final_c[r], r)]

def Dijkstra(root, n):
    global infty, root_c, final_c, dict_c, root_c
    while(root_c):
        (cost, v) = heapq.heappop(root_c)
        if cost > final_c[v]:
            continue
        for i in range(len(dict_c[v])):
            (e2, c) = dict_c[v][i]
            if final_c[e2] > final_c[v] + c:
                final_c[e2] = final_c[v] + c
                heapq.heappush(root_c, (final_c[e2], e2))

Dijkstra(r, vertex)
for i in range(vertex):
    if final_c[i] == infty:
        print("INF")
    else:
        print(final_c[i])
N = int(input())
print(N(N-1)//2)

### FIXED CODE ###

N = int(input())
print(N*(N-1)//2)
ans = 10**7
for i in range(1<<n):
    mokuhyo = [0]*m
    cost = 0
    for j in range(n):
        if i>>j&1:
            for r in range(m):
                mokuhyo[r] += c[j][r+1]
            cost += c[j][0]
    if all(k>=x for k in mokuhyo):
        ans = min(ans, cost)
print("-1" if ans == 10**7 else ans)        

### FIXED CODE ###

n,m,x = map(int,input().split())
c = list(list(map(int,input().split())) for _ in range(n))
ans = 10**7
for i in range(1<<n):
    mokuhyo = [0]*m
    cost = 0
    for j in range(n):
        if i>>j&1:
            for r in range(m):
                mokuhyo[r] += c[j][r+1]
            cost += c[j][0]
    if all(k>=x for k in mokuhyo):
        ans = min(ans, cost)
print("-1" if ans == 10**7 else ans)
N, A, B = [int(input()) for i in range(3)]
 
ans = 0
for i in range(0, N+1):
    tmp=i
    sum=0
    while(tmp>0):
        sum += tmp%10
        tmp = int(tmp/10)

    if A<=sum and sum<=B:
        ans+=i
        print(i)
 
print(ans)

### FIXED CODE ###

N, A, B = map(int,input().split())
 
ans = 0
for i in range(0, N+1):
    tmp=i
    sum=0
    while(tmp>0):
        sum += tmp%10
        tmp = int(tmp/10)

    if A<=sum and sum<=B:
        ans+=i
 
print(ans)
from functools import lru_cache
dan,ana=map(int,input().split())
l=[int(input()) for _ in range(ana)]
@lru_cache(maxsize=None)
def f(x,*li):
  if x in li:return 0
  elif x==1:return 1
  elif x==2 :return f(1,*li)+1 if 1 not in li else 1 if 2 not in li else 0
  else:return (f(x-1,*li)+f(x-2,*li))%(10**9+7)

print(f(dan,*l))

### FIXED CODE ###

n,m=map(int,input().split())
l={int(input()) for i in range(m)}
dp=[0 for i in range(n+1)]
dp[0]=1
for i in range(1,1+n):
    if i not in l:dp[i]+=dp[i-1]+dp[i-2];dp[i]%=10**9+7
print(dp[n])
# -*- coding: utf-8 -*-
INF = -10**10
queue = [-1]


def insert(queue, key):
    h = len(queue) - 1
    queue.append(INF)
    heap_increase_key(queue, h + 1, key)


def heap_increase_key(queue, i, key):
    if key < queue[i]:
        raise ValueError('The new key is smaller than the present key')
    queue[i] = key
    while i > 1 and queue[i // 2] < queue[i]:
        queue[i], queue[i // 2] = queue[i // 2], queue[i]
        i = i // 2


def extract_max(queue):
    h = len(queue) - 1
    if h < 1:
        raise TypeError('Heap underflowed')
    max = queue[1]
    queue[1] = queue.pop()
    max_heapify(queue, 1)

    return max


def max_heapify(queue, i):
    h = len(queue) - 1
    l = 2 * i
    r = 2 * i + 1
    if l <= h and queue[l] > queue[i]:
        largest = l
    else:
        largest = i
    if r <= h and queue[r] > queue[largest]:
        largest = r

    if largest != i:
        queue[i], queue[largest] = queue[largest], queue[i]
        max_heapify(queue, largest)


if __name__ == '__main__':
    import sys
    ords = [line.strip().split() for line in sys.stdin]

    for ord in ords:
        if len(ord) > 1:
            ord, key = ord

        if ord[0] == 'i':
            insert(queue, key)
        elif len(ord) == 7:
            extract_max(queue)
        else:
            break



### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from heapq import *

q = []
while True:
    cmd = sys.stdin.readline().split()
    if cmd[0] == 'end':
        break
    elif cmd[0] == 'insert':
        heappush(q, -int(cmd[1]))
    else:
        print(-heappop(q))
from collections import deque
INFTY = 10**6
N,u,v = map(int,input().split())
G = {i:[] for i in range(1,N+1)}
for _ in range(N-1):
    a,b = map(int,input().split())
    G[a].append(b)
    G[b].append(a)
pre = {i:[] for i in range(1,N+1)}        
que = deque([(u,0)])
hist = [0 for _ in range(N+1)]
hist[u] = 1
dist = [0 for _ in range(N+1)]
dist[u] = 0
while que:
    x,d = que.popleft()
    for y in G[x]:
        if hist[y]==0:
            que.append((y,d+1))
            hist[y] = 1
            dist[y] = d+1
            pre[y].append(x)
w = dist[v]
cnt = (w-1)//2
a = u
i = 0
while i<cnt:
    a = pre[a][0]
    i += 1
b = pre[a][0]
que = deque([(a,0)])
hist = [0 for _ in range(N+1)]
hist[a] = 1
hist[b] = 1
dist2 = [0 for _ in range(N+1)]
while que:
    x,d = que.popleft()
    for y in G[x]:
        if hist[y]==0:
            que.append((y,d+1))
            hist[y] = 1
            dist2[y] = d+1
d = max(dist2)
if w%2==1:
    print(cnt+d)
else:
    print(cnt+d+1)

### FIXED CODE ###

from collections import deque
INFTY = 10**6
N,u,v = map(int,input().split())
G = {i:[] for i in range(1,N+1)}
for _ in range(N-1):
    a,b = map(int,input().split())
    G[a].append(b)
    G[b].append(a)
du = [INFTY for _ in range(N+1)]
du[u] = 0
que = deque([(0,u)])
hist = [0 for _ in range(N+1)]
hist[u] = 1
while que:
    c,i = que.popleft()
    for j in G[i]:
        if hist[j]==0:
            que.append((c+1,j))
            du[j] = c+1
            hist[j] = 1
dv = [INFTY for _ in range(N+1)]
dv[v] = 0
que = deque([(0,v)])
hist = [0 for _ in range(N+1)]
hist[v] = 1
while que:
    c,i = que.popleft()
    for j in G[i]:
        if hist[j]==0:
            que.append((c+1,j))
            dv[j] = c+1
            hist[j] = 1
cmax = 0
for i in range(1,N+1):
    if du[i]<dv[i]:
        cmax = max(cmax,dv[i])
print(cmax-1)
while 1:
    s1 = input().split('\"')
    if s1[0] == '.': break
    s2 = input().split('\"')

    jdg = 1
    cnt_d = 

    if len(s1) != len(s2): print("DIFFERENT")
    else:
        l = len(s1)
        i = 0
        while i < l:
            if s1[i] != s2[i]:
                cnt_d += 1
                if cnt_d == 1 and i % 2 == 1:
                    jdg = 1
                else:
                    jdg = 0
                    break
            i += 1

        if jdg == 1 and cnt_d == 1: print("CLOSE")
        elif jdg == 0 or cnt_d > 1: print("DIFFERENT")
        else: print("IDENTICAL")



### FIXED CODE ###

while 1:
    s1 = input().split('\"')
    if s1[0] == '.': break
    s2 = input().split('\"')

    jdg = 1
    cnt_d = 0

    if len(s1) != len(s2): print("DIFFERENT")
    else:
        l = len(s1)
        i = 0
        while i < l:
            if s1[i] != s2[i]:
                cnt_d += 1
                if cnt_d == 1 and i % 2 == 1:
                    jdg = 1
                else:
                    jdg = 0
                    break
            i += 1

        if jdg == 1 and cnt_d == 1: print("CLOSE")
        elif jdg == 0 or cnt_d > 1: print("DIFFERENT")
        else: print("IDENTICAL")
N = input()
count = 0
prev = 0
for i in range(len(N)):
  if 0 <= int(N[i]) + prev < 6:
    count += int(N[i]) - prev
    prev = 0
  elif: 6 <= int(N[i]) + prev <= 9:
    count += 11 - (int(N[i]) - prev)
    prev = 1
  else:
    prev = 1
print(count)

### FIXED CODE ###

N = input()
count = 0
prev = 0
for i in range(len(N)):
  if 0 <= int(N[i]) + prev < 5:
    count += int(N[i]) + prev
    prev = 0
  elif 6 <= int(N[i]) + prev <= 9:
    count += 10 - (int(N[i]) + prev)
    prev = 1
  elif int(N[i]) + prev == 10:
    prev = 1
  else:
    if (i < (len(N) - 1) and int(N[i+1]) < 5) or i == len(N) - 1:
      count += 5
      prev = 0
    else:
      count += 5
      prev = 1
count = count + prev
print(count)
n = input()
inf = 1000000000
M = [[inf for i in range(n)] for i in range(n)]
for i in range(n):
  str = raw_input().split()
  u = int(str[0])
  k = int(str[1])
  for j in range(int(k)):
    v = int(str[2+j])
    c = int(str[3+j])
    M[u][v] = c
d = [inf for i in range(n)]
color = [0 for i in range(n)]

d[0] = 0
color[0] = 1

while 1:
  minv = inf
  u = -1
  for i in range(n):
    if minv>d[i] and color[i]!=2:
      u = i
      minv = d[i]
    print minv
  if u == -1:
    break
  color[u] = 2
  for v in range(n):
    if color[v]!=2 and M[u][v]!=inf:
      if d[v]>d[u]+M[u][v]:
        d[v] = d[u] + M[u][v]
        color[v] = 1
for i in range(n):
  if d[i]==inf:
    print '%d -1' % i
  else:
    print '%d %d' % (i, d[i])

### FIXED CODE ###

n = input()
inf = 1000000000
M = [[inf for i in range(n)] for i in range(n)]
for i in range(n):
  str = map(int, raw_input().split())
  u = str[0]
  k = str[1]
  for j in range(k):
    v = str[2+2*j]
    c = str[3+2*j]
    M[u][v] = c
d = [inf for i in range(n)]
color = [0 for i in range(n)]
 
d[0] = 0
color[0] = 1
 
while 1:
  minv = inf
  u = -1
  for i in range(n):
    if minv>d[i] and color[i]!=2:
      u = i
      minv = d[i]
  if u == -1:
    break
  color[u] = 2
  for v in range(n):
    if color[v]!=2 and M[u][v]!=inf:
      if d[v]>d[u]+M[u][v]:
        d[v] = d[u] + M[u][v]
        color[v] = 1
for i in range(n):
  if d[i]==inf:
    print '%d -1' % i
  else:
    print '%d %d' % (i, d[i])
K = int(input())
S = input()
if len(S) =< int(K):
 print(S)
else:
 print(S[0:K]+'...')


### FIXED CODE ###

K = int(input())
S = input()
if len(S) <= K:
 print(S)
else:
 print(S[:K] + '...')
n = int(input())
a = list(map(int, input().rstrip().split(" ")))

t = list(0 for i in range(n+1))
for i in range(1, n+1):
    t[i] = t[i-1] + a[i-1]

def sum_a(i, j):
    return t[j]-t[i]

min_dif = sum_a(0, n)

for i in range(2, n-1):
    j0 = 0
    j1 = i
    u = sum_a(0, i) // 2
    while j1 - j0 > 1:
        j = (j0+j1) // 2
        if 2*sum_a(0, j) <= u: 
            j0 = j
        else:
            j1 = j
    if abs(sum_a(0, j0)-sum_a(j0, i)) < abs(sum_a(0, j1) - sum_a(j1, i)): 
        p = sum_a(0, j0)
        q = sum_a(j0, i)
    else:
        p = sum_a(0, j1)
        q = sum_a(j1, i)

    j0 = i
    j1 = n
    u = sum_a(i, n) // 2
    while j1 - j0 > 1:
        j = (j0+j1) // 2
        if sum_a(i, j) <= u: 
            j0 = j
        else:
            j1 = j
    if abs(sum_a(i, j0)-sum_a(j0, n)) < abs(sum_a(i, j1) - sum_a(j1, n)): 
        r = sum_a(i, j0)
        s = sum_a(j0, n)
    else:
        r = sum_a(i, j1)
        s = sum_a(j1, n)

    min_dif = min(min_dif, max(p, q, r, s)-min(p, q, r, s))

print(min_dif)


### FIXED CODE ###

n = int(input())
if n % 2 == 0:
    print(n)
else:
    print(n*2)
n = int(input())
R = [0]*100
for i in range(n):
    R[i] = int(input())
    
minv = R[0]
maxv = R[1] - R[0]
for i in range(1,n):
    maxv = max(maxv, R[i] - minv)
    minv = min(minv, R[i])
print(maxv)


### FIXED CODE ###

n = int(input())
R = [0]*n
for i in range(n):
    R[i] = int(input())
    
minv = R[0]
maxv = R[1] - R[0]
for i in range(1,n):
    maxv = max(maxv, R[i] - minv)
    minv = min(minv, R[i])
print(maxv)
from collections import deque
H,W=map(int,input().split(' '))
S=[list(input()) for i in range(H)]
S[0][0]=1
next  = deque([[0,0]])
ans = H*W
while next:
    x,y =next.popleft()
    s = S[x][y]
    for i,j in [[1,0],[0,1],[-1,0],[0,-1]]:
        if 0<=x+i<H and 0<=y+j<W and S[x+i][y+j]=='.':
            S[x+i][y+j]=s+1
            next.append([x+i,y+j])
for i in S:
    ans -=i.count('#')
print(ans-S[H-1][W-1])

### FIXED CODE ###

from collections import deque
H,W=map(int,input().split(' '))
S=[list(input()) for i in range(H)]
S[0][0]=1
next  = deque([[0,0]])
ans = H*W
while next:
    x,y =next.popleft()
    s = S[x][y]
    for i,j in [[1,0],[0,1],[-1,0],[0,-1]]:
        if 0<=x+i<H and 0<=y+j<W and S[x+i][y+j]=='.':
            S[x+i][y+j]=s+1
            next.append([x+i,y+j])
for i in S:
    ans -=i.count('#')
if type(S[H-1][W-1])==str:
    print(-1)
else:
    print(ans-S[H-1][W-1])
def hantei(y,m):
    if y <= 12 and y >= 1:
        if m <= 12 and n >= 1:
            print('AMBIGUOUS')
        else:
            print('MMYY')
    else:
        if m <= 12 and n >= 1:
            print('YYMM')
        else:
            print('NA')
a = int(input())
b1 = a//100
c2 = a%100
henkan(b1,c2)


### FIXED CODE ###

a, b = map(int, input().split())
c = input()
print(c[:b-1]+str.lower(c[b-1])+c[b:])
import numpy as np
n, q = map(int, input().split())

e = np.eye(n+1, dtype=int)
for i in range(n-1):
    a, b = map(int, input().split())
    e[a][b] = 1

for i in reversed(range(1, n+1)):
    if e[i-1][i] == 1:
        e[i-1][i+1:] += e[i][i+1:]
    else:
        continue


point = np.zeros(n, dtype=int)
for i in range(q):
    p, x = map(int, input().split())
    point[p-1] += x

ans = np.dot(point, e[1:, 1:])
print(*ans)

### FIXED CODE ###

from collections import deque
n, q = map(int, input().split())
tree = [[] for _ in range(n+1)]
cnt = [0] * (n+1)

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

for _ in range(q):
    p, x = map(int, input().split())
    cnt[p] += x

queue = deque([1])
visited = {1}
while queue:
    now = queue.popleft()
    visited.add(now)
    for t in tree[now]:
        if t in visited:
            pass
        else:
            queue.append(t)
            cnt[t] += cnt[now]

print(*cnt[1:])
A,B=map(int,input().split())

answer=a-2*B

if answer<0:
  print(0)
else:
  print(answer)

### FIXED CODE ###

A,B=map(int,input().split())
 
answer=A-2*B
 
if answer<0:
  print(0)
else:
  print(answer)
a=int(input())
if 1<=a<=10:
print(a+a**2+a**3)

### FIXED CODE ###

a=int(input())
if 1<=a<=10:
    print(a+a**2+a**3)
n,m,x=map(int,input().split())
A=[int(input()) for _ in range(m)]
start=0
goal=0
for i in range(x, n+1):
  for a in A:
    if i ==a:
      start+=1
for j in range(x):
  for a in A:
    if i ==a:
      goal+=1
print(min(start, goal))

### FIXED CODE ###

n,m,x=map(int,input().split())
A=[int(x) for x in input().split()]
start=0
goal=0
for i in range(x, n+1):
  for a in A:
    if i ==a:
      start+=1
for j in range(x):
  for a in A:
    if j ==a:
      goal+=1
print(min(start, goal))
a=input().split()

fa=int(a[0])
fb=int(a[1]*100)

print((fa*fb//100)

### FIXED CODE ###

a=input().split()

fa=int(a[0])
fb=int(a[1].replace(".", ""))

print(fa*fb//100)
N, K = map(int, input().split())

h = list(map(int(input().split())))

ans = 0
[ans+= for i in h if i>=50]

print(ans)


### FIXED CODE ###

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

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

ans = 0
for i in h:
    if i>=K:
        ans+=1


print(ans)
l = [list(map(int, input().split())) for i in range(3)]
d = [None]*3
for i in range(3):
  d[i] = [l[i] - l[i+1] for i in range(2)]
print('Yes' if all(d[i] == d[i+1] for i in range(2)) else 'No')


### FIXED CODE ###

d = [None]*3
for i in range(3):
  c = list(map(int, input().split()))
  d[i] = [c[i] - c[i+1] for i in range(2)]
print('Yes' if all(d[i] == d[i+1] for i in range(2)) else 'No')
a,b,c=map(int,input().split())
x=[a,b,c]
x.sort()
print(int((x[2]+x[1])+x[0])

### FIXED CODE ###

a,b,c=sorted(map(int,input().split()))
print(10*c+b+a)
num_list = list(input())
count = 0
if num[0] == "1": count +=1 
if num[1] == "1": count +=1 
if num[2] == "1": count +=1 
print(str(count))

### FIXED CODE ###

num_list = list(input())
count = 0
if num_list[0] == "1": count +=1 
if num_list[1] == "1": count +=1 
if num_list[2] == "1": count +=1 
print(str(count))
# -*- coding: utf-8 -*-
N, X = map(int, input().split())
M = [int(input()) for _ in range(N)]
 
x = X - sum(M)
m = Min(M)
 
print (N + x // m)

### FIXED CODE ###

N, X = map(int, input().split())
M = [int(input()) for _ in range(N)]
 
x = X - sum(M)
m = min(M)
print(N + x // m)
value = input()
N,i = value.split()
N = int(N)
i = int(i)

print (N - i + 1)

### FIXED CODE ###

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

while N>=i:
    count+=1
    N-=1


print(count)
a,b = map(int,input().split())
res = 0
c = 1
while c < b:
  c += a
  res += 1
        
print(res)


### FIXED CODE ###

s = input()
t = input()

count = 0
for i in range(len(s)):
    if s[i] == t[i]:
        count += 1
        
print(count)
N,W=map(int,input().split())
wv=[list(map(int,input().split())) for _ in range(n)]
dp=[[0 for _ in range(W+1) for _ in range(N+1)]
for i in range(1,N+1):
    for j in range(1,W+1):
        if wv[i-1][0]<=j:
            dp[i][j]=max(dp[i-1][j],dp[i-1][max(0,j-wv[i-1][0])]+wv[i-1][1])
        else:
            dp[i][j]=dp[i-1][j]
print(dp[-1][-1])

### FIXED CODE ###

n,w=map(int,input().split())
wv=[list(map(int,input().split())) for _ in range(n)]
dp=[[0]*(w+1) for _ in range(n+1)]
for i in range(1,n+1):
    for j in range(1,w+1):
        if wv[i-1][0]<=j:
            dp[i][j]=max(dp[i-1][j],dp[i-1][max(0,j-wv[i-1][0])]+wv[i-1][1])
        else:
            dp[i][j]=dp[i-1][j]
print(dp[-1][-1])
import itertools

s = input()
K = int(input())

ans = []
for i in range(1, len(s)+1):
  for j in list(itertools.combinations(s,i)):
    c = "".join(j)
    if (len(c) == c.count(c[0])):
      c = c[0]
    if c not in ans:
      ans.append(c)
print(ans[-K])

### FIXED CODE ###

s = input()
K = int(input())
S = set()
ans = []
for i in range(K):
  for j in range(len(s)-i):
    c = s[j:j+i+1]
    S.add(c)
  
set_ans = sorted(list(S))
print(set_ans[K-1])
def search(s):
    if len(s) <= 1:
        return eval(s[0])
    return search([s[0]+s[1]]+s[2:]) + search([s[0]+'+'+s[1]]+s[2:])
print(search(input()))

### FIXED CODE ###

def plus_or_through(s):
    if len(s) <= 1:
        return eval(s[0])
    return plus_or_through([s[0]+s[1]]+s[2:]) + plus_or_through([s[0]+'+'+s[1]]+s[2:])
print(plus_or_through(list(input())))
N=int(input())
a=list(map(int, input().split()))
a.sort()[::1]
Alice=0
Bob=0
for i in range(N):
  if i%2==0:
    Alice += a[i]
  else:
    Bob += a[i]
print(Alice-Bob)


### FIXED CODE ###

N=int(input())
a=list(map(int, input().split()))
a.sort(reverse=True)
Alice=0
Bob=0
for i in range(N):
  if i%2==0:
    Alice += a[i]
  else:
    Bob += a[i]
print(Alice-Bob)
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
s,t=iim()
a,b=iim()
u=ii()

if u == s:
    print(a-1,b)
else:
    print(a,b-1)

### FIXED CODE ###

def ii():return int(input())
def iim():return map(int,input().split())
def ism():return map(str,input().split())
def iil():return list(map(int,input().split()))
s,t=ism()
a,b=iim()
u=input()

if u == s:
    print(a-1,b)
else:
    print(a,b-1)
i = 1
while True:
  n = input()
  if n == 0:
    break
  print("Case {0}: {1}".format(i,n))
  i += 1

### FIXED CODE ###

i = 1
while True:
  n = input()
  if n == "0":
    break
  print("Case {0}: {1}".format(i,n))
  i += 1
import numpy as np
import sys

for i in range(3):
    A = list(map(int, input().split()))
N = int(input())
b = []
for i in range(N):
    k = int(input())
    b.append(k)
for k in b:
    for row in A:
        for elem in row:
            if k == elem:
                elem = 0


row = np.sum(A, axis=1)
for i in range(3):
    if row[i] == 0:
        print('Yes')
        sys.exit()


col = np.sum(A, axis=0)
for i in range(3):
    if col[i] == 0:
        print('Yes')
        sys.exit()

c = 0
for i in range(3):
    c += A[i][i]
if c == 0:
    print('Yes')
    sys.exit()

c = 0
for i in range(3):
    c += A[3-i-1][i]
if c == 0:
    print('Yes')
    sys.exit()

print('No')

### FIXED CODE ###

import numpy as np
import sys

A = np.zeros((3, 3), dtype=np.int64)
for i in range(3):
    l, m, n = map(int, input().split())
    A[i][0] = l
    A[i][1] = m
    A[i][2] = n
N = int(input())
b = []
for i in range(N):
    k = int(input())
    b.append(k)
for k in range(N):
    for i in range(3):
        for j in range(3):
            if b[k] == A[i][j]:
                A[i][j] = 0


row = np.sum(A, axis=1)
for i in range(3):
    if row[i] == 0:
        print('Yes')
        sys.exit()


col = np.sum(A, axis=0)
for i in range(3):
    if col[i] == 0:
        print('Yes')
        sys.exit()

c = 0
for i in range(3):
    c += A[i][i]
if c == 0:
    print('Yes')
    sys.exit()

c = 0
for i in range(3):
    c += A[3-i-1][i]
if c == 0:
    print('Yes')
    sys.exit()

print('No')
import sys
sys.setrecursionlimit(10**5)
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
MOD = 1000000007
def Fib(n, A, MOD, memo={}):
    if n in A:
        return 0
    elif n == 0:
        return 1
    elif n == 1:
        return 1
    elif n in memo:
        return memo[n]
    else:
        memo[n] = ( Fib(n-1, A, MOD, memo) + Fib(n-2, A, MOD, memo) ) % MOD
        return memo[n]
print(Fib(N, A, MOD))

### FIXED CODE ###

from collections import deque
def C():
    N, M = map(int, input().split())
    A = set([int(input()) for _ in range(M)])
    dp = deque([1, 1 if 1 not in A else 0])
    MOD = 1000000007
    for i in range(2,N+1):
        #print(i, dp)
        if i in A:
            dp.append(0)
        else:
            dp.append((dp[0]+dp[1]) % MOD)
        dp.popleft()
    print(dp[-1])

C()
a=int(input())
b=int(input())
if a>b:
  print(2*a-1)
elif a=b:
  print(2*a)
else:
  print(2*b-1

### FIXED CODE ###

a,b=map(int, input().split())
if a>b:
  print(2*a-1)
elif a==b:
  print(2*a)
else:
  print(2*b-1)