peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
MOD = 10 ** 9
s = int(input())
y = -(-s // MOD)
x = y * MOD - s
print(0, 0, MOD, 1, x, y)
# Judge status: Accepted
x,y = map(int, input().split())

cnt = 0
a = x
while a <= y:
    a += a
    cnt += 1
print(cnt)
# Judge status: Accepted
a, b = map(int, input().split())
print((b - a) * (b - a - 1) // 2 - a)
# Judge status: Accepted
N, M = map(int, input().split())
from math import sqrt

def divisor(num):
    max_num = int(sqrt(num))
    divisor_list = []
    for i in range(1, max_num + 1):
        if num % i == 0:
            divisor_list.append(i)
            divisor_list.append(num//i)
    return divisor_list

g_list = divisor(M)
g_list.sort(reverse=True)
ans = 0
for g in g_list:
    if M//g >= N:
        ans = g
        break
print(ans)
# Judge status: Accepted
a = sorted(map(int, input().split()))
b, c = a[2] - a[1], a[2] - a[0]

あ = b // 2 + c // 2
ばいく = b % 2 + c % 2
if ばいく == 1:
    あ += 2
elif ばいく == 2:
    あ += 1
print(あ)
# Judge status: Accepted
X = int(input())
X_ = X % 100
N = int(X / 100)
ans = 0
for i in range(5):
    X_ -= N

if X_ > 0:
    print(0)
else:
    print(1)
# Judge status: Wrong Answer
import math

def process_smaller_index(K, min_index):
    if min_index == 0:
        return 0
    else:
        return math.ceil(min_index / K)

def process_larger_index(last_index, K, min_index):
    if min_index == last_index:
        return 0
    else:
        return math.ceil((last_index - min_index) / K)

N, K = map(int, input().split())
A = [int(i) for i in input().split()]
min_index = A.index(1)
print(process_smaller_index(K - 1, min_index) + process_larger_index(len(A)-1, K - 1, min_index))
# Judge status: Accepted
S=input()
print("Heisei" if S<="2019/04/30" else "TBD")
# Judge status: Accepted
import collections

N = int(input())

height = input()
height = height.split()
height = [int(s) for s in height]

count = 0


d = dict(collections.Counter([i + height[i] for i in range(N)]))
ans = sum([d.get(i - height[i], 0) for i in range(N)])
print(ans)
# Judge status: Accepted
n = int(input())
s = []
for i in range(n):
    s.append(int(input()))
s.sort()
m = sum(s)
if m % 10 != 0:
    print(m)
else:
    for i in range(n):
        if (m-s[i]) % 10 != 0:
            print(m-s[i])
            break
    else:
        print(0)
# Judge status: Accepted
def mincost(n, k, A):
    dp = [0] * n
    for i in range(1, n):
        dp[i] = float('inf')
        for j in range(i - 1, i - k - 1, -1):
            if j >= 0:
                dp[i] = min(dp[i], dp[j] + abs(A[j] - A[i]))
    return dp[n - 1]
 
 
if __name__ == '__main__':
    n, k = list(map(int, input().split()))
    A = list(map(int, input().split()))
    res = mincost(n, k, A)
    print(res)
# Judge status: Accepted
n = int(input())
L = [0] * n
m = float('inf')
for i in range(n):
    L[i] = int(input())
    if L[i] % 10 != 0:
        m = min(m, L[i])
ans = sum(L)
if ans % 10 == 0:
    ans -= m
    if ans < 0:
        print(0)
        exit()
print(ans)
# Judge status: Accepted
N = int(input())

def gcd(p, q):
  if p % q == 0:
    return q
  return gcd(q, p % q)

ans = 0
for x in range(1,N+1):
  for y in range(1,N+1):
    for z in range(1,N+1):
      ans += gcd(gcd(x, y), z)
print(ans)
# Judge status: Accepted
S = input()
num = 753
ans = 999

for i in range(len(S) - 2):
	cur = int(S[i:i + 3])
	if (abs(num - cur) < ans):
		ans = abs(num - cur)
print(ans)
# Judge status: Accepted
s = input()

print("Yes" if len(set(s))==3 else "No")
# Judge status: Accepted
def main():
    s = input()
    a = s.count('0')
    b = s.count('1')
    print(len(s) - abs(a - b))       

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import math
import fractions
import sys
import itertools
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))


N=input1()
A=input_array()
xor=0
for i in range(N-1):
	for j in range(i+1,N):
		xor+=int(bin(A[i]^A[j]),2)

print(xor % (10**9-7))
# Judge status: Wrong Answer
if input()=='30':print('Yes')
else:print('No')
# Judge status: Wrong Answer
A,B,K=map(int,input().split())
if B-A !=0:
    K=min(K,B-A)
ans=set()
for i in range(K):
    ans.add(A+i)
    ans.add(B-i)
ans=list(ans)
ans=sorted(ans)
for i in ans:
    print(i)
# Judge status: Accepted
S = list(input())

odd = ["R", "U", "D"]
even = ["L", "U", "D"]
ans = "Yes"

for i, s in enumerate(S):
  if i%2==0 and s not in odd:
    ans = "No"
    break
  elif i%2==1 and s not in even:
    ans = "No"
    break

print(ans)
# Judge status: Accepted
n,m,x,y = map(int, input().split())
*xl, = map(int, input().split())
*yl, = map(int, input().split())
for i in range(x,y+1):
    if x<i<=y and max(xl)<i<=min(yl):
        print("No War")
        exit()
print("War")
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
a = sum(l)//n
b = a+1
s = 0
m = 0
for i in l:
  s += (i-a)**2
for j in l:
  m += (j-b)**2
print(min(s,m))
# Judge status: Accepted
N = int(input())
ans = 0
for n in range(1,N+1):
    max_n = N//n*n
    min_n = n
    cnt = (max_n-min_n)//n + 1
    temp = (max_n + min_n) * cnt // 2
    ans += temp
print(ans)
# Judge status: Wrong Answer
n=input()
l=len(n)-1
s=[n[0]]
for i in range(2**l):
    x=['-']*l
    for j in range(l):
          if ((i >> j) & 1):
              x[l - 1 - j]='+'
    for i in range(l):
        s.append(x[i])
        s.append(n[i+1])
    if eval(''.join(s))==7:
        s+='=7'
        print(''.join(s))
    s=[n[0]]
# Judge status: Wrong Answer
import math
n=int(input())
x=[]
for i in range(5):
  x.append(int(input()))
if n==min(x):
  print(5)
else:
  print(5+math.ceil(n/min(x)))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
res = 10 ** 100
for i in range(1, n):
    res = min(res, abs(sum(a[:i]) - sum(a[i:])))
print(res)
# Judge status: Wrong Answer
a,b=input().split()
a=int(a)
b=int(b)
if a%b==0:
  print(a/b)
else:
  print(int(a/b+1))
# Judge status: Accepted
import numpy as np
from numba import njit


@njit
def solve(N):
    ans = 0
    for i in range(1, N + 1):
        ans += (i + i * (N // i)) * (N // i) // 2
    return ans


N = int(input())
print(solve(N))
# Judge status: Accepted
S= list(input())
T= list(input())
count=0
for i in range(len(S)):
    if S[i]!=T[i]:
        count=count+1
print(count)
# Judge status: Accepted
k,x = map(int, input().split())

a = []

for i in range(1,2*k):
    a.append(x-k+i)



print(*a)
# Judge status: Accepted
n = input()
if n[len(n)-1] == "s":
  print(n+"es")
else:
  print(n+"s")
# Judge status: Accepted
N=int(input())
L=[list(map(int,input().split())) for _ in range(N)]
L.sort(key=lambda x:x[1])
t=0
p=True
for l in L:
  t+=l[0]
  if t > l[1]:
    p=False
    break
print("Yes" if p else "No")
# Judge status: Wrong Answer
N = int(input())
two_list = [1, 2, 4, 8, 16,32,64]
for two in two_list:
  if N > two:
  	if two == 64:
          print("64")
  else:
    print(two)
    exit()
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
A=sorted(A)
i=len(A)
i//=2
print(sum(A[-i-1:-1])*2+A[-1])
# Judge status: Wrong Answer
n = int(input())

if n % 15 == 0:
    print(int(n * 800 - (n/15) * 200))
elif n >= 15 and n % 15 != 0:
    print(n * 800 - int((n/15)*200))
# Judge status: Wrong Answer
a,b,x=map(int,input().split())
ta=(a-1)//x
tb=b//x
ans=tb-ta+1
print(ans)
# Judge status: Accepted
import sys
N = int(input())
A = [int(c) for c in input().split()]
B = [0]*(N+1)
B[0] = 1
if A[0]>=1:
  if N==0 and A[0]==1:
    print(1)
  else:
    print(-1)
  sys.exit()
for i in range(1,N+1):
  B[i] = B[i-1]*2-A[i]
  if B[i]<0:
    print(-1)
    sys.exit()
ans = sum(A)
num = 0
for i in range(N,0,-1):
  num = min(num+A[i],B[i-1])
  ans += num
print(ans)
# Judge status: Accepted
import math
# b=input()
# c=[]
# for i in range(b):
#     c.append(a[i])
a = list(map(int,input().split()))
#b = list(map(int,input().split()))
s=int(input())

for i in range(s):
	a[a.index(max(a))]=	a[a.index(max(a))]*2
	
print(sum(a))
# Judge status: Wrong Answer
x=input();print(len(x)-2*min(map(x.lstrip("T").rstrip("S").count,"ST")))
# Judge status: Accepted
n=int(input())
a = list(map(int,input().split()))
i=0
b=0
while i<=n:
    b+=a[i]
    i+=1
i=0
x=1
ans=0
while i<=n:
    if a[i] <=x:
        if x<=b:
            ans+=x
            x=(x-a[i])*2
        else:
            ans+=b
            x = b
        b-=a[i]
    else:
        ans=-1
        break
    i+=1
print(ans)
# Judge status: Wrong Answer
N = int(input())
S = list(input())
cumsum = [0]*N
if S[0] == 'E':
    cumsum[0] += 1
for i in range(1, N):
    if S[i] == 'E':
        cumsum[i] += cumsum[i-1] + 1
    else:
        cumsum[i] += cumsum[i-1]

ans = float('inf')
ans = min(ans, cumsum[-1]-cumsum[0])

for i in range(1, N):
    tmp = (i) - (cumsum[i-1] - cumsum[0])
    tmp += (cumsum[-1]-cumsum[i])
    ans = min(ans, tmp)
print(ans)
# Judge status: Wrong Answer
N,D=input().split()
N=int(N)
D=int(D)
cnt = 0
for i in range(N):
    
    p1,p2 = map(int,input().split())
    t = ((p1*p1)+(p2*p2))**(0.5)
    if t >= D:
        cnt += 1
    
print(cnt)
# Judge status: Accepted
N = int (input())

max = 0
ans = 1

for i in range(1, N+1):
    count = 0
    a = i
    while True:
        if a % 2 == 1:
            if max < count:
                max = count
                ans = i
        else:  
            a = int(a / 2)
            count += 1
            continue
        break

print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
if a>0:
    print("Positive")
elif a<0 and b>0:
    print("Zero")
else:
    if a%2 ==b%2:
        print("Negative")
    else:
        print("Positive")
# Judge status: Accepted
s = input()
t = input()

def match(i):
  for j in range(len(t)):
    if not s[i+j] == '?' and s[i+j] != t[j]:
      return False
  return True

for i in range(len(s) - len(t), -1, -1):
  if not match(i):
    continue

  for j in range(i):
    print('a' if s[j] == '?' else s[j], end='')
  print(t, end='')
  for j in range(i+len(t), len(s)):
    print('a' if s[j] == '?' else s[j], end='')
  print()
  exit()
    
print('UNRESTORABLE')
# Judge status: Accepted
N,K=map(int, input().split())
P=list(map(int, input().split()))

Q=sorted(P)
ans=0
for i in range(K):
  ans+=Q[i]
print(ans)
# Judge status: Accepted
s=input()
char=["A","C","G","T"]
ans=0
cnt=0
for i in range(len(s)):
    if s[i] in char:
        cnt+=1
    else:
        ans=max(ans,cnt)
        cnt=0
ans=max(ans,cnt)
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
D = input().split()
i = 0
while i < 1:
  i = 1
  for n in str(N):
    if n in D:
      i = 0
  N += 1
print(N - 1)
# Judge status: Accepted
a,b,x=list(map(int,input().split()))
import math
import sys
if a*a*b==x:
  print(0.0000000000)
  sys.exit()

if a*a*b/2<=x:
  kakudo=a*a*a/2/(a*a*b-x)
  print(90-math.degrees(math.atan(kakudo)))
else:
  kakudo=2*x/(a*b*b)
  print(90-math.degrees(math.atan(kakudo)))
# Judge status: Accepted
A, B = map(int, input().split())

print(A*B)
# Judge status: Accepted
import collections
import heapq

n, m = map(int, input().split())
que = []
for _ in range(n):
    a, b = map(int, input().split())
    que.append((-b, a))
que.sort(key=lambda x: x[1])
que = collections.deque(que)
h = []
heapq.heapify(h)
ans = 0
for i in range(1, m + 1):
    while len(que) != 0 and que[0][1] <= i:
        tmp = que.popleft()
        heapq.heappush(h, tmp)
    if len(h) == 0: continue
    tmp = heapq.heappop(h)
    ans -= tmp[0]
print(ans)
# Judge status: Accepted
N, M = map (int, input().split())

c=(N*(N-1)+M*(M-1))//2

print(c)
# Judge status: Wrong Answer
# https://atcoder.jp/contests/abc179/tasks/abc179_b
t = int(input())
count = 0
pre = 0
test = ''
for i in range(t):
    a, b = map(int, input().split())
    if (a == b):
        test = 'Yes'
        pre = 1
    else:
        pre = 0
        test = 'No'
    if test == 'Yes' and (pre == 1):
        count += 1
        test = 'Yes'
        pre = 1
if (count == 3) or (count == 6):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
S = input()
zero,one = 0,0
for s in S:
  if s=='0':
    zero += 1
  else:
    if zero>0:
      one += 1
print(min(one,zero)*2)
# Judge status: Accepted
import numpy as np

def ABC133C(l, r):
    Min = np.inf
    for i in range(l, r):
        for j in range(i+1, r+1):
            a = (i * j) % 2019
            if a < Min:
                Min = a
                if a == 0: # ここに注目
                    print(Min)
                    return
    print(Min)

l, r = map(int, input().split())
ABC133C(l, r)
# Judge status: Accepted
r,g,b = map(str,input().split())
a = r+g+b
a=int(a)
if a%4 ==0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
# coding: utf-8
import sys

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

S, W = lr()
bl = W >= S
print('unsafe' if bl else 'safe')
# Judge status: Accepted
n=int(input())
s = list(input())
wd = list("abcdefghijklmnopqrstuvwxyz")
ans=0
for i in range(n):
  s1 = set(s[:i])
  s2=set(s[i:])
  tmp=0
  for w in wd:
    if w in s1 and w in s2:
      tmp+=1
  ans=max(ans,tmp)
print(ans)
# Judge status: Accepted
s=input()
s_set=set(list(s))
if len(s) == len(s_set):
    print("yes")
else:
    print("no")
# Judge status: Accepted
X,Y,Z = map(int, input().split())
print((X-Z) // (Y+Z))
# Judge status: Accepted
S = input()
K = int(input())
t = -1
for k in range(len(S)):
    t = k
    if S[k] != "1":
        break
if K <= t:
    print(1)
else:
    print(S[t])
# Judge status: Accepted
s=list(input())
N=len(s)
K=int(input())
num=123

for i in range(N):
    diff=(num-ord(s[i]))%26
    if K==0:
        break
    if diff<=K:
        s[i]="a"
        K=K-diff
#print(s)
#print(K)
if K>0:
    K=K%26
    s[N-1]=chr(ord(s[N-1])+K)
#print(s)
print("".join(s))
# Judge status: Accepted
import statistics

N = int(input())
AB = [map(int, input().split()) for _ in range(N)]
A, B = [list(i) for i in zip(*AB)]


A_median = statistics.median(A)
B_median = statistics.median(B)
if N%2==0:
    print(int((B_median-A_median)*2)+1)
else:
    print(B_median-A_median+1)
# Judge status: Accepted
S = input()
K = int(input())

for i in range(K):
  if int(S[i]) != 1:
    print(S[i])
    exit()
print(1)
# Judge status: Accepted
n,k=map(int,input().split())
print(min(n%k,abs(n%k-k)))
# Judge status: Accepted
from math import gcd
n,x=map(int,input().split())
lst=list(map(int,input().split()))

for i in range(n):
    lst[i]=abs(x-lst[i])

a=lst[0]
for i in range(1,n):
    a=gcd(a,lst[i])

print(a)
# Judge status: Accepted
w,h,x,y = map(int,input().split())


if x==w/2 and y==h/2:
    print(w*h/2,1)
else:
    print(w*h/2,0)
# Judge status: Accepted
l,r=map(int,input().split())
if r-l>=2019:
    ans=0
else:
    ans=2018
    l=l%2019
    r=r%2019
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans=min(ans,i*j%2019)
print(ans)
# Judge status: Accepted
abc = list(map(int,input().split()))
abc.sort()
if abc[0]+abc[1] == abc[2]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N, M, K = map(int, input().split())
ans = "No"
for h in range(0, N+1, 1):
    for w in range(0, M+1, 1):
        tmp = h * M + w * N - 2*h*w
        if tmp == K:
            ans = "Yes"
            print(ans)
            exit()
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

c = 0
f = 0
for i in range(N):
    if A[i] < 0:
        c += 1
    elif A[i] == 0:
        f = 1
    A[i] = abs(A[i])
    
if f == 1 or c % 2 == 0:
    ans = sum(A)
else:
    ans = sum(A) - 2 * min(A)
    
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

# B - Box and Ball
N, M = map(int, input().split())

boxes = [1] * (N + 1)
boxes[0] = 0

ball_exists = set()
ball_exists.add(1)

for i in range(M):
  x, y = map(int, input().split())

  boxes[x] -= 1
  boxes[y] += 1
  
  if x in ball_exists:
    if boxes[x] == 0:
      ball_exists.remove(x)

      if len(ball_exists) == 1 and y in ball_exists:
        ball_exists.clear()

    ball_exists.add(y)

  #print(boxes)
  #print(ball_exists)

print(len(ball_exists))
# Judge status: Accepted
h,n = map(int,input().split())
dp = [0]+[1000000000 for _ in range(h)]
for i in range(n):
    ai,bi = map(int,input().split())
    for j in range(h):
        dp[min(j+ai,h)] = min(dp[min(j+ai,h)],dp[j]+bi)
print(dp[h])
# Judge status: Accepted
a,b,x = map(int,input().split())
import math
if a**2*b / 2 <=  x:
    alpha = math.degrees(math.atan(2 * (a**2 * b - x) / a**3))
else:
    alpha =  math.degrees(math.atan(a*b**2 / (2*x) ))
    
print(alpha)
# Judge status: Accepted
a,b,c = map(int, input().split())
print("Yes" if a+b == c or a+c == b or b+c == a else "No")
# Judge status: Accepted
from collections import deque

X, Y, A, B, C = [int(x) for x in input().split()]
p = sorted([int(x) for x in input().split()], reverse=True)[:X]
q = sorted([int(x) for x in input().split()], reverse=True)[:Y]
pq = deque(sorted(p + q, reverse=True))
r = deque(sorted([int(x) for x in input().split()]))

ans = sum(pq)

for i in range(len(r)):
    if r[-1] > pq[-1]:
        ans += r.pop() - pq.pop()

print(ans)
# Judge status: Wrong Answer
N=int(input())
for i in range(8):
  if N<i**2:
    print((i-1)**2)
    exit()
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
if a == b and a == c and b == c:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
o = list(input())
e = list(input())
i = 0
ans = ""
while i < len(e):
  ans += o[i]+e[i]
  i += 1
if len(o) > len(e):
  ans += o[len(o)-1]
print(ans)
# Judge status: Accepted
N, A, B = map(int, input().split())


distance =(B - A - 1 )//2
if( (A % 2 == 0 and B % 2 ==0) or (A%2==1 and B%2==1)):
    ans=(B - A)//2
else:
    ans = min(A-1,N - B) + 1 + distance

print(ans)
# Judge status: Accepted
A,B,C=map(int,input().split())
D=[A,B,C]
a=0
K=int(input())
a+=(max(D)*(2**K))
D.remove(max(D))
for i in range(2):
    a+=D[i]
print(a)
# Judge status: Accepted
a,b,c,k=map(int,input().split())
if abs(a-b)>10**18:
    print("unfair")
else:
    if k%2==0:
        print(a-b)
    else:
        print(b-a)
# Judge status: Accepted
import math
A,B,H,M = map(int,input().split( ))
pi = 2*math.pi
time = H*60. + M
theta_A = (time/720.)*pi
theta_B = (M/60.)*pi
theta = abs(theta_A - theta_B)
if theta >= 180:
    theta = pi - theta
C = A**2 + B**2 - 2*A*B*math.cos(theta)
print(math.sqrt(C))
# Judge status: Accepted
w = list(input())
w.sort()
i = 0
if len(w) % 2 == 1:
    print('No')
    exit()

while i < len(w)-1:
	if w[i] != w[i+1]:
		print('No')
		exit()
	i += 2
else:
	print('Yes')
# Judge status: Accepted
a, b = map(str, input().split())

num1 = a * int(b)
num2 = b * int(a)
print(min(num1, num2))
# Judge status: Accepted
n,x,t = map(int,input().split())
if n%x == 0:
  print(int(t*n/x))
else:
  print(int(t*(n//x + 1)))
# Judge status: Accepted
X = int(input())
for A in range(-198,200):
    for B in range(-119,119):
        if pow(A,5) - pow(B,5) == X:
            print('{} {}'.format(A,B))
            exit()
# Judge status: Wrong Answer
a = [0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
x, y = map(int, input().split())
x -= 1
y -= 1
if a[x] == a[y]:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
a,b,c = map(int,input().split())
ans = max(a,b,c)*3-a-b-c
if ans%2 == 0:
    print(ans//2)
else:
    print(ans//2+2)
# Judge status: Accepted
from bisect import bisect_left
N = int(input())
memo = [-1]*N
for _ in range(N):
    a = int(input())
    idx = bisect_left(memo,a)-1
    memo[idx] = a

print(N-memo.count(-1))
# Judge status: Accepted
import sys
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

A, B, C = rl()

if len(set([A,B,C])) == 2:
	print('Yes')
else:
	print('No')
# Judge status: Accepted
X = int(input())
print((X//500)*1000+((X%500)//5)*5)
# Judge status: Accepted
#138A

#1.入力をちゃんと受け取ること
x=input()
a=int(x)
s=input()
#2.結果を出力する

if a>=3200 :
    print(s)
else:
    print('red')
# Judge status: Accepted
s = input()
ans = 'Yes'
for c in s:
    if s.count(c) != 2:
        ans = 'No'
        break
print(ans)
# Judge status: Accepted
K,X=map(int,input().split())
print(*range(X-K+1,X+K))
# Judge status: Accepted
# 点(x, y)から長方形の中心を通る直線を引くと面積を半分にすることができ、分割された小さい方の面積が最大となる
# 点(x, y)が長方形の中心と一致する場合、直線は複数存在する

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

s = w * h
s_min = s / 2

# 中心
a = w / 2
b = h / 2

divide = 0

if x == a and y == b:
    divide = 1
    print(s_min, divide)
else:
    print(s_min, divide)
# Judge status: Accepted
n=int(input())
ar=list(map(int,input().split()))
c=1000
for i in range(n-1):
    if ar[i+1]>ar[i]:
        cur=c//ar[i]
        c%=ar[i]
        c+=ar[i+1]*cur
##        print(i,cur,c)
print(c)
# Judge status: Accepted
H,N = map(int, input().split())
A = list(map(int, input().split()))

if H <= sum(A):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
A,B,C = map(int,input().split())
print(C-A+B)
# Judge status: Wrong Answer
import heapq
N,K = map(int,input().split())
p = list(map(int,input().split()))
sum(heapq.nsmallest(K,p))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

a.sort()
a.reverse()

ret = []
my_s = set()

for item in a:
    if item in my_s:
        ret.append(item)
        if len(ret) == 2:
            print(ret[0] * ret[1])
            exit()
        my_s.remove(item)
    else:
        my_s.add(item)

print(0)
# Judge status: Accepted
N, K = map(int, input().split())
ans = 0
for i in range(K,N+2):
    ans += N*i -i**2 +i +1
print(ans%(10**9 + 7))
# Judge status: Accepted


if __name__ == '__main__':
    N,M=list(map(int,input().split()))
    roads=[0 for i in range(N)]
    for i in range(M):
        a,b=list(map(int,input().split()))
        roads[a-1]+=1
        roads[b-1]+=1

    for road in roads:
        print(road)
# Judge status: Wrong Answer
N,M=map(int,input().split())
if N%2==1:
  for i in range(M):
    print(i+1,N-i)
else:
  middle=int((M+1)/2)
  for i in range(middle):
    print(i+1,middle-i)
  for j in range(middle,M):
    print(j,N+middle-j)
# Judge status: Accepted
N = int(input())
steps = list(map(int, input().split()))
costs = [0]*(N+1)
for i in range(1, N):
  if i==1:
    costs[1] = abs(steps[1]-steps[0])
    continue
  a = costs[i-1]+abs(steps[i]-steps[i-1])
  b = costs[i-2]+abs(steps[i]-steps[i-2])
  costs[i] = min(a, b)
print(costs[N-1])
# Judge status: Accepted
n, m = list(map(int, input().split()))
a = []
for _ in range(m):
    a.append(int(input()))
a = set(a)
cur = 0
dp = [0 for _ in range(n + 1)]
dp[0], dp[1] = 1, 1
if 1 in a:
    dp[1] = 0
for i in range(2, n + 1):
    if i in a:
        continue
    dp[i] = (dp[i - 1] + dp[i - 2]) % (10 ** 9 + 7)
print(dp[n])
# Judge status: Accepted
import math
n = int(input())
abc = sorted([int(input()) for _ in range(5)])
print(4+math.ceil(n/abc[0]))
# Judge status: Accepted
n = int(input())
li = list(map(int,input().split()))
lia = [li[0]]
li.append(100001)
for i in range(n-1):
    lia.append(min(li[i],li[i+1]))
print(sum(lia))
# Judge status: Accepted
x,y = map(int,input().split())
mod = 10**9+7
def comb(N,x):
    numerator = 1
    for i in range(N-x+1,N+1):
        numerator = numerator * i % mod
    denominator = 1
    for j in range(1,x+1):
        denominator = denominator * j % mod
    d = pow(denominator,mod-2,mod)
    return numerator * d % mod

if (x+y) % 3 == 0:
    a = (2*y-x) //3
    b = (2*x-y) //3

    if a >= 0 and b >= 0:
        print(comb(a+b,a))
        exit()
print(0)
# Judge status: Wrong Answer
n = int(input())
print("ABC{0:03d}".format(n) if n<1000 else "ABD{0:03d}".format(n-999))
# Judge status: Wrong Answer
#C - Attention
N = int(input())
S = input()
DP_w= []
DP_e = []
tmp = 0
tmpw = 0
tmpe = 0
ans = 0
# for i in range(N):
#     if S[i] == "W":
#         tmpw += 1
#         DP_w.append(tmpw)
#         DP_e.append(tmpe)
#     else:
#         tmpe += 1
#         DP_w.append(tmpw)
#         DP_e.append(tmpe)

for i in range(N):
    tmpw = S[:i].count('W')
    tmpe = S[i:].count('E')
    ans = max(ans,tmpw+tmpw)

print(ans)
# Judge status: Accepted
h1, m1, h2, m2, k = map(int, input().split())
print((h2 - h1) * 60 + (m2 - m1) - k)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

print("Yes" if b-a >=c else "No")
# Judge status: Accepted
print(sum(map(int,input().split()))%24)