CodeEff/ECCO huggingface dataset:
# Original solution
import sys
input = sys.stdin.readline

N,A,B,C,D=list(map(int,input().split()))
S=input().strip()
S+="#####"

A-=1
B-=1
C-=1
D-=1

if C<D:
    while B!=D or  A!=C:
        #print(A,B)
        if B!=D and S[B+1]==".":
            B+=1
        elif B!=D and S[B+2]==".":
            B+=2
        elif B!=D and S[B+1]=="#" and S[B+2]=="#":
            print("No")
            sys.exit()


        if A!=C and S[A+1]==".":
            A+=1
        elif A!=C and S[A+2]==".":
            A+=2
        elif A!=C and S[A+1]=="#" and S[A+2]=="#":
            print("No")
            sys.exit()

    print("Yes")

else:
    while A<B:
            
        if S[A+1]=="." and A+1!=B:
            A+=1
        elif S[A+2]=="." and A+2!=B:
            A+=2
        elif S[A+1]=="#" and S[A+2]=="#":
            print("No")
            sys.exit()

        if A+1==B or (A+2==B and S[A+1]=="#"):
            break

    while True:
        if A+1==B and S[B+1]==".":
            A+=2
            break

        if S[B+1]==".":
            B+=1
        elif S[B+2]==".":
            B+=2
        else:
            print("No")
            sys.exit()

        if S[A+1]==".":
            A+=1
        elif S[A+2]==".":
            A+=2

        if B>D:
            print("No")
            sys.exit()

    
    while B!=D or  A!=C:
        
        if A!=C and S[A+1]==".":
            A+=1
        elif A!=C and S[A+2]==".":
            A+=2
        elif A!=C and S[A+1]=="#" and S[A+2]=="#":
            print("No")
            sys.exit()
            
        if B!=D and S[B+1]==".":
            B+=1
        elif B!=D and S[B+2]==".":
            B+=2
        elif B!=D and S[B+1]=="#" and S[B+2]=="#":
            print("No")
            sys.exit()




    print("Yes")
    

        
            
        


# Optimized solution
import sys
input = sys.stdin.readline

N,A,B,C,D=list(map(int,input().split()))
S=input().strip()

BLOCK=[0]*N
OPEN=[0]*N

for i in range(1,N):
    if S[i]=="#" and S[i-1]=="#":
        BLOCK[i]=1

for i in range(2,N):
    if S[i]==S[i-1]==S[i-2]==".":
        OPEN[i]=1

RIGHT_A=N-1
for i in range(A,N):
    if BLOCK[i]==1:
        RIGHT_A=i
        break

RIGHT_B=N-1
for i in range(B,N):
    if BLOCK[i]==1:
        RIGHT_B=i
        break

if C<=RIGHT_A+1 and D<=RIGHT_B+1:
    if C<D:
        print("Yes")
        sys.exit()
    if RIGHT_A==RIGHT_B:
        for j in range(B,D+1):
            if OPEN[j]==1:
                print("Yes")
                sys.exit()

        else:
            print("No")
                
    else:
      print("Yes")
else:
    print("No")
# Original solution
import sys
n, a, b, c, d = list(map(int, sys.stdin.readline().split()))
s = sys.stdin.readline().rstrip()

dp = [[False for _ in range(n)] for _ in range(n)]
dp[a-1][b-1] = True

for i in range(a-1, n):
    for j in range(b-1, n):
        if i == j: continue
        if not dp[i][j]: continue
        for x, y in ((1, 0), (2, 0), (0, 1), (0, 2)):
            if (i+x < n) and (j+y < n) and s[i+x] == '.' and s[j+y] == '.':
                dp[i+x][j+y] = True

print(('Yes' if dp[c-1][d-1] else 'No'))


# Optimized solution
import sys
n, a, b, c, d = list(map(int, sys.stdin.readline().split()))
s = sys.stdin.readline().rstrip()

def can_reach(start, end):
    for i in range(start-1, end-1):
        if s[i] == '#' and s[i+1] == '#':
            return False
    return True

if can_reach(a, c) and can_reach(b, d):
    if c < d:
        print('Yes')
    else:
        flag = False
        for i in range(b-1, d):
            if s[i-1] == '.' and s[i] == '.' and s[i+1] == '.':
                flag = True
        print(('Yes' if flag else 'No'))
else:
    print('No')
# Original solution
from collections import deque

def f(x, y):
    if x == 0:
        return y
    if y == 0:
        return -x
    if x == r:
        return -(x + y)
    if y == c:
        return x + y

r, c, n = list(map(int, input().split()))
xy = []
lxy = 0
for i in range(n):
    x1, y1, x2, y2 = list(map(int, input().split()))
    d = []
    if min(x1, y1) == 0 or x1 == r or y1 == c:
        d.append([f(x1, y1), i])
    if min(x2, y2) == 0 or x2 == r or y2 == c:
        d.append([f(x2, y2), i])
    if len(d) == 2:
        xy.append(d[0])
        xy.append(d[1])
        lxy += 2
xy.sort()
q = deque()
for i in range(lxy):
    if not q:
        q.append(xy[i][1])
    else:
        if q[-1] == xy[i][1]:
            q.pop()
        else:
            q.append(xy[i][1])
print(("YES" if not q else "NO"))

# Optimized solution
from collections import deque

def f(x, y):
    if x == 0:
        return y
    if y == 0:
        return -x
    if x == r:
        return -(x + y)
    if y == c:
        return x + y

r, c, n = list(map(int, input().split()))
xy = []
lxy = 0
for i in range(n):
    x1, y1, x2, y2 = list(map(int, input().split()))
    d = []
    if min(x1, y1) == 0 or x1 == r or y1 == c:
        d.append([f(x1, y1), i])
    if min(x2, y2) == 0 or x2 == r or y2 == c:
        d.append([f(x2, y2), i])
    if len(d) == 2:
        xy.append(d[0])
        xy.append(d[1])
        lxy += 2
xy.sort()
q = deque()
lq = -1
for i in range(lxy):
    if not q:
        q.append(xy[i][1])
        lq += 1
    else:
        if q[lq] == xy[i][1]:
            q.pop()
            lq -= 1
        else:
            q.append(xy[i][1])
            lq += 1
print(("YES" if not q else "NO"))
# Original solution
import sys
input = sys.stdin.readline

r, c, n = list(map(int, input().split()))
L = []
def trans(x, y):
  z = None
  if x == 0:
    z = y
  if y == c:
    z = c + x
  if x == r:
    z = c + r + c - y
  if y == 0:
    z = 2*r + 2*c - x
  return z

for _ in range(n):
  x1, y1, x2, y2 = list(map(int, input().split()))
  z1 = trans(x1, y1)
  z2 = trans(x2, y2)
  if z1 is not None and z2 is not None:
    if z1 > z2:
      z1, z2 = z2, z1
    L.append((z1, z2))
    L.append((z2, z1))
L.sort()
cnt = 0
D = dict()
for z1, z2 in L:
  if z1 < z2:
    cnt += 1
    D[z1] = cnt
  else:
    if D[z2] != cnt:
      print("NO")
      exit()
    cnt -= 1
print("YES")

# Optimized solution
import sys
input = sys.stdin.readline

def main():
  r, c, n = list(map(int, input().split()))
  L = []
  def trans(x, y):
    z = None
    if x == 0:
      z = y
    if y == c:
      z = c + x
    if x == r:
      z = c + r + c - y
    if y == 0:
      z = 2*r + 2*c - x
    return z

  for _ in range(n):
    x1, y1, x2, y2 = list(map(int, input().split()))
    z1 = trans(x1, y1)
    z2 = trans(x2, y2)
    if z1 is not None and z2 is not None:
      L.append((z1, z2))
      L.append((z2, z1))
  L.sort()
  cnt = 0
  D = dict()
  for z1, z2 in L:
    if z1 < z2:
      cnt += 1
      D[z1] = cnt
    else:
      if D[z2] != cnt:
        print("NO")
        exit()
      cnt -= 1
  print("YES")
if __name__ == "__main__":
  main()
# Original solution
w, h, n = list(map(int, input().split()))

vec = []

l = []
b = []
r = []
t = []
for i in range(n):
    x, y, x1, y1 = list(map(int, input().split()))
    if x == 0:
        l.append([x, y, i])
    elif y == 0:
        t.append([x, y, i])
    elif x == w:
        r.append([x, y, i])
    elif y == h:
        b.append([x, y, i])
    if x1 == 0:
        l.append([x1, y1, i])
    elif y1 == 0:
        t.append([x1, y1, i])
    elif x1 == w:
        r.append([x1, y1, i])
    elif y1 == h:
        b.append([x1, y1, i])

sorted_node = (
          sorted(l, key=lambda x: x[1])
        + sorted(b, key=lambda x: x[0])
        + sorted(r, key=lambda x: x[1], reverse=True)
        + sorted(t, key=lambda x: x[0], reverse=True)
        )

colors = list([x[2] for x in sorted_node])

colors = list([x for x in set(colors) if colors.count(x) % 2 == 0])

stack = []

for node in sorted_node:
    if node[2] in colors:
        if not stack or stack[-1] != node[2]:
            stack.append(node[2])
        else:
            stack.pop()

print(("NO" if stack else "YES"))



# Optimized solution
w, h, n = list(map(int, input().split()))

vec = []

l = []
b = []
r = []
t = []
for i in range(n):
    x, y, x1, y1 = list(map(int, input().split()))
    c = [x, y, x1, y1]
    if( ((c[0] == 0 or c[0] == w) or (c[1] == 0 or c[1] == h)) and ((c[2] == 0 or c[2] == w) or (c[3] == 0 or c[3] == h)) ):
        if x == 0:
            l.append([x, y, i])
        elif y == 0:
            t.append([x, y, i])
        elif x == w:
            r.append([x, y, i])
        elif y == h:
            b.append([x, y, i])
        if x1 == 0:
            l.append([x1, y1, i])
        elif y1 == 0:
            t.append([x1, y1, i])
        elif x1 == w:
            r.append([x1, y1, i])
        elif y1 == h:
            b.append([x1, y1, i])

sorted_node = (
          sorted(l, key=lambda x: x[1])
        + sorted(b, key=lambda x: x[0])
        + sorted(r, key=lambda x: x[1], reverse=True)
        + sorted(t, key=lambda x: x[0], reverse=True)
        )


stack = []

for node in sorted_node:
    if not stack or stack[-1] != node[2]:
        stack.append(node[2])
    else:
        stack.pop()

print(("NO" if stack else "YES"))
# Original solution
import sys
input = lambda: sys.stdin.readline().rstrip()
R, C, N = list(map(int, input().split()))
X = {0, R}
Y = {0, C}

Z = []
for i in range(N):
    x1, y1, x2, y2 = list(map(int, input().split()))
    if (x1 == 0 or x1 == R or y1 == 0 or y1 == C) and (x2 == 0 or x2 == R or y2 == 0 or y2 == C):
        Z.append((x1, y1, x2, y2))
        X.add(x1)
        X.add(x2)
        Y.add(y1)
        Y.add(y2)

DX = {a: i for i, a in enumerate(sorted(list(X)))}
DY = {a: i for i, a in enumerate(sorted(list(Y)))}
R, C = DX[R], DY[C]

def calc(a, b):
    if b == 0:
        return a
    if a == R:
        return b + R
    if b == C:
        return R + C + (R - a)
    if a == 0:
        return R + C + R + (C - b)

A = []
for i, (x1, y1, x2, y2) in enumerate(Z):
    x3, y3, x4, y4 = DX[x1], DY[y1], DX[x2], DY[y2]
    A.append((calc(x3, y3), i))
    A.append((calc(x4, y4), i))

A = [l[1] for l in sorted(A, key = lambda x: x[0])]
B = []

while A:
    while len(B) and A[-1] == B[-1]:
        A.pop()
        B.pop()
    if A:
        B.append(A.pop())

print(("NO" if len(B) else "YES"))

# Optimized solution
import sys
input = lambda: sys.stdin.readline().rstrip()

def calc(a, b):
    if b == 0: return a
    if a == R: return b + R
    if b == C: return R + C + (R - a)
    if a == 0: return R + C + R + (C - b)

R, C, N = list(map(int, input().split()))
A = []
for i in range(N):
    x1, y1, x2, y2 = list(map(int, input().split()))
    if (x1 == 0 or x1 == R or y1 == 0 or y1 == C) and (x2 == 0 or x2 == R or y2 == 0 or y2 == C):
        A.append((calc(x1, y1), i))
        A.append((calc(x2, y2), i))

A = [l[1] for l in sorted(A, key = lambda x: x[0])]
B = []

while A:
    while len(B) and A[-1] == B[-1]:
        A.pop()
        B.pop()
    if A:
        B.append(A.pop())

print(("NO" if len(B) else "YES"))
# Original solution
r,c,n = list(map(int,input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
iru = []
for i in range(n):
  if ((a[i][0] == 0 or a[i][0] == r or a[i][1] == 0 or a[i][1] == c) and (a[i][2] == 0 or a[i][2] == r or a[i][3] == 0 or a[i][3] == c)):
    iru.append(a[i])
if len(iru) <= 1:
  print("YES")
else:
  for i in range(len(iru)):
    b = iru[i]
    b1 = [b[0],b[1]]
    b2 = [b[2],b[3]]
    if b1[0] == 0:
      b1 = b1[1]
    elif b1[1] == c:
      b1 = b1[0] + b1[1]
    elif b1[0] == r:
      b1 = c*2 +r-1 -b1[1]
    else:
      b1 = c*2 + r*2 -2 - b1[0]
      
    if b2[0] == 0:
      b2 = b2[1]
    elif b2[1] == c:
      b2 = b2[0] + b2[1]
    elif b2[0] == r:
      b2 = c*2 +r-1 -b2[1]
    else:
      b2 = c*2 + r*2 -2 - b2[0]
    if b1 > b2:
      tmp = b1 +0
      b1 = b2 +0
      b2 = tmp + 0
    for j in range(i+1,len(iru)):
      d = iru[j]
      d1 = [d[0],d[1]]
      d2 = [d[2],d[3]]
      if d2[0] == 0:
        d2 = d2[1]
      elif d2[1] == c:
        d2 = d2[0] + d2[1]
      elif d2[0] == r:
        d2 = c*2 +r-1 -d2[1]
      else:
        d2 = c*2 + r*2 -2 - d2[0]
      
      if d1[0] == 0:
        d1 = d1[1]
      elif d1[1] == c:
        d1 = d1[0] + d1[1]
      elif d1[0] == r:
        d1 =  c*2 +r-1 -d1[1]
      else:
        d1 = c*2 + r*2 -2 - d1[0]
      if d1 > d2:
        tmp = d1 +0
        d1 = d2 +0
        d2 = tmp + 0
      if (b1 <= d1 and d1 <= b2 and b2 <= d2):
        print("NO")
        exit()
      elif (d1 <= b1 and b1 <= d2 and d2 <= b2):
        print("NO")
        exit()
  print("YES")     

# Optimized solution
r,c,n = list(map(int,input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
iru = []
for i in range(n):
  if ((a[i][0] == 0 or a[i][0] == r or a[i][1] == 0 or a[i][1] == c) and (a[i][2] == 0 or a[i][2] == r or a[i][3] == 0 or a[i][3] == c)):
    b = a[i]
    b1 = [b[0],b[1]]
    b2 = [b[2],b[3]]
    if b1[0] == 0:
      b1 = b1[1]
    elif b1[1] == c:
      b1 = b1[0] + b1[1]
    elif b1[0] == r:
      b1 = c +r+c -b1[1]
    else:
      b1 = c*2 + r*2 - b1[0]
      
    if b2[0] == 0:
      b2 = b2[1]
    elif b2[1] == c:
      b2 = b2[0] + b2[1]
    elif b2[0] == r:
      b2 = c*2 +r -b2[1]
    else:
      b2 = c*2 + r*2 - b2[0]
    if b1 > b2:
      tmp = b1 +0
      b1 = b2 +0
      b2 = tmp + 0
    iru.append([b1,b2])
iru = sorted(iru)
ato = 0
stack = [r+r+c+c]
flag = 'YES'
for a,b in iru:
  while a >= stack[-1]:
    stack.pop()
 
  if b > stack[-1]:
    flag = 'NO'
    break
  else:
    stack.append(b)
 
print(flag)
# Original solution
def mx(mtrx):
	maxSum = -1000000
	for colStart in range(n):
		partSum = [0]*n
		for colEnd in range(colStart,n):
			for row in range(n):
				partSum[row] += mtrx[row][colEnd]
			maxSum = max(maxPart(partSum), maxSum)
	return maxSum

def maxPart(array):
	maxSum = -1000000
	calcSum = 0
	for i in range(n):
		calcSum += array[i]
		maxSum = max(calcSum,maxSum)
		if calcSum < 0:	calcSum = 0
	return maxSum
	
n = int(input())
print(mx([list(map(int, input().split())) for i in range(n)]))

# Optimized solution
def x(a):
	m=-10**9
	for c in N:
		p=[0]*n 
		for e in range(c,n):
			for r in N:
				p[r]+=a[r][e]
			m=max(P(p),m)
	return m

def P(a):
	m,c=-100000,0
	for i in N:
		c+=a[i]
		m=max(c,m)
		if c<0:c=0
	return m

n = eval(input())
N = list(range(n))
print(x([list(map(int, input().split())) for i in N]))
# Original solution
from itertools import combinations_with_replacement
n = eval(input())
sq = [list(map(int,input().split())) for u in range(n)]
s_sq =[[0]*(n+1) for u in range(n+1)]
ma = sq[0][0]
for i in range(n):
    for ii in range(n):
        s_sq[i][ii] = sq[i][ii] + s_sq[i][ii-1] + s_sq[i-1][ii] - s_sq[i-1][ii-1]
for tx,bx in combinations_with_replacement(list(range(n)),2):
    for ty,by in combinations_with_replacement(list(range(n)),2):
        #print "tx,ty=",tx,ty,"bx,by=",bx,by
        ma = max([ma,s_sq[by][bx]-s_sq[ty-1][bx]-s_sq[by][tx-1]+s_sq[ty-1][tx-1]])
print(ma)

# Optimized solution
n = eval(input())
sq = [list(map(int,input().split())) for u in range(n)]
s_sq = [[[0]*n for u in range(n)] for uu in range(n)]
#s_sq[lower_end][left_end][right_end]
ma = -1000 * 100 * 100
for y in range(n):
    temp = [0] * (n+1)
    for x in range(n):
        #make sum of the sequence left_end == 0, right_end == n
        temp[x] = temp[x-1] + sq[y][x]
    for tx in range(n):
        for ex in range(tx,n):
            s_sq[y][tx][ex] = max([0,s_sq[y-1][tx][ex]]) + temp[ex] - temp[tx-1]
            ma = max([ma,s_sq[y][tx][ex]])
print(ma)
# Original solution
n=int(input())
N=list(range(n))
N1=N+[n]
A=[[0]*(n+1)]+[[0]+list(map(int,input().split())) for i in N]
B=[[0 for j in N1] for i in N1]
N1=N1[1:]
for i in N1:
  x=A[i]
  if i==0: y=[0]*n
  else: y=B[i-1][:]
  s=0
  for j in N1:
    s+=x[j]
    y[j]+=s
  B[i]=y
m=-1e6
for i1 in N1:
  for j1 in N1:
    for i2 in range(i1,n+1):
      for j2 in range(j1,n+1):
        m=max(m,B[i1-1][j1-1]+B[i2][j2]-B[i1-1][j2]-B[i2][j1-1])
print(m)

# Optimized solution
def f(i,j):
  B=[0]*n
  m=[]
  for x in range(i,n):
    a=0
    for y in range(j,n):
      a+=A[y][x]
      B[y]+=a
    m.append(max(B[j:]))
  return max(m)

n=int(input())
N=list(range(n))
A=[list(map(int,input().split())) for i in N]
print(max([max([f(i,j) for i in N]) for j in N]))
# Original solution
def g(j,i):
  a=B[j-1][i-1]
  b1=B[j-1]
  m=[]
  for y in range(j,n+1):
    b=B[y]
    m.append(max([b[x]+a-b[i-1]-b1[x] for x in range(i,n+1)]))
  return max(m)
n=int(input())
N=list(range(n))
B=[[0]*(n+1) for _ in range(n+1)]
for j in N:
  A=list(map(int,input().split()))
  s=0
  b=B[j]
  for i in N:
    s+=A[i]
    B[j+1][i+1]=b[i+1]+s
N=N[1:]+[n]
m=[max([g(j,i) for i in N]) for j in N]
print(max(m))

# Optimized solution
m=-1e9
n=int(input())
B=[[0]*(n+1) for _ in range(n+1)]
for _ in range(n):
  A=list(map(int,input().split()))
  for j in range(n):
    s=0
    for k in range(j,n):
      s+=A[k]
      B[j][k]=max(B[j][k],0)+s
      m=max(B[j][k],m)
print(m)
# Original solution
m=-1e9
n=int(input())
N=list(range(n))
B=[[0]*(n+1) for _ in range(n+1)]
for _ in N:
  A=list(map(int,input().split()))
  for j in N:
    s=0
    for k in N[j:]:
      s+=A[k]
      B[j][k]=max(B[j][k],0)+s
      m=max(B[j][k],m)
print(m)

# Optimized solution
m=-1e9
n=int(input())
N=list(range(n))
B=[[0]*(n+1) for _ in range(n+1)]
for _ in N:
  A=list(map(int,input().split()))
  for j in N:
    s=0
    b=B[j]
    for k in N[j:]:
      s+=A[k]
      b[k]=max(b[k],0)+s
      m=max(b[k],m)
print(m)
# Original solution
while True:
    N, M, s, g1, g2 = list(map(int, input().split()))
    if N == M == s == g1 == g2 == 0:
        break
    s, g1, g2 = s - 1, g1 - 1, g2 - 1
    INF = 10 ** 5
    D = [[INF] * N for _ in range(N)]
    for i in range(N):
        D[i][i] = 0
    for _ in range(M):
        b1, b2, c = list(map(int, input().split()))
        b1, b2 = b1 - 1, b2 - 1
        D[b1][b2] = c
    for k in range(N):
        for i in range(N):
            for j in range(N):
                D[i][j] = min(D[i][j], D[i][k] + D[k][j])
    print((min(D[s][i] + D[i][g1] + D[i][g2] for i in range(N))))

# Optimized solution
while True:
    N, M, s, g1, g2 = list(map(int, input().split()))
    if N == M == s == g1 == g2 == 0:
        break
    s, g1, g2 = s - 1, g1 - 1, g2 - 1
    INF = 10 ** 5
    D = [[INF] * N for _ in range(N)]
    for i in range(N):
        D[i][i] = 0
    for _ in range(M):
        b1, b2, c = list(map(int, input().split()))
        b1, b2 = b1 - 1, b2 - 1
        D[b1][b2] = c
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if D[i][j] > D[i][k] + D[k][j]:
                    D[i][j] = D[i][k] + D[k][j]
    print((min(D[s][i] + D[i][g1] + D[i][g2] for i in range(N))))
# Original solution
r,g,b = input().split()
rgb = r+g+b
print(('YES' if int(rgb)%4==0 else 'NO'))


# Optimized solution
r,g,b=list(map(str,input().split()))
print(('YES' if int(r+g+b)%4==0 else 'NO'))
# Original solution
r, g, b = list(map(int,input().split()))
total = r*100 + g*10 + b
if total % 4 == 0:
	print('YES')
else:
	print('NO')

# Optimized solution
r,g,b = list(map(int,input().split()))
if (100*r + 10*g + b)%4 == 0:
    print('YES')
else:
    print('NO')
# Original solution
print(('YNEOS'[int(input().replace(' ',''))%4>0::2]))

# Optimized solution
print(('YNEOS'[int(input()[::2])%4>0::2]))
# Original solution
r,g,b = list(map(int,input().split()))
if (r*100+g*10+b)%4 == 0:
    print("YES")
else:
    print("NO")

# Optimized solution
r,g,b = input().split()
l = int(r+g+b)
print(("YES" if l%4 == 0 else "NO"))
# Original solution
a,b,c=list(map(int,input().split(' ')))
d=(b*10+c)%4
if d==0:
	print('YES')
else:
	print('NO')

# Optimized solution
# Problem https://atcoder.jp/contests/abc064/tasks/abc064_a
# Python 1st Try
rgbs = list(map(int,input().split(' ')))
g = rgbs[1]
b = rgbs[2]
answer =''
checkgb=((g*10+b)%4)
if checkgb == 0:
    answer = "YES"
else:
    answer = "NO"
print(answer)
# Original solution
import sys
input = sys.stdin.readline

rgb = int(''.join(input().split()))

if rgb % 4 == 0:
    print("YES")
else:
    print("NO")

# Optimized solution
import sys

r, g, b = sys.stdin.readline().split()

def main():
    return 'NO' if int(g + b) % 4 else 'YES'

if __name__ == '__main__':
    ans = main()
    print(ans)
# Original solution
a,b,c =list(map(int,input().split()))


if (a*100+b*10+c)%4==0:
    print("YES")
else:
    print("NO")

# Optimized solution
r,g,b =list(map(int,input().split()))

C=r*100+g*10+b

if C%4==0:
    print("YES")

else:
    print("NO")
# Original solution
a, b, c = list(map(int, input().split()))
A = 100*a + 10*b + c

if A % 4 == 0:
    print('YES')
else:
    print('NO')


# Optimized solution
r, g, b = list(map(int, input().split()))
rgb = 100*r+10*g+b
print(('YES' if rgb % 4 == 0 else 'NO'))
# Original solution
r, g ,b = (i for i in input().split())
num = int(r+g+b)
print(("YES" if num%4 == 0 else "NO"))

# Optimized solution
def main():
    A = [i for i in input().split()]
    S = "".join(A)
    N = int(S)
    print(("YES" if N % 4 == 0 else "NO"))


if __name__ == '__main__':
    main()
# Original solution
r,g,b=list(map(int, input().split()))
a = 100*r + 10*g + b

if a%4 ==0:
  print('YES')
else:
  print('NO')

# Optimized solution
r,g,b= list(map(int, input().split()))
a = r*100+g*10+b
print(('YES' if a %4==0 else 'NO'))
# Original solution
S_list = list(map(int,input().split()))

r, g, b = S_list[0], S_list[1], S_list[2]
if (100 * r + 10 * g + b) % 4 == 0 :
    result = "YES"
else:
    result = "NO"
print(result)


# Optimized solution
S_list = list(map(int,input().split()))

r, g, b = S_list[0], S_list[1], S_list[2]
if (10 * g + b) % 4 == 0 :
    result = "YES"
else:
    result = "NO"
print(result)
# Original solution
from sys import stderr, setrecursionlimit
from functools import reduce
from operator import add
setrecursionlimit(2147483647)
def f(n=1):
    if n == 1:
        return [int(i) for i in input().split()]
    res = []
    for i in range(n):
        res.append([int(j) for j in input().split()])
    return res
def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(str(item))
        stderr.write(sep)
    stderr.write(end)

rgb = int("".join(input().split()))
print(("NO" if rgb%4 else "YES"))


# Optimized solution
print((["NO","YES"][int("".join(input().split()))%4==0]))
# Original solution
#
# abc064 a
#
import sys
from io import StringIO
import unittest

def input():
    return sys.stdin.readline().rstrip()

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4 3 2"""
        output = """YES"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2 3 4"""
        output = """NO"""
        self.assertIO(input, output)


def resolve():
    r, g, b = list(map(int, input().split()))
    x = 100*r + 10*g + b
    ans = "NO"
    if x % 4 == 0:
        ans = "YES"
    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()


# Optimized solution
#
# abc064 a
#
import sys
from io import StringIO
import unittest


def input():
    return sys.stdin.readline().rstrip()


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4 3 2"""
        output = """YES"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2 3 4"""
        output = """NO"""
        self.assertIO(input, output)


def resolve():
    r, g, b = list(map(int, input().split()))
    if (100*r + 10*g + b) % 4 == 0:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    # unittest.main()
    resolve()
# Original solution
a = int(input().replace(" ",""))

if a % 4 == 0:
    print("YES")
    
else:
    print("NO")


# Optimized solution
a,b,c=input().split()
x=a
x+=b
x+=c
if int(x)%4==0:
    print('YES')
else:
    print('NO')