Harryxun/stf_run huggingface dataset:
n = int(input())
ga, sa, ba = list(map(int, input().split()))
gb, sb, bb = list(map(int, input().split()))

w_ab = []
v_ab = []

if ga < gb:
    w_ab.append(ga)
    v_ab.append(gb)
if sa < sb:
    w_ab.append(sa)
    v_ab.append(sb)
if ba < bb:
    w_ab.append(ba)
    v_ab.append(bb)

num = (n+1)*(len(w_ab)+1)
dp = [0]*num
for i in range(len(w_ab)):
    for j in range(n+1):
        if j < w_ab[i]:
            dp[(i+1)*(n+1) + j] = dp[i*(n+1) + j]
        else:
            dp[(i+1)*(n+1) + j] = max(dp[i*(n+1) + j], dp[(i+1)*(n+1) + j - w_ab[i]] + v_ab[i])
ans = 0
length = len(w_ab)
for j in range(n+1):
    ans = max(ans, dp[length*(n+1) + j] + n-j)
n = ans

w_ab = []
v_ab = []

if ga > gb:
    w_ab.append(gb)
    v_ab.append(ga)
if sa > sb:
    w_ab.append(sb)
    v_ab.append(sa)
if ba > bb:
    w_ab.append(bb)
    v_ab.append(ba)

num = (n+1)*(len(w_ab)+1)
dp = [0]*num
for i in range(len(w_ab)):
    for j in range(n+1):
        if j < w_ab[i]:
            dp[(i+1)*(n+1) + j] = dp[i*(n+1) + j]
        else:
            dp[(i+1)*(n+1) + j] = max(dp[i*(n+1) + j], dp[(i+1)*(n+1) + j - w_ab[i]] + v_ab[i])

length = len(w_ab)
ans = 0
for j in range(n+1):
    ans = max(ans, dp[length*(n+1) + j] + n-j)
print(ans)
  

### FIXED CODE ###

n, h, d = map(int, input().split())
MOD = 10 ** 9 + 7


fact = [1] * (n + 1)
for i in range(n):
    fact[i + 1] = fact[i] * (i + 1)
    fact[i + 1] %= MOD

# fact_sum = fact[1] + fact[2] + ... + fact[n]
fact_sum = 0
for i in range(1, n + 1):
    fact_sum += fact[i]
    fact_sum %= MOD

dp = [0] * (h + 1)
ru = [0] * (h + 2)
dp[0] = 1
ru[1] = 1
for i in range(h):
    l = max(i + 1 - d, 0)
    dp[i + 1] += (ru[i + 1] - ru[l]) * fact_sum
    dp[i + 1] %= MOD
    ru[i + 2] = ru[i + 1] + dp[i + 1]
    ru[i + 2] %= MOD

print((dp[-1] * fact[n] * pow(fact_sum, MOD - 2, MOD)) % MOD)
N=int(input())
la=[]
buff=0
for i in range(1,10):
    la.append(int(N/10**i))
la.append(N%10)
buff=sum(la)
if(N%buff==0):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s=input()
n=0
for i in range(4):
    if(s[i]=='+'):
        n=n+1
    if(s[i]=='-'):
        n=n-1
print(n)
import numpy as np
N, M = map(int, input().split())
A = tuple(map(int, input().split()))


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


A = np.unique(A)
for i, a in enumerate(A):
    if i == 0:
        g = a
        lcm = a
    g = gcd(g, a)
    lcm *= a // g

ans = M / lcm + 0.5
ans = int(ans)
print(ans)


### FIXED CODE ###

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


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

check = set()
for a in A:
    cnt = 0
    while a % 2 == 0:
        cnt += 1
        a //= 2
    check.add(cnt)

if len(check) > 1:
    print(0)
    exit()

LCM = 1
for a in A:
    gcd = GCD(LCM, a // 2)
    LCM = LCM * (a // 2) // gcd

ans = (M - LCM) // (2 * LCM) + 1
print(ans)
n,m = map(int,input().split())
L = [[] for _ in range(n)]

for i in range(m):
    a,b = map(lambda x:int(x)-1,input().split())
    L[a].append(b)
    L[b].append(a)
    
def dfs(i):
    visited[i] = True
    for j in L[i]:
        if visited[j]:
            continue
        dfs(j)
        
visited = [False]*n
cnt = 0

for i in range(n):
    if visited[i]:
        continue
    dfs(i)
    cnt +=1
    
print(cnt-1)

### FIXED CODE ###

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

class Unionfind:
     
    def __init__(self,n):
        self.uf = [-1]*n
 
    def find(self,x):
        if self.uf[x] < 0:
            return x
        else:
            self.uf[x] = self.find(self.uf[x])
            return self.uf[x]
 
    def same(self,x,y):
        return self.find(x) == self.find(y)
 
    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.uf[x] > self.uf[y]:
            x,y = y,x
        self.uf[x] += self.uf[y]
        self.uf[y] = x
        return True
 
    def size(self,x):
        x = self.find(x)
        return -self.uf[x]
#a = [i+1 for i in range(n)]
d = Unionfind(n)

for i in range(m):
    a,b = map(int,input().split())
    d.union(a-1,b-1)
    
L = []
for i in range(n):
    c = d.find(i)
    L.append(c)
#print(L)
print(len(set(L))-1)
input = str(input()).split(" ")
input = [int(x) for x in input]

a=input[0]
b=input[1]
x=input[2]

import math

##check situation
height = x/a/a
if height <= b/2:
    teihen_height = 2*x/a/b
    print(math.degrees(math.atan(b/teihen_height)))
else:
    nokori_height = b - height
    print(90-math.degrees(math.atan(0.5*a/nokori_height)))

### FIXED CODE ###

input = str(input()).split(" ")
input = [int(x) for x in input]

a=input[0]
b=input[1]
x=input[2]

import math

##check situation
height = x/a/a
if height <= b/2:
    teihen_height = 2*x/a/b
    print(math.degrees(math.atan(b/teihen_height)))
elif height == b:
    print(0)
else:
    nokori_height = b - height
    print(90-math.degrees(math.atan(0.5*a/nokori_height)))
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(0,a+1):
    for j in range(0,b+1):
        for k in range(0,c+1):
            if 500 * i + 100 * j + 50 * k == x:
                count += 1
print(count)

### FIXED CODE ###

x = int(input())
a = int(input())
b = int(input())
print((x-a)%b)
import sys
N = int(input())
H = list(map(int, input().split()))
ans_lis = []
ans = 0
for i in range(N):
    for j in range(i,N-1):
        if H[j] >= H[j+1]:
            ans = ans + 1
        else:
            ans_lis.append(ans)
            ans = 0
print(max(ans_lis))

### FIXED CODE ###

n=int(input())
h=[int(i) for i in input().split()]
c=0
d=c
for i in range(n-1):
    if h[i]>=h[i+1]:
        c+=1
    else:
        d=max([c,d])
        c=0

print(max([c,d]))
import sys
input = sys.stdin.readline
import numpy as np

N, K = [int(item) for item in input().split()]
h =np.array([int(item) for item in input().split()])

dp = np.full(N+1, 10**5)
dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(1,N):
    start = max(0, i-K)
    cost = np.abs(h[start:i] - h[i])
    dp[i] =min(np.minimum(dp[start:i] + cost, dp[i]))
    # print(start, i)
    print(dp)
print(dp[N-K])


### FIXED CODE ###

import numpy as np

N, K = [int(item) for item in input().split()]
h =np.array([int(item) for item in input().split()])
# print(h.shape)
dp = np.full(N+K, 10**10+1, dtype='int64')
dp[0] = 0

for i in range(1, N):
    max1 = min(N, i+K)
    cost = abs(h[i:max1] - h[i-1])
    # print(cost.shape, dp[i:max1].shape)
    dp[i:max1] = np.minimum(dp[i:max1], dp[i-1] + cost)

    # print(dp)
print(dp[N-1])
# -*- coding: utf-8 -*-

def solve():
    N,M = map(int,input().split())
    D = dict()
    for _ in range(M):
        s,c = map(int,input().split())
        D[s] = D.get(s,set()) | {c,}

    if not all(len(v)==1 for v in D.values()):
        return '-1'

    if N>1 and D[1] == {0,}:
        return '-1'

    if 1 not in D:
        D[1] = {1,}

    if 2 not in D:
        D[2] = {0,}

    if 3 not in D:
        D[3] = {0,}

    res = sum(D[i+1].pop()*10**(N-i-1) for i in range(N))

    return str(res)

if __name__ == '__main__':
    print(solve())



### FIXED CODE ###

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

def solve():
    N,M = map(int,input().split())
    D = dict()
    for _ in range(M):
        s,c = map(int,input().split())
        if s in D and D[s] != c:
            return '-1'
        else:
            D[s] = c

    if N==1 and (M==0 or (1 in D and D[1] == 0)):
        return '0'

    if N>1 and 1 in D and D[1] == 0:
        return '-1'

    if 1 not in D:
        D[1] = 1

    if 2 not in D:
        D[2] = 0

    if 3 not in D:
        D[3] = 0

    res = sum(D[i+1]*10**(N-i-1) for i in range(N))

    return str(res)

if __name__ == '__main__':
    print(solve())
a,b = map(int,input().split())
if b*10 <= a*100/8 < (b+1)*10:
    if int(a*100/8) == a*100/8:
        print(int(a*100/8))
    else:
        printf(int(a*100/8)+1)
else:
    if a*100/8 <= b*10 < (a+1)*100/8:
        print(b*10)
    else:
        print(-1)


### FIXED CODE ###

a,b = map(int,input().split())
if b*10 <= a*100/8 < (b+1)*10:
    if int(a*100/8) == a*100/8:
        print(int(a*100/8))
    else:
        print(int(a*100/8)+1)
else:
    if a*100/8 <= b*10 < (a+1)*100/8:
        print(b*10)
    else:
        print(-1)
print("Yes" if input()[0]==input()[2] else "No")

### FIXED CODE ###

a=input()
print("Yes" if a[0]==a[2] else "No")
from math import abs
N = int(input())

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

total_list = [0] * N
for i in range(N):
    list_one = weight_list[: i + 1]
    list_two = weight_list[i + 1:]
    
    abs_diff = abs(sum(list_one) - sum(list_two))
    
    total_list[i] = abs_diff
print(min(total_list))

### FIXED CODE ###

from math import fabs
N = int(input())

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

total_list = [0] * N
for i in range(N):
    list_one = weight_list[: i + 1]
    list_two = weight_list[i + 1:]
    
    abs_diff = fabs(sum(list_one) - sum(list_two))
    
    total_list[i] = abs_diff
print(int(min(total_list)))
n=int(input())
s=list(input())
k=int(input())
p=s[k]
q=[0]*n
for i in range(n):
  if s[i]!=p:
    s[i]='*'
      
print(''.join(s))

### FIXED CODE ###

n=int(input())
s=list(input())
k=int(input())
p=s[k-1]

for i in range(n):
    if s[i]!=p:
        s[i]='*'
print(''.join(s))
n,m=map(int,input().split())
nexts=[None for i in range(n)]
for i in range(n):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  if nexts[a]==None:
    nexts[a]=[b]
  else:
    nexts[a].append(b)

ans=0
stack=[]
stack.append([0,set()])
while stack:
  node=stack.pop()
  v=node[0]
  seen=node[1]
  seen.add(v)
  if len(seen)==n:
    ans+=1
    continue
  childs=nexts[v]
  if childs:
    for child in (set(childs)-seen):
      stack.append(child,seen)
  
print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
nexts=[None for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  if nexts[a]==None:
    nexts[a]=[b]
  elif b not in nexts[a]:
    nexts[a].append(b)
  if nexts[b]==None:
    nexts[b]=[a]
  elif a not in nexts[b]:
    nexts[b].append(a)

ans=0
stack=[]
stack.append([0,[]])
while stack:
  node=stack.pop()
  v=node[0]
  seen=node[1][:]
  seen.append(v)
  if len(seen)==n:
    ans+=1
    continue
  childs=nexts[v]
  if childs:
    for child in (set(childs)-set(seen)):
      stack.append([child,seen])
  
print(ans)
from fractions import gcd
n,k = map(int,input().split())
a = list(map(int,input().split()))
g = a[0]
for i in range(n):
  g = gcd(g,a[1])
if k%g == 0 and k <= max(a):
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

### FIXED CODE ###

from fractions import gcd
n,k = map(int,input().split())
a = list(map(int,input().split()))
g = a[0]
for i in range(n):
  g = gcd(g,a[i])
if k%g == 0 and k <= max(a):
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")
N, M = map(int, input().split())
P = []
Y = []
#var = []
for i in range(M):
    p, y = map(int, input().split())
    #if p not in P:
    #    var.append(p)
    P.append(p)
    Y.append(y)

L = zip(range(M), P, Y)     

Order = [None]*M

for v in set(P):
    l = filter(lambda x:x[1] == v, L)
    l_ = sorted(l, key = lambda x:x[2])
    
    for n in l_:
        Order[n[0]] = l_.index(n)+1
        
for (p, od) in zip(P, Order):
    print('{0:0>6d}{1:0>6d}'.format(p, od))

### FIXED CODE ###

N, M = map(int, input().split())
L = []
P = [0]*(N+1)
for i in range(M):
    p, y = map(int, input().split())
    L.append([i, p, y, 0])

L = sorted(L, key = lambda x:x[2])

for l in L:
    P[l[1]] += 1
    l[3] = P[l[1]]    
        
for l in sorted(L, key = lambda x:x[0]):
    print('{0:0>6d}{1:0>6d}'.format(l[1], l[3]))
#ABC057.B
N,M = int(input().split())
L1 = []
L2 = []

for i in range(N):
    a,b = map(int,input().split())
    L1.append([a,b])
for m in range(M):
    c,d = map(int,input().split())
    L2.append([c,d])

L3 = []
for j in range(N):
    for l in range(M):
        L3.append(abs(L1[j][0]-L2[l][0])+abs(L1[j][1]-L2[l][1]))
    print(L3.index(min(L3[j])+1))

### FIXED CODE ###

#ABC057.B
N,M = map(int,input().split())
L1 = []
L2 = []

for i in range(N):
    a,b = map(int,input().split())
    L1.append([a,b])
for m in range(M):
    c,d = map(int,input().split())
    L2.append([c,d])

for j in range(N):
    L3 = []
    for l in range(M):
        L3.append(abs(L1[j][0]-L2[l][0]) + abs(L1[j][1]-L2[l][1]))
    print(L3.index(min(L3))+1)
n, k = map(int, input().split())


bai = 1
k_arr = []
while bai * k <= n:
    k_arr.append(bai * k)
    bai += 1


if k % 2 == 0:
    bai2 = 1
    k_arr2 = []
    while bai2 * k/2 <= n:
        k_arr2.append(bai2 * k/2)
        bai2 += 1
        k_arr2_len = len(k_arr2) - len(k_arr)
        
    print(k_arr2_len)
    print(len(k_arr)*len(k_arr)*len(k_arr) + k_arr2_len*k_arr2_len*k_arr2_len)

else:
    print(len(k_arr)*len(k_arr)*len(k_arr))


### FIXED CODE ###

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

bai = 1
k_arr = []
while bai * k <= n:
    k_arr.append(bai * k)
    bai += 1


if k % 2 == 0:
    bai2 = 1
    k_arr2 = []
    k_arr2_len = 0 - len(k_arr2)
    while bai2 * k/2 <= n:
        k_arr2.append(bai2 * k/2)
        bai2 += 1
        k_arr2_len = len(k_arr2) - len(k_arr)
    print(len(k_arr)*len(k_arr)*len(k_arr) + k_arr2_len*k_arr2_len*k_arr2_len)

else:
    print(len(k_arr)*len(k_arr)*len(k_arr))
N=int(input())
A=list(map(int,input()))

if N > 2:
    A.sort()
    num_total = A[-1]
    A.pop()
    def isOK(index, key, l):
        if l[index] >= key:
            return True
        else:
            return False
    
    def meguru_search(l,key): # key以上の値を持つ最小のインデックスを返す
        left = -1
        right = len(l)

        while (right - left) > 1: # 二分探索
            mid = left + (right - left)//2
            if isOK(mid,key,l):
                right = mid
            else:
                left = mid
        
        return right
    
    if num_total%2 == 0:
        Max = num_total//2 
    else:
        Max = num_total//2 + 1
    
    Maxind1 = meguru_search(A,Max) # Max以上の値を持つインデックス
    Maxind2 = Maxind1 - 1 # Max未満の最大の値を持つインデックス
    abs_1 = abs(Max - A[Maxind1])
    abs_2 = abs(Max - A[Maxind2])
    if abs_1 > abs_2: # Maxに近いほどnCrが大きくなる
        r = A[Maxind2]
    else:
        r = A[Maxind1]
    print(num_total,r)

else:
    print(max(A),min(A))

### FIXED CODE ###

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

if N > 2:
    A.sort()
    num_total = A[-1]
    A.pop()
    def isOK(index, key, l):
        if l[index] >= key:
            return True
        else:
            return False
    
    def meguru_search(l,key): # key以上の値を持つ最小のインデックスを返す
        left = -1
        right = len(l)

        while (right - left) > 1: # 二分探索
            mid = left + (right - left)//2
            if isOK(mid,key,l):
                right = mid
            else:
                left = mid
        
        return right
    
    if num_total%2 == 0:
        Max = num_total//2 
    else:
        Max = num_total//2 + 1
    
    Maxind1 = meguru_search(A,Max) # Max以上の値を持つインデックス
    Maxind2 = Maxind1 - 1 # Max未満の最大の値を持つインデックス
    abs_1 = abs(Max - A[Maxind1])
    abs_2 = abs(Max - A[Maxind2])
    if abs_1 > abs_2: # Maxに近いほどnCrが大きい
        r = A[Maxind2]
    else:
        r = A[Maxind1]
    print(num_total,r)

else:
    print(max(A),min(A))
n = int(input())
d = [list(input())for i in range(n)]
print(len(set(d)))


### FIXED CODE ###

n = int(input())
d = list(int(input())for i in range(n))
print(len(set(d)))
def D_RainFlowsintoDams():
    import numpy as np
    N = int(input())
    A = np.array([list(map(int, input().split()))])
    # XB = A のXを求める
    X = (np.eye(N) + np.eye(N, k=1) + np.eye(N, k=-N+1)) * 0.5
    # X^{-1} を求める
    X = np.linalg.inv(X)
    # 両辺に左からX^{-1}をかける
    B = np.dot(X, A.T)
    for x in range(N):
        print(int(B.T[0][x]), end=" ")

if __name__ == "__main__":
    D_RainFlowsintoDams()

### FIXED CODE ###

def D_RainFlowsintoDams():
    N = int(input())
    A = list(map(int, input().split()))
    total = sum(A)
    x = total - 2*sum([A[i] for i in range(1, N -1, 2)])
    for i in range(N):
        print(x, end=" ")
        x = 2 * A[i] - x
def D_Determinant():
    # 行列式を使うと時間がかかりすぎる
    import numpy as np
    N = int(input())
    A = [list(map(int, input().split()))]
    A = np.array(A)
    # XB = A のXを求める
    X = (np.eye(N) + np.eye(N, k=1) + np.eye(N, k=-N+1)) * 0.5
    # X^{-1} を求める
    B = np.linalg.solve(X, A.T)
    # 両辺に左からX^{-1}をかける
    for x in range(N):
        print(int(B.T[0][x]), end=" ")

if __name__ == "__main__":
    D_RainFlowsintoDams()
# -*- coding: utf-8 -*-

def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))


A , V = input_multiple_number()
B, W = input_multiple_number()
T = input_one_number()

D = abs(B-A)
v = W-V

if D - v*T > 0 or :
	print("NO")
else:
	print("YES")



### FIXED CODE ###

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

def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))


A , V = input_multiple_number()
B, W = input_multiple_number()
T = input_one_number()

D = abs(B-A)
v = V-W

if D - v*T > 0 :
	print("NO")
else:
	print("YES")
from fractions import Fraction
num = int(input())
l=[]
for i in range(num):
    k=int(input())
    x=Fraction(1, k)
    l.append(x)
p=sum(l)
y=float(1/p)
print(y)

### FIXED CODE ###

a = int(input())
l=list(map(int ,input().split()))
ll=[]
for i in range(a):
        j=1/l[i]
        ll.append(j)
k=sum(ll)
print(1/k)
print("Hello World"if input()=="1"else int(input())+int(input())

### FIXED CODE ###

print("Hello World"if input()=="1"else int(input())+int(input()))
L,R=map(int,input().split())
m=(L*(L+1))%2019
for i in range(L,R):
  for j in rang(L+1,R+1):
    s=(i*j)%2019
    m=min(m,s)
print(m)

### FIXED CODE ###

L,R=map(int,input().split())
if L%2019==0 or R%2019==0:
  print(0)
else:
  start=L%2019
  end=R%2019
  if start>=end or R-L>=2018: #中に2019の倍数が含まれるとき
    print(0)
  else:
    m=(L*(L+1))%2019
    for i in range(L,R):
      for j in range(i+1,R+1):
        s=(i*j)%2019
        m=min(m,s)
    print(m)
a,b = map(float, input().split())
 
c = a * (b*10**4)
c = c // 1e4
print(int(c)

### FIXED CODE ###

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

a = int(a)
b = int(b*1000)

c = a*b // 1000

print(c)
n = int(input())

g = [[] for _ in range(n)]

for _ in range(n-1):
    x, y = map(int, input().split())
    g[x-1].append(y-1)
    g[y-1].append(x-1)

white = [0 for _ in range(n)]
black = [0 for _ in range(n)]


def dfs(v):
    tmp_w = 1
    tmp_b = 1
    if len(g[v]) == 0:
        white[v] = 1
        black[v] = 1
        return None
    for w in g[v]:
        g[w].remove(v)
        dfs(w)
        tmp_w *= white[w]+black[w]
        tmp_b *= white[w]
    white[v] += tmp_w
    black[v] += tmp_b
    return None


dfs(0)

print(white[0]+black[0])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

mod = 10**9+7
n = int(input())
g = [[] for _ in range(n)]

for _ in range(n-1):
    x, y = map(int, input().split())
    g[x-1].append(y-1)
    g[y-1].append(x-1)

white = [0 for _ in range(n)]
black = [0 for _ in range(n)]


def dfs(v):
    tmp_w = 1
    tmp_b = 1
    if len(g[v]) == 0:
        white[v] = 1
        black[v] = 1
        return None
    for w in g[v]:
        g[w].remove(v)
        dfs(w)
        tmp_w *= white[w]+black[w]
        tmp_b *= white[w]
        tmp_w %= mod
        tmp_b %= mod
    white[v] = tmp_w
    black[v] = tmp_b
    return None


dfs(0)

print((white[0]+black[0]) % mod)
a = map(int,input().split())
b = a.sort()
print('{} {} {}'.format(b[0],b[1],b[2]))

### FIXED CODE ###

x = list(map(int,input().split()))
x.sort()
print(x[0],x[1],x[2])
# O(log(B))で求める場合

import math

# f(x) = 0からxまでのxor
def f(x):
    x += 1
    digit = math.ceil(math.log2(x)) + 1

    ret = 0
    for d in range(digit):
        loop = 1 << (d + 1)
        count = (x // loop) * (loop // 2)
        count += max(0, x % loop - loop // 2)

        if count % 2 == 1:
            ret += 1 << d
    return ret



A, B = map(int, input().split())
print(f(A - 1) ^ f(B))


### FIXED CODE ###

import math

# f(x) = 0からxまでのxor
def f(x):
    div = (x // 2) % 2
    if x % 2 == 0:
        return div ^ x
    else:
        return div ^ 1

A, B = map(int, input().split())
print(f(A - 1) ^ f(B))
X = int(input())
Y = int(input())

x = X + Y/2

print(x)    

### FIXED CODE ###

X,Y = map(int,input().split())
print(X+Y//2)
n = input()
if n.count(7)>0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a = input()
q = False
for s in a:
    if s == '7':
        print('Yes')
        q  = True
        break
if q == False:
    print('No')
#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
import queue
import numpy as np

def sol(h,w,s,start):
    dx = [1, 0, -1, 0]
    dy=[0,1,0,-1]
    inf = -1000000000
    d=np.array([[inf for i in range(w)] for i in range(h)])
    q=queue.Queue()
    q.put(start)
    d[start[1]][start[0]]=0
    while not q.empty():
        p = q.get()
        for i in range(4):
            nx=p[0]+dx[i]
            ny=p[1]+dy[i]
            if 0<=nx<w and 0<=ny<h:
                S = s[ny][0]
                if d[nx][ny]==inf:
                    
                    if S[nx]=='.':
                        q.put([nx,ny])
                        d[nx][ny]=d[p[0]][p[1]]+1
    return np.max(d)


def main():
    import sys
    input = sys.stdin.readline
    h,w = map(int, input().split())
    s = []
    for i in range(h):
        SS = list(map(str, input().split()))
        s.append(SS)
    ans=[]
    for i in range(w):
        for j in range(h):
            start = [i,j]
            ans.append(sol(h,w,s,start))
    print(max(ans))
        


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''


def bfs(h, w, m, start):

    import queue
    d = [[0 for i in range(w)]for i in range(h)]
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    flg = False

    a = queue.Queue()
    a.put(start)
    #print(start)
    while not a.empty():
        hh, ww = map(int, a.get())
        for i in range(4):
            nx, ny = ww+dx[i], hh+dy[i]
            if 0 <= ny < h and 0 <= nx < w and m[ny][nx] != "#" and d[ny][nx] == 0 and [ny,nx]!=start:
                a.put([ny, nx])
                d[ny][nx] = d[hh][ww]+1
    #print(d)
    return d[hh][ww]



h, w = map(int, input().split())
m = [[]for i in range(h)]
for i in range(h):
    m[i] = list(input().rstrip())

ans=[]
for i in range(h):
    for j in range(w):
        if m[i][j]!="#":
            start=[i,j]
            ans.append(bfs(h,w,m,start))
            #print(ans)

print(max(ans))
import math

input_from = input()
info = input_from.split(' ')
a = int(info[0])

def is_prime(n):
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    for num in range(3, int(math.sqrt(n)), 2):
        if n % num == 0:
            return False
    return True

if a == 2:
    print(2)
else:
    while not is_prime(a):
        a += 1

print("{0}".format(a))


### FIXED CODE ###

input_from = input()
strings = input_from.split(' ')
print("{0}{1}".format(strings[1], strings[0]))
x,a,b = map(int,input().split())
print((x-a)%b)

### FIXED CODE ###

x=int(input())
a=int(input())
b=int(input())
print((x-a)%b)