Harryxun/stf_run huggingface dataset:
s = input()
if "N" in s:
  if "S" in s:
    continue
  else:
    print("No")
    exit()
if "E" in s:
  if "W" in s:
    continue
  else:
    print("no")
    exit()
print("Yes")

### FIXED CODE ###

s = input()
if "N" in s:
  if "S" not in s :
    print("No")
    exit()
if "E" in s:
  if "W" not in s:
    print("No")
    exit()
if "S" in s:
  if "N" not in s :
    print("No")
    exit()
if "W" in s:
  if "E" not in s:
    print("No")
    exit()
print("Yes")
a,b,k=map(int,input().split())
l=[]
if k==1 or a==1 or b==1:
	print("1")
else:
	for i in range(1,(min(a,b))+1):
		if a%i==0 and b%i==0:
			l.append(i)
l.sort(reverse=True)
print(l[k-1])


### FIXED CODE ###

a,b,k=map(int,input().split())
l=[]

for i in range(1,(min(a,b))+1):
	if a%i==0 and b%i==0:
		l.append(i)
l.sort(reverse=True)
if a==1 or b==1:
    l=[1,1]
print(l[k-1])
x,y = input().split()
if x == y:
    print(x * y + " " + x * 4)
else
    print(x * y + " " + (x + y) * 2)

### FIXED CODE ###

x,y = map(int, input().split())
print(x * y, (x + y) * 2)
if S[1] == "R":
  return 'ABC'
else:
  return 'ARC'

### FIXED CODE ###

S = input()
if S[1] == 'R':
	print('ABC')
else:
    print('ARC')
a,b=map(int,input().split())

for i in range(1100):
    if int(i*0.08)==a and int(i*0.1)==b:
        print(i)
        exit()
print(-1)

### FIXED CODE ###

S=input()
if S=="AAA" or S=="BBB":
    print("No")
else:
    print("Yes")
a,b=[int(i) for i in input().split()]
if  (a+b)%2==0:
  print(x)
else:
  print((a+b+1)/2)

### FIXED CODE ###

a,b=[int(i) for i in input().split()]
x=a+b+1
print(x//2)
import math
a,b=map(int, input().split())

print(int((a * b)/math.gcd(a,b)))

### FIXED CODE ###

import fractions 
a,b=map(int, input().split())

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

print(lcm(a, b))
n, m = map(int, input().split())
d = {i: 0 for i in range(1, n)}
for _ in range(n):
    a, b = map(int, input().split())
    if a != 1:
        d[a] = 1 if a not in d else d[a] + 1
    if b != 1:
        d[b] = 1 if b not in d else d[b] + 1
for k, v in d.items():
    if v % 2:
        print('NO')
        break
else:
    print('YES')


### FIXED CODE ###

n, m = map(int, input().split())
d = {i: 0 for i in range(1, n+1)}
for _ in range(m):
    a, b = map(int, input().split())
    d[a] += 1
    d[b] += 1
for k, v in d.items():
    if v % 2:
        print('NO')
        break
else:
    print('YES')
n = int(input())
a = list(map(int,input().split()))
print(" ".join(a[::-2]+a[n%2::2]))

### FIXED CODE ###

n = int(input())
a = input().split()
print(" ".join(a[::-2]+a[n%2::2]))
import sympy
N = int(input())
count = 0
for i in range(N+1):
    count += i * sympy.divisor_count(i)

print(count)

### FIXED CODE ###

N = int(input())
ans = 0
for i in range(1,N+1):
    ans += (N//i)*(i+(i*(N//i)))//2
print(ans)
'''
https://atcoder.jp/contests/abc150/tasks/abc150_d
'''
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

    if n == 1:
        if m >= a[0]:
            print((m-a[0]) // a[0] + 1)
        else:
            print(0)

    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a % b)
    
    def gcd_group(arr):
        g = gcd(arr[0], arr[1])
        for i in range(2, len(arr)):
            g = gcd(g, arr[i])
        return g
    
    def lcm(a, b):
        g = gcd(a, b)
        return (a*b)//g
    
    def lcm_group(arr):
        l = lcm(arr[0], arr[1])
        for i in range(2, len(arr)):
            l = lcm(l, arr[i])
        return l
    
    lcm = lcm_group(a)
    semi_lcm = lcm // 2
    if m >= semi_lcm:
        print((m-semi_lcm)//lcm + 1)
    else:
        print(0)


if __name__ == '__main__':
    main()

### FIXED CODE ###

'''
https://atcoder.jp/contests/abc150/tasks/abc150_d
'''
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,m = map(int, input().split())
    a = list(map(int, input().split()))
    a = list(set(a))

    if len(a) == 1:
        if m >= a[0]//2:
            print((m-a[0]//2) // a[0] + 1)
        else:
            print(0)
        exit()

    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a % b)
    
    def gcd_group(arr):
        g = gcd(arr[0], arr[1])
        for i in range(2, len(arr)):
            g = gcd(g, arr[i])
        return g
    
    def lcm(a, b):
        g = gcd(a, b)
        return (a*b)//g
    
    def lcm_group(arr):
        l = lcm(arr[0], arr[1])
        for i in range(2, len(arr)):
            l = lcm(l, arr[i])
        return l
    g = gcd_group(a)
    for i in a:
        if (i//g)%2 == 0:
            print(0)
            exit()
    lcm = lcm_group(a)
    semi_lcm = lcm // 2
    if m >= semi_lcm:
        print((m-semi_lcm)//lcm + 1)
    else:
        print(0)


if __name__ == '__main__':
    main()
import math
a,b=map(int,input().split())
s=int(str(a)+str(b))
if s%int(math.sqrt(s))==0
  print("Yes")
else:
  print("No")


### FIXED CODE ###

import math
a,b=map(int,input().split())
s=int(str(a)+str(b))
if s%(math.sqrt(s))==0:
  print("Yes")
else:
  print("No")
import math
c= 0
while(n % 2 == 0):
    n/=2
    c+=1
print c

### FIXED CODE ###

import math
print 2 ** int(math.floor(math.log(int(raw_input()),2)))
from math import gcd, ceil
import sys
a, b = map(int, input().split())

gcdv = gcd(a, b)

if gcdv == 1:
    print(1)
    sys.exit(0)
is_so = True
sqrt_v = ceil(gcdv ** 0.5)
cnt = 1
table = [True] * (sqrt_v + 1)
for i in range(2, sqrt_v + 1):
    if table[i] and gcdv % i == 0:
        cnt += 1
        if gcd(gcdv, i) != 1:
            is_so = False
    for k in range(0, sqrt_v, i):
        table[k] = False

if is_so:
    cnt += 1
print(cnt)


### FIXED CODE ###

from fractions import gcd
from collections import Counter
a, b = map(int, input().split())

gcdv = gcd(a, b)

prime_cnt = Counter()
n = gcdv
for i in range(2, int(gcdv ** 0.5) + 2):
    while n % i == 0:
        n //= i
        prime_cnt[i] += 1

prime_cnt[n] += 1
prime_cnt[1] += 1

print(len(prime_cnt.keys()))
def main():
    INF = 10**9
    n,k = map(int,input().split())
    P = [0] + list(map(int,input().split()))
    C = [0] + list(map(int,input().split()))

    scores = [0]*n

    for s in range(1,n+1):
        start = s
        dp = [-INF]*(n+2)
        dp[0] = 0
        for i in range(n):
            p = P[s]
            dp[i+1] = dp[i] + C[p]
            
            if start == p:
                break
            s = p
        if k <= i+1:
            scores[start-1] = max(dp[1:k+1])
        elif dp[i+1]<=0:
            scores[start-1] = max(dp[1:])
        else:
            r = k%(i+1)
            q = k//(i+1)
            scores[start-1] = max(max(dp[1:r+1])+dp[i+1]*q, max(dp[1:]))
    
    print(max(scores))
main()

### FIXED CODE ###

def main():
    INF = 10**9
    n,k = map(int,input().split())
    P = [0] + list(map(int,input().split()))
    C = [0] + list(map(int,input().split()))

    scores = [0]*n

    for s in range(1,n+1):
        start = s
        dp = [-INF]*(n+1)
        dp[0] = 0
        for i in range(n):
            p = P[s]
            dp[i+1] = dp[i] + C[p]
            
            if start == p:
                break
            s = p
        if k <= i+1:
            scores[start-1] = max(dp[1:k+1])
        elif dp[i+1]<=0:
            scores[start-1] = max(dp[1:])
        else:
            r = k%(i+1)
            q = k//(i+1)
            if r>0:
                scores[start-1] = max(max(dp[1:r+1])+dp[i+1]*q, max(dp[1:]))
            else:
                scores[start-1] = dp[i+1]*(q-1)+max(dp[1:])

    print(max(scores))
main()
S = input().rstrip()
S = input().rstrip()
be = int(S[:2])
en = int(S[2:])
flag_be = False
flag_en = False
answer = ""
if be <= 12 and be >= 1:
    flag_be = True
if en <= 12 and en >= 1:
    flag_en = True

if flag_be and flag_en:
    answer = "AMBIGUOUS"
elif flag_be == True and flag_en == False:
    answer = "MMYY"
elif flag_be == False and flag_en == True:
    answer = "YYMM"
else:
    answer = "NA"
print(answer)

### FIXED CODE ###

S = input().rstrip()
be = int(S[:2])
en = int(S[2:])
flag_be = False
flag_en = False
answer = ""
if be <= 12 and be >= 1:
    flag_be = True
if en <= 12 and en >= 1:
    flag_en = True

if flag_be and flag_en:
    answer = "AMBIGUOUS"
elif flag_be == True and flag_en == False:
    answer = "MMYY"
elif flag_be == False and flag_en == True:
    answer = "YYMM"
else:
    answer = "NA"
print(answer)
A,B= list(input().split())
a = int(B[0])
b = int(B[2])
c = int(B[3])
d = int(A[0])
e = int(A[1])
f = int(A[2])
error = 10 * (c * e + b * f) + c * f
error = int(error/100)
ans = int(A) * a + 10 * d * b + e * b + c * d + error
print(ans)

### FIXED CODE ###

A,B= list(input().split())
a = int(B[0])
b = int(B[2])
c = int(B[3])
if int(A) > 1000:
   e = int(A[-2])
   f = int(A[-1])
   d = int((int(A)- 10 * e - f)/100)
   error = 10 * (c * e + b * f) + c * f
   error = int(error/100)
   ans = int(A) * a + 10 * d * b + e * b + c * d + error
   print(int(ans))
else:
   print(int(int(A)*float(B)))
num = lits(input())
print(num)
if num[0] == "7":
  print("Yes")
elif num[1] == "7":
  print("Yes")
elif num[2] == "7":
  print("Yes")
else:
  print("No")

### FIXED CODE ###

num = input()
word = list(num)
#print(word)
if word[0] == "7" :
    print("Yes")
elif word[1] == "7" :
    print("Yes")
elif word[2] == "7" :
    print("Yes")
else:
    print("No")
N = int(input())
P = list(map(int, input().split()))

lst = []
ans = 0
skip = False
for e,p in enumerate(P,1):
    if skip:
        skip = False
        continue
    if e == p:
        ans += 1
        if e-1 < N and P[e] == e+1:
            skip = True
        # lst.append(e)
print(ans)
exit(0)

st = False
ans = 0
for a,b,c in zip(lst[::2], lst[1::2] + [-1], lst[2::2] + [-1, -1]):
    print(a,b,c)
    if b == -1:
        if st:
            break
        ans += 1
        break

    if c == -1:
        if not st and a +1 == b:
            ans += 1
        elif st :
            ans += 1
        else:
            ans += 2
        break

    if not st and a+1 == b:
        ans += 1
        continue
    if not st and b+1 == c:
        st = True
        ans += 1
    if st and b+1 == c:
        ans += 1

    st = False
    ans += 2
print(ans)




### FIXED CODE ###

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

lst = []
ans = 0
for e,p in enumerate(P,1):
    if e == p:
        ans += 1

        if e < N:
            P[e] = 0
print(ans)
exit(0)

st = False
ans = 0
for a,b,c in zip(lst[::2], lst[1::2] + [-1], lst[2::2] + [-1, -1]):
    print(a,b,c)
    if b == -1:
        if st:
            break
        ans += 1
        break

    if c == -1:
        if not st and a +1 == b:
            ans += 1
        elif st :
            ans += 1
        else:
            ans += 2
        break

    if not st and a+1 == b:
        ans += 1
        continue
    if not st and b+1 == c:
        st = True
        ans += 1
    if st and b+1 == c:
        ans += 1

    st = False
    ans += 2
print(ans)
def price(target, item, recipe):
    ret = []
    
    if target in recipe:
        ret.append(sum(price(r,item, recipe) for r in recipe[target]))
    if target in item:
        ret.append(item[target])

    return min(ret)

import sys
f = sys.stdin

while True:
    n = int(f.readline())
    if n == 0:
        break
    item = [f.readline().split() for _ in range(n)]
    item = {name:int(price) for name, price in item}
    recipe = [f.readline().strip().split() for _ in range(int(f.readline()))]
    recipe = {r[0]:r[2:2 + int(r[1])] for r in recipe}
    print(price(f.readline().strip(), item, recipe))

### FIXED CODE ###

def price(target, item, recipe):
    ret = []
    
    if target in recipe:
        ret.append(sum(price(r,item, recipe) for r in recipe[target]))
    if target in item:
        ret.append(item[target])
    if len(ret) == 0:
        return 0

    return min(ret)

import sys
f = sys.stdin

while True:
    n = int(f.readline())
    if n == 0:
        break
    item = [f.readline().split() for _ in range(n)]
    item = {name:int(price) for name, price in item}
    recipe = [f.readline().strip().split() for _ in range(int(f.readline()))]
    recipe = {r[0]:r[2:] for r in recipe}
    print(price(f.readline().strip(), item, recipe))
N, M = map(int, input().split())

A = set({})
B = set({})
for j in range(N-1):
    tmp = []
    tmp = [int(i) for i in input().split()]
    if tmp[0] == 1:
        A.add(tmp[1])
    elif tmp[1] == N:
        B.add(tmp[0])

if len(A.intersection(B)) > 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


### FIXED CODE ###

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

A = set({})
B = set({})
for j in range(M):
    tmp = []
    tmp = [int(i) for i in input().split()]
    if tmp[0] == 1:
        A.add(tmp[1])
    elif tmp[1] == N:
        B.add(tmp[0])

if len(A.intersection(B)) > 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
N, K, L = [int(x) for x in input().split()]
dict = {}
for i in range(1, N + 1):
    dict[i] = [set(), set()]
    dict[i][0].add(i)
    dict[i][1].add(i)
for i in range(K):
    p, q = [int(x) for x in input().split()]
    dict[p][0].add(q)
    dict[q][0].add(p)
for i in range(L):
    r, s = [int(x) for x in input().split()]
    dict[r][1].add(s)
    dict[s][1].add(r)

def my_dfs(city, opt, s):
    if dict[city][opt] <= s:
        return s
    for i in dict[city][opt]:
        if i in s:
            continue
        if i == city:
            s.add(i)
            continue
        s.add(i)
        s.update(my_dfs(i, opt, s))
    return s

for i in range(1, N + 1):
    dict[i][0].update(my_dfs(i, 0, set()))
    dict[i][1].update(my_dfs(i, 1, set()))
ans_lst = []
for i in range(1, N + 1):
    ans_lst.append(len(dict[i][0] & dict[i][1]))
print(*ans_lst)


### FIXED CODE ###

#Union-Find木の構築
import sys
def 解():
    iN,iK,iL = [int(_) for _ in input().split()]
    aD = [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()]

    def buildTree(a):
        #aT = [0]*(iN+1)
        aT = list(range(iN+1))
        for p,q in a:
            rp = getRoot(aT,p)
            rq = getRoot(aT,q)
            thisRoot = max(rp,rq,q) #みんな小さい方に合わせてるのでデカい方に合>わせてみる
            aT[p] = thisRoot
            aT[q] = thisRoot
            aT[rp] = thisRoot #これで Union してるつもり
            aT[rq] = thisRoot
        return aT
    def getRoot(a,i): #find
        #if a[i] == i or a[i] == 0:
        #   if a[i] == 0 : a[i] = i
        if a[i] == i :
            return i
    #   elif i < a[i] :
        else :
            a[i] = getRoot(a,a[i])
            return a[i]
    #   else:
    #       print("! ",i,a[i])

    aT道 = buildTree(aD[0:iK])
    aT鉄道 = buildTree(aD[iK:])
    aRet = []
    dRet = {}
    for i in range(1,iN+1):
        # いやはやこんなもんもキーになるのか。
        Comb = (getRoot(aT道,i), getRoot(aT鉄道,i))
        aRet.append(Comb)
        if Comb in dRet:
            dRet[Comb] += 1
        else:
            dRet[Comb] = 1
    print(" ".join([str(dRet[_]) for _ in aRet]))

解()
from collections import Counter
s = list(input())
x, y = map(int, input().split())
cs = Counter(s)

ss = []
idx = 0
cnt = 0
while idx < len(s):
    if s[idx] == 'F':
        cnt += 1
    else:
        if cnt != 0:
            ss += [cnt]
        ss += [0]
        cnt = 0

    idx += 1

    if idx == len(s):
        if cnt != 0:
            ss += [cnt]

p = [[], []]
now = 0

for i in ss:
    if i == 0:
        now = abs(1-now)
    else:
        p[now] += [i]

s1 = p[0]
s2 = p[1]

if len(s1) == 0 and len(s2) == 0:
    print('No')
    exit()

if len(s1) > 0:
    dp = [[0]*(2*sum(s1)+1) for _ in range(len(s1)+1)]
    zero = sum(s1)
    dp[0][zero] = 1
    sum_s1 = sum(s1)
    for i in range(len(s1)):
        m = s1[i]
        for j in range(sum_s1+1):
            if zero+j+m < 2*sum_s1 and zero+j-m > 0:
                dp[i+1][zero+j] = dp[i][zero+j-m] | dp[i][zero+j+m]
            elif zero+j+m < 2*sum_s1:
                dp[i+1][zero+j] = dp[i][zero+j+m]
            elif zero+j-m > 0:
                dp[i+1][zero+j] = dp[i][zero+j-m]

            if zero-j+m < 2*sum_s1 and zero-j-m > 0:
                dp[i+1][zero-j] = dp[i][zero-j-m] | dp[i][zero-j+m]
            elif zero-j+m < 2*sum_s1:
                dp[i+1][zero-j] = dp[i][zero-j+m]
            elif zero-j-m > 0:
                dp[i+1][zero-j] = dp[i][zero-j-m]

    if dp[-1][x+zero] == 0:
        print('No')
        exit()

if len(s2) > 0:
    dp = [[0]*(2*sum(s2)+1) for _ in range(len(s2)+1)]
    zero = sum(s2)
    dp[0][zero] = 1
    sum_s2 = sum(s2)
    for i in range(len(s2)):
        m = s2[i]
        for j in range(sum_s2+1):
            if zero+j+m < 2*sum_s2 and zero+j-m > 0:
                dp[i+1][zero+j] = dp[i][zero+j-m] | dp[i][zero+j+m]
            elif zero+j+m < 2*sum_s2:
                dp[i+1][zero+j] = dp[i][zero+j+m]
            elif zero+j-m > 0:
                dp[i+1][zero+j] = dp[i][zero+j-m]

            if zero-j+m < 2*sum_s2 and zero-j-m > 0:
                dp[i+1][zero-j] = dp[i][zero-j-m] | dp[i][zero-j+m]
            elif zero-j+m < 2*sum_s2:
                dp[i+1][zero-j] = dp[i][zero-j+m]
            elif zero-j-m > 0:
                dp[i+1][zero-j] = dp[i][zero-j-m]
    if dp[-1][y+zero] == 0:
        print('No')
        exit()

print('Yes')

### FIXED CODE ###

s = input()
x, y = map(int, input().split())
d = [len(i) for i in s.split('T')]
 
s1 = d[2::2]
s2 = d[1::2]
 
now_x = [0]
now_y = [0]

x -= d[0]

for i in s1:
    nx = set()
    for j in now_x:
        nx.add(j-i)
        nx.add(j+i)
    now_x = nx

for i in s2:
    ny = set()
    for j in now_y:
        ny.add(j-i)
        ny.add(j+i)
    now_y = ny

if x in now_x and y in now_y:
    print('Yes')
else:
    print('No')
def test(a):
	if tmp.isupper():
		return 'A'
	else:
		return 'a'
      
test(input())

### FIXED CODE ###

def test(a):
	if a.isupper():
		print('A')
	else:
		print('a')

        
test(input())
n=int(input())
A=list(map(int,input().split())
ans=1
for i in A:
  ans*=i
  if ans>10**18:
  print(-1)
  exit()

print(ans)


### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
x=1
A.sort()
if 0 in A:
  print(0)
  exit()

for i in range(n):
  x*=A[n-i-1]
  if x>10**18:
    print(-1)
    exit()
  else:
    continue

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

dp = [[{} for i in range(S+1) ] for j in range(N+1)]
dp[0][0][0]=1
#print(dp)
for i in range(1,N+1):
  #print(i)
  a = A[i-1]
  if i==0:
    if a <= S:
      dp[i][a][1] = 1  
    continue
  for j in range(S+1):
    if len(dp[i-1][j])>0:
      for key, value in dp[i-1][j].items():
        dp[i][j][key] = value
    if j>=a:
      if len(dp[i-1][j-a]) > 0:
        for key, value in dp[i-1][j-a].items():
          if (key+1) in dp[i][j]:
            dp[i][j][key+1] += value
          else:
            dp[i][j][key+1] = value
last = dp[-1][-1]
ans = 0
for key, value in last.items():
  ans += 2**(N-key) * value
  ans %= 998244353
#print(last)
print(ans)
    
    
      
      

### FIXED CODE ###

x,y = map(int, input().split())
print(x*y)
n = int(input())
ss = []
for i in range(n):
    s = input()
    ss.append(''.join(sorted(s)))

ss = sorted(ss)

res = 0
while True:
    if len(ss) == 0:
        break
    if ss[0] != ss[1]:
        ss.pop(0)
        continue
    i = 1
    while True:
        if i == len(ss):
            res += i * (i-1) / 2
            for num in range(i):
                ss.pop(0)
            break
        if ss[0] == ss[i]:
            i += 1
        else:
            res += i * (i-1) / 2
            for num in range(i):
                ss.pop(0)
            break

print(int(res))

### FIXED CODE ###

n = int(input())
ss = []
for i in range(n):
    s = input()
    ss.append(''.join(sorted(s)))

ss = sorted(ss)

res = 0
while True:
    if len(ss) <= 1:
        break
    if ss[0] != ss[1]:
        ss.pop(0)
        continue
    i = 1
    while True:
        if i == len(ss):
            res += i * (i-1) / 2
            for num in range(i):
                ss.pop(0)
            break
        if ss[0] == ss[i]:
            i += 1
        else:
            res += i * (i-1) / 2
            for num in range(i):
                ss.pop(0)
            break

print(int(res))
A = [int(x) for x in input()split()]
A.sort()
print(A[2] - A[0])

### FIXED CODE ###

A = [int(x) for x in input().split()]
A.sort()
print(A[2] - A[0])
# BIT使ってC問題ちゃんとやろうとしたけど1時間かけて無を生成したので諦める。ぷえwwwww
from random import randint
d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split()))for _ in range(d)]
for i in range(d):s.append(s[i][:])
for i in range(d):s.append(s[i][:])
def xyz():
  start=randint(0,d-1)
  ans=[0]*d
  score=0
  for i in range(start,start+d,26):
    dd=set()
    uu=set()
    h=[]
    for j in range(i,i+26):
      for k in range(26):
        h.append([s[j][k],j,k])
    h.sort(reverse=1)
    for t,j,k in h:
      if j in dd or k in uu:continue
      score+=t
      ans[j]=k
      dd.add(j)
      uu.add(k)
  return [score,ans]
score,ans=xyz()
for i in range(40):
  ss,aa=xyz()
  if ss>score:
    score,ans=ss,aa
for i in ans:print(i+1)

### FIXED CODE ###

d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split()))for _ in range(d)]
for i in range(d):print(i%26+1)
n, a, b=map(int,input().split())
if n==a+b:
  print(a)
else:
  if a==0:
    print(0)
  else:
    print((n//(a+b))*a + min(n%(a+b), a))

### FIXED CODE ###

s=list(input())
if len(set(s))==1:
  print("No")
else:
  print("Yes")
import sys

sys.setrecursionlimit(10 ** 6)
N = input()
N_len = len(N)
'''
75333
'''


# t = []


def dfs(a, depth):
    if depth == N_len:
        if int(a) <= int(N) and a.count('3') > 0 \
                and a.count('5') > 0 and a.count('7') > 0 and str(int(a)).count('0') == 0:
            t.append(a)
            return 1
        else:
            return 0

    ret1 = dfs(a + '0', depth + 1)
    ret2 = dfs(a + '3', depth + 1)
    ret3 = dfs(a + '5', depth + 1)
    ret4 = dfs(a + '7', depth + 1)
    return ret1 + ret2 + ret3 + ret4


ans = dfs('', 0)
print(ans)
# print(t)


### FIXED CODE ###

S = input()

'''
357 375 537 573 735 753 
3357 3375 3537 3573 3735 3753 
5357 5375 5537 5573 5735 5753 
3357,3375,3537,

3けた　、4けた 5 ,6, 7, 8
6,18,54,162,486, 8
sum = [2 * 3,2 * 3 * 3,]
'''

N = len(S)
list375 =['3','5','7']
if N <  3:
    print(0)
    exit(0)

for i in range(N + 1):
    if i ==0:
        continue
    else:
        targetList = list375[:]
        for l in targetList:
            #print(l)
            list375.append(l + '3')
            list375.append(l + '5')
            list375.append(l + '7')

result = [i for i in list(set(list375)) if int(i) <= int(S) and (i.count('3') >0 and i.count('5') >0 and i.count('7') >0)]
#print(result)
print(len(result))


'''
def judge753():
    if keta[0] < 3:
        return 0
    if keta[0] < 5:
        if keta[1] < 3:
            return 0
        if keta[1] < 5:
            if keta[2] < 5:
                return 0
            if keta[2] < 7:
                return 1
            return 2
        if keta[1] < 7:
            
        return sum[len(S)-1]
    if keta[0] < 7:
        if keta[1] < 3:
            return sum[len(S)-1] + sum[len(S)-2]
        if keta[1] < 5:
            if keta[2] < 5:
        
        return sum[len(S)-1]
        
print(min(absList))
'''
#coding:utf-8

H, W = input().split()
h, w = input().split()

for s in [H,W,h,w]:
    int(s)

ans = (H - h) * (W - w)
print(ans)

### FIXED CODE ###

#coding:utf-8

H, W = input().split()
h, w = input().split()

ans = ( int(H)-int(h) ) * ( int(W)-int(w) )
print(ans)