peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
ans = 0
for i in range(60):
    x = 1<< i
    l = len([1 for j in a if j & x])
    ans += x * l * (n-l) % mod
    ans %= mod
print(ans)
# Judge status: Accepted
import collections
n = int(input())
A = list(map(int, input().split()))
ans = 0
cnt = collections.defaultdict(int)
for i in range(1, n+1):
  ans += cnt[i-A[i-1]]
  cnt[i+A[i-1]] += 1
print(ans)
# Judge status: Accepted
import heapq
n, m = map(int, input().split())
a = [-int(i) for i in input().split()]
heapq.heapify(a)
for _ in range(m):
    heapq.heappush(a, ((heapq.heappop(a)*-1//2)*(-1)))
print(sum(a)*-1)
# Judge status: Accepted
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

N, K = map(int, input().split())
snuke = [0] * N
for i in range(K):
    d = int(input())
    A = map(int, input().split())
    for a in A:
        a -= 1
        snuke[a] += 1

cnt = 0
for s in snuke:
    if s == 0:
        cnt += 1

print(cnt)
# Judge status: Wrong Answer
S = input()
print("No" if "L" in S[::2] or "R" in S[1::2] else "Yes")
# Judge status: Accepted
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
count_a = Counter(a)
new_a = [i for i in count_a.keys() if count_a[i] >= 2]
#print(new_a)
if len(new_a) < 2:
    print(0)
    exit()
new_a = sorted(new_a, reverse=True)
if count_a[new_a[0]] >= 4:
    ans = new_a[0] ** 2
else:
    ans = new_a[0] * new_a[1]
print(ans)
# Judge status: Accepted
N=int(input())
MOD = 10**9+7

DP=[0]*(N+1)
DP[0]=1
for i in range(3,N+1):
    for j in range(0,i-2):
        DP[i]+=DP[j]

print(DP[N]%MOD)
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e - a > k:
	print(":(")
else:
	print("Yay!")
# Judge status: Wrong Answer
N = int(input())
sp = []
for i in range(N):
  s, p = input().split()
  sp.append([s, int(p), i+1])
sp1 = sorted(sp, key = lambda x: x[0])
sp2 = sorted(sp1, key = lambda x: -1*x[1])
for i in range(N):
  print(sp2[i][2])
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
li = [a,b,c,d,e]
index = -1
def rou(n):
    if(n%10==0): return n
    return n+10-n%10

mi=(li[0]-1)%10
for i in range(5):
    if((li[i]-1)%10 <= mi):
        mi=(li[i]-1)%10
        index = i

ans = 0
for i in range(5):
    if(index == i):
        ans += li[i]
    else:
        ans += rou(li[i])
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())

s = [0 for i in range(N+2)]
mod = 10**9+7
#s[i]:i個選んだ時の総和
for k in range(N+2):
    a = (k-1)*k/2
    b = (N+N-k+1)*k/2
    s[k] = b-a+1

#ss[i+1]:i個までの個数の総和
ss = [0 for i in range(N+2)]
for i in range(N+1):
    ss[i+1] = ss[i] + s[i] 

ans = int(ss[N+1]-ss[K]) % mod  
print(ans+1)
# Judge status: Accepted
def main():
    inp = list(map(int, input().split()))
    n = inp[0]
    a = inp[1]
    b = inp[2]
    n_sum = 0
    res = 0
    for i in range(1, n+1):
        n_list = list(map(int, list(str(i))))
        n_sum = sum(n_list)
        if a <= n_sum and n_sum <= b:
            res += i
    print(res)
if __name__ == '__main__':
    main()
# Judge status: Accepted
import math
A,B,C,D = map(int,input().split())

aoki_out = math.ceil(C/B)
taka_out = math.ceil(A/D)

if(aoki_out <= taka_out):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n,k = map(int,input().split())
print(0 if n%k==0 else 1)
# Judge status: Accepted
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
ans = ["YES","NO"]

distance = abs(b-a)
speed = v-w

result = distance - speed * t
if result <= 0:
    print(ans[0])
elif result > 0:
    print(ans[1])
# Judge status: Wrong Answer
s = input()
if len(set(s)) == 4:
    print("Good")
else:
    print("No")
# Judge status: Wrong Answer
import sys

def input(): return sys.stdin.readline().rstrip("\r\n")
def List(): return list(map(int, input().split()))
def Num(): return int(input())


s = input()
if s[-1] != 'e':
    print(s + 'es')
else:
    print(s + 's')
# Judge status: Accepted
# -*- coding: utf-8 -*-
import sys
from fractions import gcd
from string import ascii_lowercase as ABC
#input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))
H = int(input())
W = int(input())
N = int(input())
X = max(H, W)
print(-(-N//X))
# Judge status: Accepted
S = input()

if "a" in S and "b"in S and "c" in S:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
S = input().strip()
C = {}
for i in range(len(S)):
    if S[i] not in C:
        C[S[i]] = 0
    C[S[i]] += 1
if len(C)==2:
    flag = 0
    for a in C:
        if C[a]!=2:
            flag = 1
            break
    if flag==0:
        print("Yes")
    else:
        print("No")
else:
    print("No")
# Judge status: Wrong Answer
import sys

def main():
    input = sys.stdin.readline
    n = int(input())
    s = input()
    first = ord("A") - 1
    last = ord("Z")
    increment = lambda x: chr(ord(x)+n) if ord(x)+n <= last else chr(first + (ord(x)+n - last))
    new_s = "".join(map(increment, s))
    print(new_s)
    


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
s = list(input())
if s[0].isupper() and s[2:-1].count('C') == 1:
    s.pop(0)
    s.pop(s.index('C'))
    cnt = 0
    for si in s:
        if si.islower():
            cnt += 1
    if cnt == len(s):
        print('AC')
    else:
        print('WA')
else:
    print('WA')
# Judge status: Accepted
a,b,c=map(int,input().split())
print('Yes' if c<=a+b else 'No')
# Judge status: Wrong Answer
K,A,B=map(int,input().split(' '))

print(max(K+1,B+(B-A)*max(0,(K-(A+1))//2)+max(0,(K-(A+1)))%2))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0

ans = sum(A[1:2*N:2])
print(ans)
# Judge status: Accepted
from bisect import bisect_left
n, m = map(int, input().split())
city_list = [[0] for _ in range(n + 1)]
city = [[]]
for _ in range(m):
    p, y = map(int, input().split())
    city_list[p].append(y)
    city.append([p, y])
for i in range(1, n + 1):
    city_list[i].sort()
for i in range(1, m + 1):
    ID = ''
    p = city[i][0]
    order = str(bisect_left(city_list[p], city[i][1]))
    p = str(p)
    ID = ID + ('0' * (6 - len(p)))
    ID += p
    ID += ('0' * (6 - len(order)))
    ID += order
    print(ID)
# Judge status: Accepted
import collections as c
n,k=map(int,input().split());a=c.Counter(map(int,input().split()))
print([0,sum(sorted([*a.values()])[:len(a)-k])][len(a)>k])
# Judge status: Wrong Answer
D = int(input())

print("christmas" + " Eve" * (25-D))
# Judge status: Wrong Answer
n = int(input())
s = input()
if s.count("E") >= (n+1)//2:
    print(n-s.count("E"))
else:
    print(s.count("E"))
# Judge status: Accepted
from collections import Counter
s = Counter(input())
t = Counter(input())
sc = sorted([x for x in s.values()])
tc = sorted([x for x in t.values()])
print("Yes" if sc==tc else "No")
# Judge status: Accepted
from collections import deque

A = deque(list(input()))
B = deque(list(input()))
C = deque(list(input()))

def res(turn,str="NULL"):
    if len(turn) == 0: print(str.upper())
    else:
        str=turn.popleft()
        if str=="a": res(A,str)
        elif str=="b": res(B,str)
        elif str=="c": res(C,str)

res(A,"NULL")
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print("Yes" if a+b>c else "No")
# Judge status: Wrong Answer

n = int(input())
w = list(map(int,input().split()))
l = []
r = []
print(w)

min = abs(w[0] - sum(w[1:]))
#print(min)
s1 = 0
s2 = 0

for i in range(n-1):
    s1 = sum(w[:i+1])
    s2 = sum(w[i+1:])
    tmp = abs(s1 - s2)
    print(s1,s2,tmp)
    if tmp < min:
        min = tmp

print(min)
# Judge status: Wrong Answer
w, h, n = map(int, input().split())
xya = []

left = 0
right = w
under = 0
upper = h

for _ in range(n):
    x, y, a = map(int, input().split())

    if a==1:
        left = x
    elif a==2:
        right = x
    elif a==3:
        under = y
    else:
        upper = y

ans = (upper-under)*(right-left)
print(max(ans, 0))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
b = []
for i in range(1,n+1):
    b.append(a.index(i)+1)
    
print(*b)
# Judge status: Accepted
if __name__ == '__main__':
    a,b= map(int,input().split())
    maxnum =0
    minnum =0
    diff = 10**9 +7
    ans = 0

    for i in range(b,a+2):
        max = (i * (2*a+1-i)) / 2
        min = (i* (i - 1) / 2)
        ans += max-min+1
        ans = ans % diff
    print(int(ans))
# Judge status: Accepted
n,a,b = map(int, input().split())
if a > b or (n==1 and a != b):
    print(0)
else:
    Max = a + b * (n-1)
    Min = a * (n-1) + b
    print(Max - Min + 1)
# Judge status: Wrong Answer
S=sorted(set(input()))
i = 0
tf = True
for s in S:
  if s == chr(ord('a')+i):
    i+=1
    continue
  else:
    print(chr(ord('a')+i))
    tf = False
    break
if tf:
  print('None')
# Judge status: Accepted
from itertools import permutations

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

def ii():
    return int(input())

def main():
    D, N = mi()
    if N == 100:
        print(100**D*101)
    else:
        print(100**D*N)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a = input()
for i in range(len(a)):
    if a[i] == "A":
        b = i
        break
for j in range(len(a)):
    if a[j] == "Z":
        c = j
        break
print(c-b+1)
# Judge status: Accepted
print('Christmas'+' Eve'*(25-int(input())))
# Judge status: Accepted
n = int(input())
if str(9) in str(n):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x,y,z=map(int,input().split())
x-=z
print(int(x/(y+z)))
# Judge status: Accepted
N = [int(_) for _ in list(input())]
a, b = 0, 1
for n in N:
    a, b = min(a + n, b + 10 - n), min(a + (n + 1), b + 10 - (n + 1))
print(a)
# Judge status: Accepted
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())

    for i in reversed(range(1, int(n ** 0.5) + 1)):
        if n % i == 0:
            j = n // i
            print(i + n // i - 2)
            exit()


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
# Judge status: Wrong Answer
a=list(map(int,input().split()))
for i in range(1,5):
    if a[i-1]==0:
        print(i)
        break
# Judge status: Accepted
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
l,r=0,max(a)
while 1<r-l:
 m=(l+r)//2;c=0
 for i in a:c+=math.ceil(i/m)-1
 if c>k:l=m
 else:r=m
print(r)
# Judge status: Wrong Answer
import sys
import re
S = input()
array_S = list(S)

if not ( 4 <= len(S) <= 10 ):
    sys.exit()
if len(re.findall('[A-Z]',S)) != 2:
    print('WA')
    sys.exit()

result = 0
if array_S[0] != 'A': result += 1
if array_S[2:-2].count('C') != 1: result += 1 
array_S.pop(0)
array_S.pop(array_S.index('C'))
if not "".join(array_S).islower(): result += 1 

print('WA') if result != 0 else print('AC')
# Judge status: Wrong Answer
N = int(input())
list_A = list(map(int, input().split()))
money = 1000
stock = 0

for i in range(N - 1):
    if list_A[i] < list_A[i + 1]:
        stock = money // list_A[i]
        money -= stock * list_A[i]
    elif list_A[i] > list_A[i + 1]:
        money += stock * list_A[i]
        stock = 0

money += stock * list_A[-1]
print(money)
# Judge status: Wrong Answer
import math


def calc(n, c, d):
    return n-(math.floor(n / c) +
              math.floor(n / d) - math.floor(n / (c*d/math.gcd(c, d))))


def main():
    a, b, c, d = map(int, input().split())

    print(calc(b, c, d)-calc(a-1, c, d))


if __name__ == "__main__":
    main()
# Judge status: Accepted
a,b,c,n = map(int, input().split())

ans = (-1)**n*a+(-1)**(n-1)*b

if abs(ans)>10**18:
    print('Unfair')
else:
    print(int(ans))
# Judge status: Accepted
import math
n,h=map(int,input().split())
ans=0
m=0
b=[]
for i in range(n):
    a,B=map(int,input().split())
    b.append(B)
    m=max(m,a)
b=sorted(b,reverse=True)
for i in range(len(b)):
    if b[i]<m:
        break
    else:
        h-=b[i]
        ans=i+1
        if h<1:
            print(ans)
            exit()
print(ans+math.ceil(h/m))
# Judge status: Wrong Answer
N, R = map(int, input().split())
if N >= 10:
    print(R)
else:
    print(R - (100 * (10 - N)))
# Judge status: Accepted
#AtCoder Grand Contest 004 a
a,b,c=map(int,input().split())
if a%2==1 and b%2==1 and c%2==1:
    print(min(a*b,b*c,c*a))
else:
    print(0)
# Judge status: Accepted
a, b, t = map(int, input().split())
print(b*(t//a))
# Judge status: Accepted
N = int(input())
ans = 0

for i in range(1, N+1, 2):
  divisor = 0
  for j in range(1, i+1, 2):
    if i%j == 0:
      divisor += 1
  if divisor == 8:
    ans += 1
print(ans)
# Judge status: Wrong Answer
N = int(input())
a = [0 for i in range(int(N**0.5)+1)]
c = 0
i = 2
m = 0
while i < N**0.5:
    if N % i == 0:
        a[i] += 1
        N = N / i
        m = i
        i -= 1
    i += 1
    if N == 1:
        break 
for j in range(2, m+1):
    if a[j] != 0:
        d = 0
        while a[j] > d:
            a[j] -= d+1
            d += 1
        c += d
print(c+1, end='')
# Judge status: Accepted
s=list(input())
a=s.count('0')
b=s.count('1')
print(min(b,a)*2)
# Judge status: Accepted
A, B = map(int,input().split())

if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0 :
    print( "Possible" )
else:
    print( "Impossible" )
# Judge status: Wrong Answer
N = int(input())
ans = 0
for i in range(1, N+1):
  b = N // i
  ans += i * b * (b+1) / 2
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

goal = ord("z") + 1 
s = input()
k = int(input())
n = len(s)
ans = [0] * n
for i,si in enumerate(s):
  if si == "a":ans[i] = "a"
  elif goal - ord(si) <= k:
    k -= goal - ord(si)
    ans[i] = "a"
  else:
    ans[i] = si
m = k % 26
ans[-1] = chr((ord(ans[-1]) - ord("a") + m)%26 + ord("a"))
print(*ans,sep="")
# Judge status: Accepted
k = int(input())
rem = 7%k
alreadys = [False]*k
alreadys[rem] = True

ans = 1
while True:
    if rem == 0:
        print(ans)
        exit()
    ans += 1
    rem = (rem*10+7)%k
    if alreadys[rem]:
        print(-1)
        exit()
    alreadys[rem] = True
# Judge status: Accepted
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

ri()
a = rl()
d = collections.Counter(a)
ans = 0
for k, v in d.items():
    if k <= v:
        ans += (v-k)
    else:
        ans += v
print(ans)
# Judge status: Accepted
s=input()
t=input()
p=0
for i in range(len(s)):
  if(s[i]!=t[i]):
    p+=1
print(p)
# Judge status: Accepted
import math
from decimal import Decimal
A,B,X = map(Decimal, input().split())
s = X / A

if s == A*B:
    print(0)
    exit()
if s > A * B / 2:
    Bu = 2 * s / A - B
    s -= A*Bu
    B -= Bu

A2 = 2 * s / B
print(math.degrees(math.atan(B/(A2))))
# Judge status: Wrong Answer
ABCD = str(input())
n = len(ABCD)-1
ABCD_ = ''
output = ''
for i in range(2**n):
  ABCD_ = ABCD[0]
  for j in range(n):
    if ((i  >> j)&1) == 1:
      ABCD_ = ABCD_ + '+' + ABCD[j+1]
    else:
      ABCD_ = ABCD_ + '-' + ABCD[j+1]
  if eval(ABCD_) == 7:
    output = ABCD_
print(output)
# Judge status: Accepted
a,b=map(int,input().split())
if((a+b)%2)==0:
    print((a+b)//2)
else:
    print("IMPOSSIBLE")
# Judge status: Accepted
X, Y = map(int, input().split(' '))

count = 0

while X <= Y:
    count += 1
    X *= 2

print(count)
# Judge status: Accepted
a,b,c=map(int,input().split())

print("Yes" if c>=a and c<=b else "No")
# Judge status: Wrong Answer
#2020-04-29
x = 0
lst = [0]
n = int(input())
s = list(input())
 
for i in range(n-1):
    if s[i] == 'I':
        x += 1
        lst.append(x)
    else:
        x -= 1
        lst.append(x)
 
print(max(lst))
# Judge status: Wrong Answer
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(N)]
CD=[list(map(int,input().split())) for j in range(M)]
for i in range(N):
    d=(10**8)*2
    ans=0
    for j in range(M):
        if abs(AB[i][0]-CD[j][0])+abs(AB[i][1]-CD[j][1])<d:
            d=abs(AB[i][0]-CD[j][0])+abs(AB[i][1]-CD[j][1])
            ans=j+1
    print(ans)
# Judge status: Accepted
n,m,x,y = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a.append(x)
b.append(y)
a =sorted(a)
b =sorted(b)
if a[-1]<b[0]:
    print('No War')
else:
    print('War')
# Judge status: Wrong Answer
import queue
import numpy as np
import math

n = int(input())
A = list(map(int, input().split()))
A = np.array(A,np.int64)
ans = 0

for i in range(60 + 1):
    count1 = 0
    for a in A:
        count1 += (a >> i) & 1

    count0 = len(A) - count1
    ans += count1*count0 * pow(2, i)
    ans%=1000000007

print(ans)
# Judge status: Accepted
def inp():
    return(int(input()))


n = inp()
scores = [0]
for i in range(n):
    scores.append(inp())
scores = sorted(scores)
d = 0
for s in scores:
    sm = sum(scores)
    if sm % 10 == 0:
        sm -= s
    if sm % 10 != 0:
        d = sm
        break
print(d)
# Judge status: Accepted
import math


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

print("Yes" if a<=c<=b else "No" )
# Judge status: Accepted
N = int(input())
n = int(N**(1/2))

ans_list = [0]*(N)

for i in range(1,n):
    for j in range(1,n):
        for k in range(1,n):
            index = i**2+j**2+k**2+i*j+j*k+k*i

            if index>N:
                break

            ans_list[index-1] += 1

for i in ans_list:
    print(i)
# Judge status: Accepted
n=int(input())
w=[input() for _ in range(n)]
if len(set(w))!=n:
    print("No")
else:
    ans="Yes"
    for i in range(1,n):
        if w[i][0]!=w[i-1][-1]:
            ans="No"
            break
    print(ans)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
k = a+b+c

if k >= 22:
  print("win")
else:
  print("bust")
# Judge status: Accepted
A=input()
B=input()
C=input()
ListA=list(A)
ListB=list(B)
ListC=list(C)
pile = "a"
res = ""
for i in range(400):
  if pile == "a":
    pile = ListA.pop(0)
  elif pile == "b":
    pile = ListB.pop(0)
  else:
    pile = ListC.pop(0)
  if len(ListA) == 0 and pile == "a":
    res = "A"
    break
  elif len(ListB) == 0 and pile == "b":
    res = "B"
    break
  elif len(ListC) == 0 and pile == "c":
    res = "C"
    break
  else:
    pass
print(res)
# Judge status: Accepted
n=int(input())
A =list(map(int,input().split()))

B =list(map(int,input().split()))
ans = 0
for i in range(n):
    ans = max(sum(A[0:i+1:1])+sum(B[i:n:1]),ans)
print(ans)
# Judge status: Wrong Answer
a=[v for v in input().split()]
u=int(a[0])
for i in range (0,u):
    print(a[1],end='')
# Judge status: Accepted
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))

ans = 1000000
cnt = 0
T = [0 for i in range(n)]

for i in range(n) :
    T[i] = t - h[i]*0.006
    q = abs(a - T[i]) 
    if (q < ans) :
        ans = q
        cnt = i+1
print(cnt)
# Judge status: Wrong Answer
#B問題
D = int(input())
cs = list(map(int, input().split()))
ss = [input().split() for l in range(D)]

for i in range(D):
    print((i+1)%26)
# Judge status: Accepted
def main():
    from collections import Counter
    S = list(input())
    if len(Counter(S))==2:
        print("Yes")
    else:
        print("No")

if __name__=="__main__":
    main()
# Judge status: Wrong Answer
n, k = map(int, input().split())
a = list(map(int, input().split()))
for _ in range(k):
    on = [0 for _ in range(n+1)]
    for i in range(n):
        left = max(i - a[i], 0)
        right = min(i + a[i] + 1, n)
        on[left] += 1
        on[right] -= 1
    for j in range(1, n+1):
        on[j] += on[j-1] 
    if on.count(n) == n:
        break
    a = on[:]
print(*a[:n])
# Judge status: Accepted
p = input().split()

k = int(p[0])
s = int(p[1])

x = -1
y = -1
z = 0
answer = 0

for num in range(k+1):
    x += 1
    y = -1
    for n in range(k+1):
        y += 1
        z = s - x - y
        if 0 <= z and z <= k:
            answer += 1
 



print(answer)
# Judge status: Accepted
n, m = map(int, input().split())
a = []
b = []
for _ in range(n):
    a.append(input())
for _ in range(m):
    b.append(input())
flag = 0
cnt = 0
for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            if a[i+k][j:j+m] == b[k]:
                cnt += 1
        if cnt == m:
            flag = 1
        cnt = 0
if flag == 1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
A,B,C = map(int,input().split())
K = int(input())
for i in range(0,K+1):
    for j in range(0,K+1):
        for h in range(0,K+1):
            if A*(2**i)<B*(2**j)<C*(2**h) and (i+j+h)<=K:
                print("Yes")
                exit()
print("No")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

money = 1000
kabu = 0
p = [1]*N

for i in range(N-1):
  if A[i] < A[i+1]:
    p[i] = 0
  elif A[i] > A[i+1]:
    p[i] = 2

for i in range(N-1):
  if A[i] < A[i+1] and p[i] == 0 and kabu == 0:
    kabu = money//A[i]
    money -= (A[i]*kabu)
  elif A[i] > A[i+1] and p[i] == 2:
    money += (kabu*A[i])
    kabu = 0

money += (A[-1]*kabu)
print(money)
# Judge status: Wrong Answer
s=input()
result=''
count=0
for i in s:
    if result != i:
        result==i
        count+=1
        if count==2:
            print('Yes')
        else:
            print('No')
# Judge status: Wrong Answer
H, W = list(map(int, input().split()))
### 片方だけ奇数のマスには行くことができない
### Hが偶数、Wが偶数の場合 → H*W // 2
### Hが奇数、Wが偶数の場合 → H*W // 2 (Wが奇数の場合も同様)
### Hが奇数、Wが奇数の場合 → H*W // 2 + 1
if H % 2 != 0 and W % 2 != 0:
    print(H * W // 2 + 1)
else:
    print(H * W // 2)
# Judge status: Accepted
x = int(input())
sum = 0
sum += (x // 500) * 1000
x = x - (x // 500) * 500
sum += (x // 5) * 5
print(sum)
# Judge status: Wrong Answer
import math

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

#Process
Ans = -1
tmp08_min = math.ceil(A / 0.08)
tmp08_max = tmp08_min + 13
tmp10_min = math.ceil(B / 0.10)
tmp10_max = tmp10_min + 10

tmp_min = min(tmp08_min, tmp10_min)
tmp_max = max(tmp08_max, tmp10_max)

cnt = 0
while cnt < tmp_max - tmp_min:
    if(A == int((tmp_min + cnt) * 0.08) and B == int((tmp_min + cnt) * 0.10)):
        Ans = tmp10_min + cnt
        break
    cnt += 1

#Output
print(Ans)
# Judge status: Wrong Answer
k,s=map(int,input().split())
p=0
for i in range(k+1):
    for j in range(k+1):
        if s- i - j <= k:
            p += 1
print(p)
# Judge status: Wrong Answer
def coffee_like(s):
    if (s[2] == s[3]) and (s[4] == s[5]):
        return 'Yes'
    else:
        return 'No'
coffee_like(s=input())
# Judge status: Accepted
a, b = map(int, input().split())
ans = 0
for i in range(a, b + 1):
    s = str(i)
    if s[0] == s[-1] and s[1] == s[-2]:
        ans += 1
print(ans)
# Judge status: Wrong Answer
n=int(input())
a=[int(input()) for i in range(n)]
r=[0]*(n+2)
ans=0
for i in range(n):
    if n==1:
        ans+=a[i]//2    
        r[i]=a[i]%2
        continue
    if i==n-1:
        a[i]+=r[i-1]
        ans+=a[i]//2
        continue
    a[i]+=r[i-1]    
    ans+=a[i]//2
    a[i]-=r[i-1]  
    r[i]=a[i]%2
print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-

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

ans=0
while True:
    if a%2==1 or b%2==1 or c%2==1:
        break
    if a==b==c:
        ans=-1
        break
    ans+=1
    na=(b+c)/2
    nb=(c+a)/2
    nc=(a+b)/2
    a=na
    b=nb
    c=nc
print(ans)
# Judge status: Wrong Answer
int_list = [int(input()) for i in range(2)]
if int_list[0] % 500 <= int_list[1]:
    print("yes")
else:
    print("no")
# Judge status: Accepted
x = int(input())
if x==3 or x==5 or x==7:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
import math

N,M = map(int,input().split())
A = list(input().split())
homework=0
for i in range(M):
  homework=homework + int(A[i])
ans=N - homework
if ans < 0:
  print("-1")
else:
  print(ans)