Harryxun/stf_run huggingface dataset:
w,h,n=map(int,input().split())
x1=0
x2=w
y1=0
y2=h
for i in range(n):
  x,y,a=map(int,input().split())
  if a==1:
    x1=max(x1,x)
  if a==2:
    x2=min(x2,x)
  if a==3:
    y1=max(y1,y)
  if a==4:
    y2=min(y2,y)
if x2<x1 or y2<y1
  print(0)
else:
  print((x2-x1)*(y2-y1))


### FIXED CODE ###

w,h,n=map(int,input().split())
x1=0
x2=w
y1=0
y2=h
for i in range(n):
  x,y,a=map(int,input().split())
  if a==1:
    x1=max(x1,x)
  if a==2:
    x2=min(x2,x)
  if a==3:
    y1=max(y1,y)
  if a==4:
    y2=min(y2,y)
if x2<x1 or y2<y1:
  print(0)
else:
  print((x2-x1)*(y2-y1))
a,b,c = map(int, input.split())
if a < b <c:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

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

result = "Yes" if a<b<c else "No"
print(result)
import sympy
url = "https://atcoder.jp//contests/abc057/tasks/abc057_c"

def main():
    n = int(input())
    ans = 10000000000000000
    ns = sympy.divisors(n)
    for i in range(0, (len(ns)//2) + 1):
        tmp = max(len(str(ns[i])), len(str(ns[len(ns)-i-1])))
        ans = tmp if tmp < ans else ans
    if len(ns) % 2 != 0:
            tmp = len(str(ns[len(ns) // 2]))
            ans = tmp if tmp < ans else ans
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###


url = "https://atcoder.jp//contests/abc057/tasks/abc057_c"
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def main():
    n = int(input())
    ans = 10000000000000000
    ns = make_divisors(n)
    for i in range(0, (len(ns)//2) + 1):
        tmp = max(len(str(ns[i])), len(str(ns[len(ns)-i-1])))
        ans = tmp if tmp < ans else ans
    if len(ns) % 2 != 0:
            tmp = len(str(ns[len(ns) // 2]))
            ans = tmp if tmp < ans else ans
    print(ans)

if __name__ == '__main__':
    main()
n = int(input())
for s in range(1,10) :
    if n <= s*1000 :
       x = s*1000 - n 
       break
print(x)

### FIXED CODE ###

n = int(input())
 
if n % 1000 == 0 :
    a = n / 1000
else :
    a = int(n / 1000 + 1)
 
b = a * 1000
answer = int(b - n)
 
print(answer)
0 75 25 100

### FIXED CODE ###

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

length = 0

if b <= c or d <= a:
    length = 0
elif b <= d and c <= d and a <= c:
    length = b - c
elif d <= b and a <= d and c <= a:
    length = d -a
elif b <= d and c <= a:
    length = b - a
elif d <= b and a <= c:
    length = d - c

print (length)
length0 = input()
#print(length0)
length = length0.split()
a = int(length[0])
b = int(length[1])
print(str(a)+" "+str(b))
#area = a*b
#per = 2*a+2*b
#print(str(area)+" "+str(per))


### FIXED CODE ###

length0 = input()
#print(length0)
length = length0.split()
a = int(length[0])
b = int(length[1])
#print(str(a)+" "+str(b))
area = a*b
per = 2*a+2*b
print(str(area)+" "+str(per))
import sys
sys.setrecursionlimit(10**6)

H = 0
W = 0


def search(h, w, table, cnt):
    global H, W

    move = [(-1, 0), (1, 0), (0, -1), (0, 1)]

    for k in range(len(move)):
        i, j = move[k]
        if h+i < 0 or w+j < 0 or h+i >= H or w+j >= W:
            continue
        if table[h+i][w+j] == '.':
            table[h+i][w+j] = cnt
            search(h+i, w+j, table, cnt)
        elif table[h+i][w+j] != '#' and table[h+i][w+j] > cnt:
            table[h+i][w+j] = cnt
            search(h+i, w+j, table, cnt)

    for i in range(-2, 3):
        for j in range(-2, 3):
            if h+i < 0 or w+j < 0 or h+i >= H or w+j >= W or(i == 0 and j == 0):
                continue
            if table[h+i][w+j] == '.':
                table[h+i][w+j] = cnt+1
                search(h+i, w+j, table, cnt+1)
            elif table[h+i][w+j] != '#' and table[h+i][w+j] > cnt+1:
                table[h+i][w+j] = cnt+1
                search(h+i, w+j, table, cnt+1)


def main(input, print):
    global H, W
    H, W = map(int, input().split())
    Ch, Cw = map(int, input().split())
    Dh, Dw = map(int, input().split())
    table = [[] for _ in range(W)]
    for i in range(H):
        table[i] = list(input().strip())
    search(Ch-1, Cw-1, table, 0)
    if(table[Dh-1][Dw-1] == '.'):
        print(-1)
    else:
        print(table[Dh-1][Dw-1])


if __name__ == '__main__':
    main(sys.stdin.readline, print)


### FIXED CODE ###

import sys
from collections import deque
sys.setrecursionlimit(10**6)


def main(input, print):
    move = [(-1, 0), (1, 0), (0, -1), (0, 1)]
    move2 = [(-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2),
             (-1, -2), (-1, -1), (-1, 1), (-1, 2),
             (0, -2), (0, 2),
             (1, -2), (1, -1), (1, 1), (1, 2),
             (2, -2), (2, -1), (2, 0), (2, 1), (2, 2)]

    H, W = map(int, input().split())
    Ch, Cw = map(int, input().split())
    Dh, Dw = map(int, input().split())
    table = [input() for _ in range(H)]
    path = [[-1 for _ in range(W)] for _ in range(H)]

    que = deque()
    path[Ch-1][Cw-1] = 0
    que.append((Ch-1, Cw-1))
    while que:
        y, x = que.popleft()
        cnt = path[y][x]

        for k in range(len(move)):
            i, j = move[k]
            nx = x+i
            ny = y+j
            if ny < 0 or nx < 0 or ny >= H or nx >= W:
                continue
            if table[ny][nx] == '#':
                continue
            if path[ny][nx] == -1 or path[ny][nx] > cnt:
                path[ny][nx] = cnt
                que.appendleft((ny, nx))

        for k in range(len(move2)):
            i, j = move2[k]
            nx = x+i
            ny = y+j
            if ny < 0 or nx < 0 or ny >= H or nx >= W:
                continue
            if table[ny][nx] == '#':
                continue
            if path[ny][nx] == -1 or path[ny][nx] > cnt+1:
                path[ny][nx] = cnt+1
                que.append((ny, nx))
    if(path[Dh-1][Dw-1] == -1):
        print(-1)
    else:
        print(path[Dh-1][Dw-1])


if __name__ == '__main__':
    main(sys.stdin.readline, print)
from fractions import gcd
A,B,C,D = map(int, input().split())

A =A-1
CD = int(C * D / gcd(C, D))
num_A_C = int(A / C)
num_A_D = int(A / D)
num_A_CD = int(A / CD)
num_B_C = int(B / C)
num_B_D = int(B / D)
num_B_CD = int(B / CD)

num_C =num_B_C - num_A_C
num_D =num_B_D - num_A_D
num_CD =num_B_CD - num_A_CD

ans = B - A -num_C - num_D + num_CD
print(ans)

### FIXED CODE ###

s = input()
flag = False
for i in range(len(s)-1):
    if int(s[i]) == int(s[i+1]):
        flag = True

if flag:
    print('Bad')
else:
    print('Good')
import math
if __name__ == "__main__":
    r = int(input())
    equivalent_of_circle = math.pi*(r**2)
    len_of_circle = math.pi*r*2
    print("%0.6f %0.6f"%(equivalent_of_circle,len_of_circle))

### FIXED CODE ###

import math
if __name__ == "__main__":
    r = float(input())
    equivalent_of_circle = math.pi*(r**2)
    len_of_circle = math.pi*r*2
    print("%0.6f %0.6f"%(equivalent_of_circle,len_of_circle))
# - coding : utf-8 -*-
import numpy as np

n, m = input().split()
xs_str = input().split()

xs = list(map(int, xs_str))
xs.sort()
 
ys = []
for x1, x2 in zip(xs[0:-1], xs[1:]):
    ys.append(abs(x2 - x1))
for i in range(1, int(n)):
    ys.remove(max(ys))

out = sum(ys)
print(out)

### FIXED CODE ###

# - coding : utf-8 -*-
 
n, m = list(map(int, input().split()))
xs_str = input().split()
xs = list(map(int, xs_str))
xs.sort()
 
ys = []
for x1, x2 in zip(xs[0:-1], xs[1:]):
    ys.append(abs(x2 - x1))
ys.sort()

for i in range(n - 1):
    if ys == []:
        break
    else:
        ys.pop()
print(sum(ys))
from sys import stdin


def spam(x, AB, per):
    min_ = x
    max_ = x
    while True:
        min_ -= 1
        tmp = int(min_ * per)
        if AB != tmp:
            min_ += 1
            break
    while True:
        max_ += 1
        tmp = int(max_ * per)
        if AB != tmp:
            max_ -= 1
            break
    return min_, max_


def main():
    A, B = [int(x) for x in stdin.readline().rstrip().split()]
    x = spam(int(A / 0.08), A, 0.08)
    y = spam(int(B / 0.1), B, 0.1)
    if int(x[0] * 0.08) != A:
        a
    if int(x[1] * 0.08) != A:
        a
    if int(y[0] * 0.1) != B:
        a
    if int(y[1] * 0.1) != B:
        a

    if x[0] <= y[0] <= x[1]:
        print(y[0])
    elif y[0] <= x[0] <= y[1]:
        print(x[0])
    else:
        print(-1)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import stdin


def main():
    A, B = [int(x) for x in stdin.readline().rstrip().split()]
    result = 1
    while True:
        a = int(result * 0.08)
        b = int(result * 0.1)
        if a == A and b == B:
            print(result)
            break
        if A < a and B < b:
            print(-1)
            break
        result += 1


if __name__ == "__main__":
    main()
import math


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

    MAX = int(math.pow(10 ** 10, 1 / 5))

    for b in range(0, MAX + 1):
        a = math.pow(abs(b ** 5 + X), 1 / 5)
        # print(f'b={b} a={a}')
        if a == int(a):
            print(int(a), b)
            return

        a = math.pow(abs(b ** 5 - X), 1 / 5)
        # print(f'b={-b} a={a}')
        if a == int(a):
            print(-int(a), b)
            return

    raise ValueError()


if __name__ == '__main__':
    main()


### FIXED CODE ###

import math


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

    MAX = 10 ** 9

    for b in range(0, MAX + 1):
        # b = 1,2,3...
        a = math.pow(abs(b ** 5 + X), 1 / 5)
        # print(f'b={b} a={a}')
        # print(f'b={b} a={a}')
        if round(a) ** 5 == abs(b ** 5 + X):
            if b ** 5 + X > 0:
                print(int(a), b)
                return
            else:
                print(-int(a), b)
                return

        # b = -1, -2, -3
        a = math.pow(abs(- b ** 5 + X), 1 / 5)
        # print(f'b={-b} a={a}')
        if round(a) ** 5 == abs(- b ** 5 + X):
            if - b ** 5 + X > 0:
                print(int(a), -b)
                return
            else:
                print(-int(a), -b)
                return

    raise ValueError()


if __name__ == '__main__':
    main()
n = int(input())
t_list = list(map(int, input().split()))

u = 0

for val in range(n):
	u += t_list[n]*(sum(t_list) - t_list[n])

u /= 2
m = int(u)
print(m)

### FIXED CODE ###

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

u = 0

for val in range(n):
	u += t_list[val]*(sum(t_list) - t_list[val])

u /= 2
m = int(u)
print(m)
k, t = map(int, input().split())
a = list(map(int, input().split()))

ans = max(a)

for i in a:
  if i != max(a):
    ans -= i
print(max(0, ans)

### FIXED CODE ###

k, t = map(int, input().split())
a = list(map(int, input().split()))

print(max(max(a)-1-sum(a)+max(a), 0))
# encoding:utf-8

import fractions

def check(l):
	l = list(map(int, l.split()))
	print(len(l), len([x for x in l if x % 2 == 0]), len([x for x in l if x % 2 == 1]))
	if max(l) >= 30001:
		print("max >= 30001")
		return False

	if len(set(l)) != len(l):
		print("not unique")
		return False

	tmp = l[0]


	for i in range(len(l) - 1):
		tmp = fractions.gcd(tmp, l[i+1])
	if tmp != 1:
		print("gcd is 1")
		return False 

	for i in range(len(l)):
		if fractions.gcd(l[i], sum(l) - l[i]) == 1:
			print("not special")
			return False

	return True


def main(n):
	if n == 3:
		return "2 5 63"

	sub1 = [str(i * 3) for i in range(1, 10001) if i % 2 == 1]
	sub2 = [str(i) for i in range(1, 30000) if i % 2 == 0 and i % 3 != 0]
	sub3 = [str(i) for i in range(1, 30001) if i % 6 == 0]
	if n <= 5003:
		if n % 2 == 0:
			s = "2 4 " + " ".join([str(x) for x in sub1[0:(n-2)]])
			return(s)
		else:
			s = "2 4 6 " + " ".join([str(x) for x in sub1[0:(n-3)]])
			return(s)
	elif n <= 15000:
		if n % 2 == 0:
			s = " ".join(sub2[0:(n-5000)]) + " " +  " ".join(sub1)
			return(s)
		else:
			s = " ".join(sub2[0:(n-5001)]) + " 6 " +  " ".join(sub1)
			return(s)
	else:
		s = " ".join(sub2) + " " +  " ".join(sub1) + " " + " ".join(sub3[0:(n-15000)]) 
		return(s)

if __name__ == '__main__':
	n = int(input())
	#print(check(main(n)))
	#print(main(20000))
	print(main(n))
	#print(check("2 4 3 20001"))
	#for i in range(5001, 5006):
	#	ans = main(i)
	#	print(i, check(ans))
	

### FIXED CODE ###

# encoding:utf-8


def main(s):
	alphabet = "abcdefghijklmnopqrstuvwxyz"
	d = {alphabet[i]:i for i in range(26)}
	if s == "zyxwvutsrqponmlkjihgfedcba":
		print("-1")
	elif len(s) < 26:
		for i in range(26):
			if alphabet[i] not in s:
				print(s + alphabet[i])
				break
	else:
		tail = [d[s[25]]]
		for i in range(0, 25):
			if d[s[24 - i]] >= max(tail):
				tail.append(d[s[24 - i]])
				continue
			else:
				tmp = min([x for x in tail if x >= d[s[24-i]]])
				print(s[0:(24-i)] + alphabet[tmp])
				break


if __name__ == '__main__':
	s = input()
	main(s)
from sys import setrecursionlimit
setrecursionlimit(10 ** 6)


def popcount(n):
    return bin(n).count("1")

cache = [-1] * (2 * 10 ** 5 + 1)


def f(n):
    if cache[n] != -1:
        return cache[n]
    return f(n % popcount(n)) + 1

def g(n, m):
    if n < 60:
        return (1 << n) % m
    else:
        t = n // 2
        return g(t, m) * g(n - t, m) % m


N = int(input())
X = input()

c = X.count('1')
t1 = [0] * N
t2 = [0] * N
for i in range(N):
    n = N - 1 - i
    t1[i] = g(n, c - 1)
    t2[i] = g(n, c + 1)

x1, x2 = 0, 0
for i in range(N):
    if X[i] == '1':
        x1 += t1[i]
        x2 += t2[i]

result = []
for i in range(N):
    if X[i] == '1':
        n = x1 - t1[i]
        n %= c - 1
    elif X[i] == '0':
        n = x2 + t2[i]
        n %= c + 1
    result.append(f(n) + 1)
print(*result, sep='\n')


### FIXED CODE ###

def popcount(n):
    return bin(n).count("1")


def f(n):
    if n == 0:
        return 0
    return 1 + f(n % popcount(n))


N = int(input())
X = input()

c = X.count('1')
t1 = [0] * N
t1[0] = 1 % (c + 1)
for i in range(1, N):
    t1[i] = (t1[i - 1] << 1) % (c + 1)
x1 = 0
for i in range(N):
    if X[i] == '0':
        continue
    x1 += t1[N - 1 - i]

if c - 1 != 0:
    t2 = [0] * N
    t2[0] = 1 % (c - 1)
    for i in range(1, N):
        t2[i] = (t2[i - 1] << 1) % (c - 1)
    x2 = 0
    for i in range(N):
        if X[i] == '0':
            continue
        x2 += t2[N - 1 - i]

result = []
for i in range(N):
    if X[i] == '0':
        n = (x1 + t1[N - 1 - i]) % (c + 1)
    elif X[i] == '1':
        if c - 1 == 0:
            result.append(0)
            continue
        n = (x2 - t2[N - 1 - i]) % (c - 1)
    result.append(1 + f(n))
print(*result, sep='\n')
s=str(input())
if len(s)%2==1:
    print("No")
else:
    is_hitachi=1
    for i in range(int(len(s)/2)):
        if s[2i]!="h" or s[2i+1]!="i":
            is_hitachi=0
            break
    if is_hitachi==1:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

s=str(input())
if len(s)%2==1:
    print("No")
else:
    is_hitachi=1
    for i in range(int(len(s)/2)):
        if s[2*i]!="h" or s[2*i+1]!="i":
            is_hitachi=0
            break
    if is_hitachi==1:
        print("Yes")
    else:
        print("No")
o=lambda:map(int,raw_input().split());r=range(n);a=10**5
n,k=o()
e=[[]for _ in [0]*n]
for _ in [0]*(n-1):a,b=o();e[a-1]+=[b-1];e[b-1]+=[a-1]
def U(x,f):
 l[f]=1;q=[(x,0)]
 while len(q):
  v,c=q.pop(0)
  if c>k/2:break
  l[v]=1
  for w in e[v]:
   if not l[w]:q+=[(w,c+1)]
 return n-l.count(1)
if k%2:
 for i in r:
  for j in e[i]:
   if i<j:l=[0]*n;U(i,j);a=min(a,U(j,i))
else:
 for i in r:l=[0]*n;a=min(a,U(i,-1))
print a


### FIXED CODE ###

ii=lambda:map(int,raw_input().split())
n,k=ii()
T,F=True,False
e=[[] for _ in range(n)]
for _ in range(n-1):
    a,b=ii()
    e[a-1]+=[b-1];e[b-1]+=[a-1]
cost=[0]*n
ans=10**5
def dfs(x,f):
    if f>=0:vis[f]=T
    q=[(x,0)]
    while len(q):
        v,c=q.pop(0)
        if c>k/2:break
        cost[v]=c;vis[v]=T
        for w in e[v]:
            if not vis[w]:q+=[(w,c+1)]
    return n-vis.count(T)
if k%2:
    for i in range(n):
        for j in e[i]:
            if i<j:vis=[F]*n;dfs(i,j);ans=min(ans,dfs(j,i))
else:
    for i in range(n):vis=[F]*n;ans=min(ans,dfs(i,-1))
print ans
num ,m =map(int,input().split())
arr = sorted(list(map(int,input().split())),reverse=True)

for i in range(m):
    for j in range(len(arr)):
        if arr[j]//2 < arr[j+1]:
            arr[j] = arr[j] //2
            arr.sort(reverse=True)
            break
print(sum(arr))
    

### FIXED CODE ###

import heapq as hq

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

arr = [-i for i in list(map(int,input().split()))]
hq.heapify(arr)

for i in range(m):
    hq.heappush(arr, -1*(-1*hq.heappop(arr)//2))

    
print(-1*sum(arr))
input = []
array = []
input = [int(input()) for i in range(6)]
array = input[:5]
k = input[5] 
size = len(array)
for i in range(size):
	if (array[size - i] - array[0] > k):
      print(':(')
      break
    if (i < 3):
      if (array[size - i] - array[1] > k):
      	print(':(')
        break
    if (i < 2):
      if (array[size - i] - array[2] > k):
      	print(':(')
        break
	if (i < 1):
      if (array[size - i] - array[3] > k):
        print(':(')
        break
    if (i == 4):
      print('Yay')

### FIXED CODE ###

array1 = [int(input()) for i in range(6)]
array2 = array1[:5]
k = array1[5] 
 
for i in range(5):
  if (i < 4 and array2[4 - i] - array2[0] > k):
    print(':(')
    break
  if (i < 3 and array2[4 - i] - array2[1] > k):
    print(':(')
    break
  if (i < 2 and array2[4 - i] - array2[2] > k):
    print(':(')
    break
  if (i < 1 and array2[4 - i] - array2[3] > k):
    print(':(')
    break
  if (i == 4):
    print('Yay!')
def solve():
    import sys
    file_input = sys.stdin
    
    def marked_ancestor(v):
        if v == ancestor[v]:
            return v
        else:
            ancestor[v] = marked_ancestor(parent[v])
            return ancestor[v]
    
    def line_ans(line):
        v = int(line[2:])
        if line[0] == 'M':
            ancestor[v] = v
            return 0
        else:
            return marked_ancestor(v)
    
    while True:
        N, Q = map(int, file_input.readline().split())
        if N == 0:
            break
        parent = [None, None]
        parent += [int(file_input.readline()) for _ in range(N - 1)]
        ancestor = [1] * (N + 1)
        ans = (line_ans(file_input.readline()) for _ in range(Q))
        print(sum(ans))

solve()


### FIXED CODE ###

class UnionFind:
    def __init__(self, size):
        self.table = [None] * size

    def find(self, x):
        if self.table[x] == None:
            return x
        else:
            # compression of the path
            self.table[x] = self.find(self.table[x])
            return self.table[x]
    
    def union(self, parent, child):
        p_root = self.find(parent)
        c_root = self.find(child)
        if p_root != c_root:
            self.table[c_root] = p_root
        
def solve():
    import sys
    input_lines = sys.stdin.readlines()
    while True:
        N, Q = map(int, input_lines[0].split())
        if N == 0:
            break
        
        parent = [0, 1] + list(map(int, input_lines[1:N]))
        
        unmarked = [True] * (N + 1)
        unmarked[1] = False
        operation = []
        for o in input_lines[N:N+Q]:
            mq, v = o.split()
            v = int(v)
            if mq == 'M':
                if unmarked[v]:
                    unmarked[v] = False
                    operation.append((mq, v))
            else:
                operation.append((mq, v))
        
        uf = UnionFind(N + 1)
        for v, p in enumerate(parent[2:], start=2):
            if unmarked[v]:
                uf.union(p, v)
        
        ans = 0
        for mq, v in reversed(operation):
            if mq == 'M':
                uf.union(parent[v], v)
            else:
                ans += uf.find(v)
        
        print(ans)
        
        del input_lines[:N+Q]

solve()
for i in range(1,10):for i in range(1,10):print("%dx%d=%d"%(i,j,i*j))

### FIXED CODE ###

for i in range(1,10):
		for j in range(1,10):
			print("%dx%d=%d"%(i,j,i*j))
c = 0
r = []
s = input()
s.upper()
for i in s:
  if i=='R':
    c+=1
  else:
    r.append(c)
    c = 0
print(max(r))

### FIXED CODE ###

c = 0
r = []
for i in input():
  if i=='R':
    c+=1
  else:
    r.append(c)
    c = 0
r.append(c)
if not len(r):
  print(c)
else:
  print(max(r))
# coding: utf-8

n, k = map(int, input().rstrip().split())    # 2 <= n <= 10^5, 1 <= k <= 100
h = list(map(int, input().rstrip().split()))

dp = [0] * 100010
for i in range(1, n):
    c = float('inf')
    for j in range(1, k + 1):
        if j > i:
            break
        else:
            c_ = dp[i - j] + abs(h[i - j] - h[i])
            if c_ < c:
                c = c_
    dp[i] = c
print(dp[i])


### FIXED CODE ###

# coding: utf-8

n = int(input())    # 2 <= n <= 10^5
h = list(map(int, input().rstrip().split()))
dp = [0]
for i in range(1, n):
    dp.append(min( \
        dp[i - 1] + abs(h[i - 1] - h[i]), \
        float('inf') if i < 2 else dp[i - 2] + abs(h[i - 2] - h[i])))
print(dp[- 1])
x,y = input().split()
x=int(x)
y=int(y)
for c in range(1, x):
    t = x - c
    if 2*c+4*t==y:
        print("Yes")
        sys.exit()
print("No")

### FIXED CODE ###

import sys
x,y = input().split()
x=int(x)
y=int(y)
for c in range(0, x+1):
    t = x - c
    if 2*c+4*t==y:
        print("Yes")
        sys.exit()
print("No")
n = int( input() )
d = int( input() )
for i in range( 0, 5 ):
	print( "yes" )

### FIXED CODE ###

def solve( p, t ):
	global isExist, n, A
	isExist[ t ] = True
	if p < n:
		solve( p+1, t-A[p] )
		solve( p+1, t )
	else:
		return

isExist = [False]*2001 
n = int( input() )
A = [ int( val ) for val in input().rstrip().split( ' ' ) ]
q = int( input() )
M = [ int( val ) for val in input().rstrip().split( ' ' ) ]
s = sum( A )
solve( 0, s )
for i in range( 0, q ):
	if isExist[ M[i] ]:
		print( "yes" )
	else:
		print( "no" )
maped = map(int, raw_input().split())
r = maped[0]
area = r*r*3.141592
length = 2*r*3.141592
print "%f %f"%(area, length)

### FIXED CODE ###

from math import pi
r, = map(float, raw_input().split())
area = r**2*pi
length = 2*r*pi
print "%f %f"%(area, length)