Let quasi-palindromic number be such number that adding some leading zeros (possible none) to it produces a palindromic string. String t is called a palindrome, if it reads the same from left to right and from right to left.For example, numbers 131 and 2010200 are quasi-palindromic, they can be transformed to strings "131" and "002010200", respectively, which are palindromes.You are given some integer number x. Check if it's a quasi-palindromic number.

The first line contains one integer number x (1 ≤ x ≤ 109). This number is given without any leading zeroes.

Print "YES" if number x is quasi-palindromic. Otherwise, print "NO" (without quotes).

a = int(raw_input())

while(a % 10 == 0):
    a /= 10

s = str(a);
if(s == s[::-1]):
    print "YES"
else:
    print "NO"

n=input()
i=len(n)-1
while n[i]=='0':
    i-=1
s=n[:i+1]
#print(s)
if s==s[::-1]:
    print("YES")
else:
    print("NO")

n=raw_input()
l=len(n)
i=l-1
s=n
c1,c2=0,0
while n[i]=='0':
	c1+=1
	i-=1
i=0
while n[i]=='0':
	c2+=1
	i+=1
k=c1-c2
for i in range(k):
	s='0'+s
flag=0
for i in range(len(s)/2):
	if s[i]==s[len(s)-i-1]:
		continue
	else:
		flag=1
		break
if flag==1:
	print "NO"
else:
	print "YES"

a=[0]*10
n=input()
t=0
s=len(n)-1
while s>=0and n[s]=='0':t+=1;s-=1
n='0'*t+n
for j in range(len(n)//2):
    if n[j]!=n[len(n)-1-j]:exit(print('NO'))
print('YES')

x = raw_input()
x = str(x)

if x[::-1] == x:
  print "YES"
else:
  len_add = len(x[:-1])

  for i in range(0, len_add):
    x = "0" + x
    if x[::-1] == x:
        print "YES"
        no = False
        break
    else:
        no = True

  if no == True:
    print "NO"

x=input().strip('0')
print('YES' if x==x[::-1] else 'NO')

s = input().strip('0')
print("YES") if s == s[::-1] else print("NO")

def is_palindrome(s):
  l, r = 0, len(s) - 1
  while l < r:
    if s[l] != s[r]:
      return False
    l += 1
    r -= 1
  return True

s = input()
r = len(s) - 1
while s[r] == '0':
  r -= 1
if is_palindrome(s[:r+1]):
  print('YES')
else:
  print('NO')

x=input();n=x.replace('0','')
if len(n)==0:exit(print('YES'))
x=x.replace('0','',x.find(n[0]))[::-1]
x=x.replace('0','',x.find(n[-1]))
print('YES' if x==x[::-1] else 'NO')

s = raw_input().strip('0')
print 'YES' if s == s[::-1] else 'NO'

p = input()
if p == p[::-1] or len(p) == 1:
    print("YES")
else:
    if p[0] != p[len(p) - 1] and '0' not in [p[0], p[len(p) - 1]]:
        print("NO")
    else:
        cl, cr = '', ''
        for i in p:
            if i == '0':
                cl+='0'
            else:
                break
        for i in p[::-1]:
            if i == '0':
                cr+='0'
            else:
                break
        if cl == cr and p != p[::-1]:
            print("NO")
        else:
            if len(cl) > len(cr):
                p += ('0' * (len(cl) - len(cr)))
                if p == p[::-1]:
                    print("YES")
                else:
                    print("NO")
            else:
                p = ('0' * (len(cr) - len(cl))) + p
                if p == p[::-1]:
                    print("YES")
                else:
                    print("NO")

value = input()

trailingZero = len(value) - len(value.rstrip('0'))
pal = trailingZero*'0' + value

if value == value[::-1]:
    print("YES")
elif pal == pal[::-1]:
    print("YES")
else:
    print("NO")

x = int(input())
for i in range(len(str(x))):
    y = x % 10
    if y != 0:
        break
    else:
        x = x // 10

if len(str(x)) % 2 == 0:
    j = len(str(x)) // 2
    m = str(x)[j:]
    if str(x)[:j] == m[::-1]:
        print("YES")
    else:
        print("NO")
else:
    j = len(str(x)) // 2
    m = str(x)[(j + 1):]
    if str(x)[:j] == m[::-1]:
        print("YES")
    else:
        print("NO")

x = input()
x = x[::-1]
x1 = str(int(x))
x2 = x1[::-1]
check = [False] *(len(x1))
for i in range(len(x1)):
    if x1[i] == x2[i]:
        check[i] = True
if check.count(False) == 0:
    print('YES')
else:
    print('NO')

ins = input()
ins = ins.strip("0")

print(["NO", "YES"][ins == ins[::-1]])

n=input()
while n%10 == 0:
	n/=10
d=str(n)
if d == d[::-1]:
	print "YES"
else: print "NO"

from sys import stdin
ans = 'NO'
n = int(stdin.readline())
while n%10==0:
 n/=10
a = str(n)
if a==a[::-1]:
 ans = 'YES'
print ans

n = raw_input()
n = n[::-1]
n = str(int(n))
if n == n[::-1]:
	print "YES"
else:
	print "NO"

l=raw_input().strip('0')
print('YES'if l[::-1]==l else'NO')

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File              : 863a.py
# Author            : recurze
# Date              : 16:32 08.12.2018
# Last Modified Date: 16:32 08.12.2018

s = str(raw_input()).lstrip('0').rstrip('0')
print ["NO", "YES"][s == s[::-1]]

s=raw_input()
t=s[::-1].lstrip('0')
if t==s.rstrip('0'):
    print 'YES'
else:
    print 'NO'

import math

a = str(input())

def palindrome(a):
  n = len(a)
  if n%2==0:
    for i in range(int(n/2)):
      if a[i]!=a[n-i-1]:
        return False
    return True
  else:
    for i in range(math.floor(n/2)):
      if a[i]!=a[n-i-1]:
        return False
    return True

i=1

while (i!=0):
  if palindrome(a):
    print("YES")
    i=0
  else:
    if a[-1]== '0':
      a=a[:-1]
    else:
      i=0
      print("NO")

s = raw_input()
t = s
t = s.strip('0')
if s.strip('0')[::-1] == t:
	print "YES"
else:
	print "NO"

t = input().rstrip('0')

if t == t[::-1]:
    print("YES")
else:
    print("NO")

n = input()
k = 0
for e in n[::-1]:
    if e == '0':
        k += 1
    else:
        break
n = k*'0' + n
if n == n[::-1]:
    ans = 'YES'
else:
    ans = 'NO'
print(ans)

from math import *
from decimal import *
from fractions import gcd
getcontext().prec = 20
import copy
def mp():
    return map(int,str(raw_input()).split())

s=str(raw_input())
a=''
flag=1
for i in range(len(s)-1,-1,-1):
    if flag==1 and s[i]=='0':
        pass
    else:
        flag=0
        a+=s[i]
#print a
if a==a[::-1]:
    print 'YES'
else:
    print "NO"

s = input()

for i in range(100):
    if s == s[::-1]:
        break
    s = '0' + s
if s == s[::-1]:
    print('YES')
else:
    print('NO')

def isPalindrome(s) :
    if len(s) <= 1 :
        return True
    else :
        if s[0] == s[len(s) - 1] :
            s2 = s[1 : len(s) - 1]
            return isPalindrome(s2)
        else :
            return False

s = raw_input()
i = len(s) - 1
while(True) :
    if s[i] == '0' :
        i -= 1
    else :
        break

s1 = s[0 : i + 1]

if(isPalindrome(s1)) :
    print("YES")
else :
    print('NO')

INF = 999999999999999999L
try:
    inFile = open("A.txt")
except:
    inFile = None

def read():
    if inFile:
        return inFile.readline().strip()
    else:
        return raw_input().strip()

def read_ints():
    return map(int,read().split())

s = read()
zero_cnt = 0
for i in reversed(range(len(s))):
    if s[i] == "0":
        zero_cnt += 1
    else:
        break

for i in range(len(s)):
    if s[i] == "0":
        zero_cnt -= 1
    else:
        break

s = "0"*zero_cnt + s
rev = s[::-1]
#print s
#print rev
if s == rev:
    print "YES"
else:
    print "NO"

def main():
	num = input()
	flag = False
	rev = num[::-1]
	if num == rev:
		flag = True
	else:
		length = len(num)
		while num[length-1] == '0':
			length = length-1
		num = num[0:length]
		rev = num[::-1]
		if num == rev:
			flag = True

	if flag == True:
		print("YES")
	else:
		print("NO")

if __name__ == "__main__":
	main()

a = raw_input()
s = 0
e = len(a) - 1

l = 0
while a[s] == '0':
    s += 1
    l += 1

r = 0
while a[e] == '0':
    e -= 1
    r += 1

#Check if pali
pali = False
if a[s:e+1] == ''.join(list(reversed(a[s:e+1]))):
    pali = True

if pali and l <= r:
    print "YES"
else:
    print "NO"

if __name__ == '__main__':
    s = input().strip('0')
    if s[::] == s[::-1]:
        print('YES')
    else:
        print('NO')

n = input()

check1 = True
check2 = True

l = len(n)-1
count1, count2 = 0, 0

for _ in range(len(n)):
    if int(n[_]) == 0 and check1:
        count1 += 1
    else:
        check1 = False

    if int(n[l]) == 0 and check2:
        count2 += 1
    else:
        check2 = False

    l -= 1

    if not check1 and not check2: break

count = abs(count1 - count2)

s = str(n)
st = ''

if count1 > count2:
    for _ in range(count):
        s += '0'
else:
    for _ in range(count):
        st += '0'
    s = st + s

if str(s) == str(s)[::-1]: print("YES")
else: print("NO")

l=input().strip('0')
print('YES'if l[::-1]==l else'NO')

s=input()
for i in range(14):
    s1='0'*i+s
    if s1==s1[::-1]:
        print('YES')
        exit()
print('NO')

x = raw_input()

def is_palindrome(x):
    i = 0
    j = len(x) - 1
    while i < j:
        if x[i] != x[j]:
            return False
        i += 1
        j -= 1
    return True

def is_quasi(x):
    for i in range(len(x)+1):
        if is_palindrome('0'*i + x):
            return True
    return False

print 'YES' if is_quasi(x) else 'NO'

n = map(str, raw_input())

def solve(a):
    k = len(a)
    for i in xrange(len(a) - 1, 0, -1):
        if n[i] == '0':
            k = k - 1
        else:
            break
    new_array = a[0:k]
    z = True
    for i in xrange(0, k/2):
        if new_array[i] != new_array[k - i - 1]:
            z = False
            break
    return z

if solve(n):
    print 'YES'
else:
    print 'NO'

s = list(input())
while len(s) and s[0]=="0":
    s.remove("0")
while len(s) and s[-1]=="0":
    s.pop()
t = s.copy()
t.reverse()
if t ==s:
    print("YES")
else:
    print("NO")

value = input()

trailingZero = len(value) - len(value.rstrip('0'))
pal = trailingZero*'0' + value

if value == value[::-1]:
    print("YES")
elif pal == pal[::-1]:
    print("YES")
else:
    print("NO")

w=raw_input()
p="NO"
for z in range(10):
	pad="0"*z
	w1=pad+w
	if w1==w1[::-1]:
		p="YES"
print p

n = input()
def ispolindrome(n):
    ans = 0
    if len(n) % 2 == 0:
        ans_len = len(n) // 2
    else:
        ans_len = (len(n) // 2) + 1
    for i in range(ans_len):
        if n[i] == n[len(n) - 1 - i]:
            ans += 1
    if len(n) % 2 and ans == (len(n) // 2) + 1:
        return True
    elif len(n) % 2 == 0 and ans == len(n) // 2:
        return True
    else:
        return False
if ispolindrome(n):
    print("YES")
else:
    n = list(n)
    ans_len = False
    for i in range(len(n)):
        if n[len(n) - 1 - i] == "0":
            ans_len = len(n) - 1 - i
        else:
            break
    if ans_len != False and ispolindrome(n[:ans_len]):
        print("YES")
    else:
        print("NO")

def main():
    n = list(input())
    n = n[::-1]

    #print(n)
    while n[0] == '0':
        n.remove('0')
        #print (n)

    if n[:] == n[::-1]:
        print ("YES")
    else:
        print ("NO")

main()

s=list(input())
n=len(s)
t,flag=1,1
z=s[::-1]
for i in z:
	if i=='0':
		t+=1
	else:
		break
# print(t)
for i in range(t):
	for j in range(n):
		if s[j]==s[-(j+1)]:
			pass
		else:
			flag=0
			break
		flag=1
	# print(s)
	s.insert(0,'0')
	n+=1
if flag==1:
	print("YES")
else:
	print("NO")

f = lambda l: 'YES' if l==l[::-1] else 'NO'

n = input().strip('0')

print(f(n))

#coding: utf-8

def CheckQuasiPalindrome(n):
    num = n.rstrip('0')
    return num == num[::-1]

if __name__ == "__main__":
    n = raw_input()
    print "Yes" if CheckQuasiPalindrome(n) else "No"

s = input()
while s != s[::-1]:
    s = '0' + s
    if len(s) > 40: break
print('YNEOS'[len(s) > 40::2])

n=list(input())
for i in range(len(n)):
	if n[i]=="0":
		n.remove(n[i])
	else:
		break
for i in range(len(n)-1,-1,-1):
	if n[i]=="0":
		n.pop(i)
	else:
		break
r=len(n)
c=0
for i in range(r):
	if n[i]==n[-(i+1)]:
		c+=1
	else:
		print("NO")
		break
if r==c:
	print("YES")

s = list(input())
count = 0
for i in range(len(s)-1,-1,-1):
	if s[i]=="0":
		count += 1
	else:
		break
for k in range(count):
	s.pop()
if s==s[::-1]:
	print("YES")
else:print("NO")

def ispalindrome(s):
	mid=len(s)//2
	if mid==1:
		if s[0]!=s[-1]:
			return False
	else:
		for i in range(mid):
			if s[i]!=s[-1-i]:
				return False
	return True
def main():
	s=input()
	check=""
	for i in range(-1, -len(s)-1, -1):
		if(s[i]!='0'):
			break
	for j in range(len(s)):
		if(s[j]!='0'):
			break
	if i==-1:
		check=s
	else:
		check=s[j:i+1]
	if ispalindrome(check):
		print("YES")
	else:
		print("NO")
main()

from sys import stdin
ans = 'NO'
n = int(stdin.readline())
while n%10==0:
 n/=10
a = str(n)
if a==a[::-1]:
 ans = 'YES'
print ans

s = input()
for i in range(len(s)):
    if s[-1] == '0':
        s = s[0:-1]
    else:
        break
if s == s[::-1]:
    print('YES')
else:
    print('NO')

s = input()
ind1 = 0
while int(s[ind1]) == 0:
    ind1 += 1
ind2 = len(s) - 1
while int(s[ind2]) == 0:
    ind2 -= 1
s1 = s[ind1:ind2+1]
if s1[::-1] == s1 and ind1 <= len(s) - ind2:
    print('YES')
else:
    print('NO')

x = input().strip('0')
print('YES'if x[::-1] == x else'NO')

# CodeForcesian
# ♥

n = input()
while (n % 10 == 0) :
	n /= 10

n = str(n)
it = 0;
while it < len(n) :
	if n[ it ] != n[ len(n) - it - 1] :
		print "NO"
		exit()
	it += 1;

print "YES"

def isPalindrome(s):
    n=len(s)
    i=0
    while i*2<n:
        if s[i]!=s[n-1-i]:
            return False
        i+=1
    return True
if isPalindrome(input().rstrip('0')):
    print('YES')
else:
    print('NO')

a=raw_input()
for i in xrange(len(a)):
  if a[len(a)-i-1]!='0':
    a=a[:len(a)-i]
    break
if a==a[::-1]:
  print 'YES'
else:
  print "NO"

def is_palindrome(s):
  l, r = 0, len(s) - 1
  while l < r:
    if s[l] != s[r]:
      return False
    l += 1
    r -= 1
  return True

s = input()
r = len(s) - 1
while s[r] == '0':
  r -= 1
if is_palindrome(s[:r+1]):
  print('YES')
else:
  print('NO')

ins = input()
ins = ins.strip("0")

print(["NO", "YES"][ins == ins[::-1]])

R = lambda:map(int,input().split())

s = input().strip('0')
if s == s[::-1]:
    print('YES')
else:
    print('NO')

t = input().rstrip('0')

if t == t[::-1]:
    print("YES")
else:
    print("NO")

a=[int(q) for q in list(input())]
a=a[::-1]
if a[0]==0 and len(a)==1:
    print('YES')
else:
    while(1):
        if a[0]==0:
            a.pop(0)
        else:
            break
    if a==a[::-1]:
        print('YES')
    else:
        print('NO')

def is_palindrome(s):
    n = len(s)
    for i in range(n // 2):
        if s[i] != s[n-1-i]:
            return False
    return True

def main():
    x = input()

    # Find index of first non zero
    first_nonzero_idx = 0
    for i in reversed(range(len(x))):
        if x[i] != '0':
            first_nonzero_idx = i
            break

    if is_palindrome(x[:first_nonzero_idx+1]):
        print("YES")
    else:
        print("NO")

main()

# http://codeforces.com/contest/863/problem/A
s = str(input())
c = 0
for i in range(len(s)-1, -1, -1):
	if s[i] == "0":
		c += 1
	else:
		break
ans = ""
while(c):
	ans += "0"
	c -= 1
ans += s

print("YES" if ans == ans[::-1] else "NO")

t = input()
val = []
flag = 0
count = 0

for i in str(t):
    val.append(i)

for j in reversed(val):
    if (j == "0" and flag == 0):
        #print j
        count += 1
    if (j != "0"):
        flag = 1

t = str(t)

if t[:len(t)-count] == str(t)[len(t)-count-1::-1]:
    print "YES"
else:
    print "NO"

n=input()
while n%10 == 0:
	n/=10
d=str(n)
if d == d[::-1]:
	print "YES"
else: print "NO"

n=raw_input()
n=list(n)
while n[-1]=='0':n.pop()
if n==list(reversed(n)):print "YES"
else: print "NO"

import sys
import math
import bisect
import itertools

def main():
    A = list(input())
    n = len(A)
    cnt = 0
    for i in range(n - 1, - 1, -1):
        if A[i] == '0':
            cnt += 1
        else:
            break
    A = ['0'] * cnt + A
    if A == A[::-1]:
        print('YES')
    else:
        print('NO')

if __name__ == "__main__":
    main()

str = str(raw_input())
str = str.rstrip("0")
if(list(reversed(str)) == list(str)):
  print "YES"
else:
  print "NO"

if __name__== "__main__":
    s=raw_input()
    k=len(s)
    j=0
    for i in range(k-1,-1,-1):
        if s[i]!='0':
            break
        else:
            j+=1
    a=s[:k-j]
    l=len(a)
    f=1
    for i in range(l):
        if a[i]!=a[l-1-i]:
            f=0
            print "NO"
            break
    if f:
        print "YES"

v = int(input())

while v%10 == 0 and v > 0:
    v //= 10

s = str(v)

if s == s[::-1]: print("YES")
else: print("NO")

import sys
from itertools import *
from cmath import *

input = sys.stdin.readline
from math import *

############ ---- Input Functions ---- ############
def inp():
    return int(input().strip())

def inlt():
    return list(map(int, input().split()))

def insr():
    s = input()
    return list(s[:len(s) - 1])

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

def iss(s):
    t=s[::-1]
    return t==s

s=insr()
while s[len(s)-1]=='0':
    s.pop()

print("YES" if iss(s) else "NO")

n=int (raw_input())

finalNum=n
div10=True
while div10==True:
    if finalNum%10==0:
        finalNum/=10
    else:
        div10=False
finalNum=str(finalNum)
i=-len(finalNum)
f=-1
toPrint='YES'
while i <=f and toPrint=='YES' :
    if finalNum[i] != finalNum[f]:
        toPrint='NO'
    i+=1
    f-=1
print toPrint

import sys

s = sys.stdin.readline().strip()
r = s[::-1]

i = 0
while r[i] == '0':
    i+=1

p = r[i:]
if p == p[::-1]:
    print "YES"
else:
    print "NO"

def polindrom(s):
    st2 = ''
    for i in s:
        st2 = i + st2
    return st2;
a = input()
k = 0
test = True
while test:
    if (k>8 or a == polindrom(a)):
        if (a==polindrom(a)):
            test = True
        else:
            test = False
        break
    else:
        a = '0' + a
        k+=1
if test:
    print("YES")
else:
    print("NO")

n=int(input())
while n%10==0:
    n=n/10
saven=n
b=0
while saven>0:
    b=10*b+saven%10
    saven=int(saven/10)
if b==n:
    print("YES")
else:
    print("NO")

x = input()
for i in range(10):
    if list(x) == list(x)[::-1]:
        print("YES")
        break
    x = "0"+x
else: print("NO")

s=input()
def p(s):
    return s==s[::-1]
s=s.rstrip('0')
if p(s):
        print("YES")

else:
       print("NO")

def isPalindrome(s):
    if s==s[::-1]:
        return True
    else:
        return False
if isPalindrome(input().rstrip('0')):
    print('YES')
else:
    print('NO')

x = raw_input().strip()
for i in range(len(x) - 1, -1, -1):
    if x[i] == '0':
        x = x[:-1]
    else:
        break
f = 0
l = len(x) - 1
v = True
while f <= l:
    if x[f] != x[l]:
        v = False
        break
    f += 1
    l -= 1
if v == False:
    print "NO"
else:
    print "YES"

n = int(raw_input())
while n%10 == 0:
	n /= 10
s = str(n)
ret = True
for i in range(len(s)/2):
	if s[i] != s[-(1+i)]:
		ret = False
		break
print "YES" if ret else "NO"

f = lambda l: 'YES' if l==l[::-1] else 'NO'

n = input().strip('0')

print(f(n))

s=input().strip('0')
if s==s[::-1]:
    print('yes')
else:
    print('no')

n = int(raw_input())
s = str(n)
l = len(s)
for i, c in enumerate(s):
    if c != '0':
        l = len(s)
    elif l > i-1:
        l = i
print "YES" if s[:l] == s[:l][::-1] else "NO"

n=raw_input()
n=list(n)
while n[-1]=='0':n.pop()
if n==list(reversed(n)):print "YES"
else: print "NO"

def checkQP(inputStr):
	inputStr = inputStr.strip("0")
	if inputStr == inputStr[::-1]:
		return "YES"
	else:
		return "NO"

if __name__ == '__main__':
	while True:
		try:
			inputStr = input()
			print(checkQP(inputStr))
		except EOFError:
			break

R = lambda:map(int,input().split())

s = input().strip('0')
if s == s[::-1]:
    print('YES')
else:
    print('NO')

a=[int(q) for q in list(input())]
a=a[::-1]
if a[0]==0 and len(a)==1:
    print('YES')
else:
    while(1):
        if a[0]==0:
            a.pop(0)
        else:
            break
    if a==a[::-1]:
        print('YES')
    else:
        print('NO')

x = input()
x = x[::-1]
x1 = str(int(x))
x2 = x1[::-1]
check = [False] *(len(x1))
for i in range(len(x1)):
    if x1[i] == x2[i]:
        check[i] = True
if check.count(False) == 0:
    print('YES')
else:
    print('NO')

x=raw_input()
f=0
z=x[::-1]
if z==x:
	f=1
for i in range(0,len(x)):
	y='0'+x
	j=y[::-1]
	if y==j:
		f=1
		break
if f==1:
	print("YES")
else:
	print("NO")

n=int(input())
while n<1 and n>10**9:
    n=int(input())
t=str(n)
j=0
for i in t:
    if t.count(i)%2!=0:
        j+=1
    if j>=1and len(t)%2==0:
        print('no')
        break
else :
    print('yes')

x = raw_input()
while x != x[::-1] and len(x) < 18:
    x = "0" + x
if x == x[::-1]:
    print "YES"
else :
    print "NO"

def pol(n):
    c=n
    length=len(n)
    count=0
    if n[len(n)-1]=="0":
        for i in range(len(n)-1,-1,-1):
            if n[i]=="0":
                count+=1
            else:
                break
    if count!=0:
        for i in range(count):
            n="0"+n
        n="".join(reversed(n))
        t="".join(reversed(c))
        if n[:length]==t:
            return "Yes"
        else:
            return "No"
    else:
        if c=="".join(reversed(n)):
            return "Yes"
        else:
            return "No"

print(pol(input().strip()))

import sys

num = sys.stdin.readline().strip("0")

middle = len(num) // 2 + 1

for i in range(middle):
    if num == "" or type(num) != str:
        print("NO")
        break
    if num[i] != num[-i - 1]:
        print("NO")
        break
    elif i == middle - 1:
        print("YES")
    else:
        continue

inp = input()
inp = inp.strip('0')
if inp == inp[::-1]:
    print('Yes')
else:
    print('No')
print(inp)

string = input()

odd_cnt = 0

for i in range(10):
        chn = str(i)

        if string.count(chn) % 2 == 1:
                odd_cnt += 1

if odd_cnt <= 1:
        print('YES')
else:
        print('NO')

a=list(input())
if a[-1]!='0':
    print('NO')
else:
    for i in range(len(a)-1,-1,-1):
        if a[i]=='0':
            a.pop(i)
        else:
            break
    p=len(a)
    p1=a[:]
    p2=p*[0]
    for i in range(p-1,-1,-1):
        p2[p-i-1]=a[i]
    if p1==p2:
        print('YES')
    else:
        print('NO')

S=input()
N=len(S)
D=[]
C=[]
C1=[]
for i in range(0,N):
  D.append(S[i])
for i in range(0,N):
  if D[i] not in C:
    if((D.count(D[i]))%2==0):
      C.append(D[i])
    else:
      if D[i] not in C1:
        C1.append(D[i])
if(len(C)<len(C1)):
  print("NO")
else:
  print("YES")

n = input()
z_cnt = 0
flag = 0
if n[0] == '0':
        for x in n:
                if x == '0' and flag == 0:
                        z_cnt += 1
                else:
                        flag = 1
        n = z_cnt * '0' + n
else:
        n = n[::-1]
        for x in n:
                if x == '0' and flag == 0:
                        z_cnt += 1
                else:
                        flag = 1
        n = n + z_cnt * '0'
print(n)
i = n[::-1]
if i == n:
        print('YES')
else:
        print('NO')

t = input()
if(t == t[::-1]) :
	print('YES')
else :
	t = '00' + t
	if(t == t[::-1]) :
		print('YES')
	else :
		print('NO')

t=input().lstrip('0')

if t == t[:-1]:
    print("YES")
else:
    print("NO")

n = input()
d = []
for i in n:
    if i != "0":
        d.append(i)
if d == list(reversed(d)):
    print("YES")
else:
    print("NO")

n=int(input("Enter number:"))
temp=n
rev=0
while(n>0):
    dig=n%10
    rev=rev*10+dig
    n=n//10
if(temp==rev):
    print("The number is a palindrome!")
else:
    print("The number isn't a palindrome!")

a=raw_input()
for i in xrange(len(a)):
  if a[len(a)-i-1]!='0':
    a=a[:-i]
    break
if a==a[::-1]:
  print 'YES'
else:
  print "NO"

a = input()
if a == a[::-1]:
    print('YES')
else:
    b = int(a[::-1])
    if b == a[:len(str(b))]:
        print('YES')
    else:
        print('NO')

l=input()
print('YES' if l.replace('0','')[::-1]==l.replace('0','') else 'NO')

a=raw_input()
while a and a[-1]=='0':a=a[:-1]
def palin(x):
    for i in range(len(x)/2):
        if x[i] != x[len(x)-1-i]:return False
        return True
print"YES"if palin(a)else"NO"

from sys import stdin
lines = stdin.readlines()
x = str(lines[0])
c = x[::-1]
summ = 0
for i in c:
    if i != "0":
        break
    elif i == "0":
        summ += 1
x = "0"*summ+x

def pal(x):
    c = x[::-1]
    for i in range(len(x)/2):
        if x[i] != c[i]:
            return False
    return True
if pal(x):
    print "YES"
else:
    print "NO"

s = input()
print( "YES" if s == s[::-1] else "NO")

n=str(input())
d=n[::-1]
f=0
for i in range(0,len(d)):
    if(d[i]!='0'):
        f=i
        break
n=n[0:(len(n)-f)]
e=0
for i in range(0,len(n)):
    if(n.count(n[i])%2!=0):
        e=e+1
if(e==1):
    print('YES')
else:
    print('NO')

c = str(input())
x= len(c)-len(c.rstrip('0'))
c= x*'0'+c

l=len(c)

j= c[: l//2]

k= c[l//2+1:]
k=k[::-1]
if j==k:
    print("YES")
else:
    print("NO")

import sys
import math

#to read string
get_string = lambda: sys.stdin.readline().strip()
#to read list of integers
get_int_list = lambda: list( map(int,sys.stdin.readline().strip().split()) )
#to read non spaced string and elements are integers to list of int
get_intList_from_str = lambda: list(map(int,list(sys.stdin.readline().strip())))
#to read non spaced string and elements are character to list of character
get_charList_from_str = lambda: list(sys.stdin.readline().strip())
#get word sepetared list of character
get_char_list = lambda: sys.stdin.readline().strip().split()
#to read integers
get_int = lambda: int(sys.stdin.readline())
#to print faster
pt = lambda x: sys.stdout.write(str(x))

#--------------------------------WhiteHat010--------------------------------#
def pallindrom(s):
    for i in range(len(s)//2):
        if s[i] != s[~i]:
            return False
        return True

string = ''.join(input().split('0'))
if pallindrom(string):
    print("YES")
else:
    print("NO")

def pol(n):
    c=n
    length=len(n)
    count1=0
    count2=0
    if n[len(n)-1]=="0":
       for i in range(len(n)-1,-1,-1):
            if n[i]=="0":
                count1+=1
            else:
                break
    if n[0]=="0":
        for i in range(len(n)):
            if n[i] == "0":
                count2 += 1
            else:
                break
    print(count1)
    print(count2)
    if count1-count2!=0:
        for i in range(count1-count2):
            n="0"+n
        t="".join(reversed(c))
        print(t)
        if n[:length]==t:
            return "YES"
        else:
            return "NO"
    else:
        if c=="".join(reversed(n)):
            return "YES"
        else:
            return "NO"

print(pol(input().strip()))

x=raw_input()
f=0
z=x[::-1]
if z==x:
	f=1
for i in range(0,len(x)):
	y='0'+x
	j=y[::-1]
	if y==j:
		f=1
		break
if f==1:
	print("YES")
else:
	print("NO")

def main():
	s=input()
	check=""
	for i in range(-1, -len(s)-1, -1):
		if(s[i]!='0'):
			break
	for j in range(len(s)):
		if(s[j]!='0'):
			break
	if i==-1:
		check=s
	else:
		check=s[j:i+1]
	if ispalindrome(check):
		print("YES")
	else:
		print("NO")
def ispalindrome(s):
	mid=len(s)//2
	if len(s)%2==0:
		for i in range(mid):
			if s[i]!=s[-1-i]:
				break
		else:
			return True
	else:
		for i in range(mid-1):
			if s[i]!=s[-1-i]:
				break
		else:
			return True
	return False
main()

x=str(input())
a=x.count("0")
s=""
if a>0:
    while a<=2*x.count("0"):
        if x==x[::-1]:
            s=1
            break
        x="0"+x
if s==1:
    print("yes")
else:
    print("no")

import sys

for line in sys.stdin:
    for var in line.split():
        print(var)
        r=var[::-1]
        for b in r:
            if(b!="0"):
                break
            if(var[0]!=b):
                var=var[:-1]
        r=var[::-1]
    print(var+" "+r)
    if(var==r):
        print("YES")
    else:
        print("NO")

num1 = list(raw_input())
num2 = num1[::-1]
if len(num1) == 1:
    print("YES")

ind0= 0
count = 0

while num2[ind0] == "0":
    count += 1
    ind0+= 1

ind0 = 0
while num1[ind0] == "0":
    count -= 1
    ind0 += 1

ls = ["0"] * count
num = ls + num1

pal = True
start = 0
end = len(num) -1

while start < end:
    if num[start] != num[end]:
        pal = False
        break
    start += 1
    end -= 1

if pal:
    print("YES")
else:
    print("NO")

s=input()
l=len(s)
for i in range(0,l):
    if s[i]!='0':
        s=s[i:]
        break
l=len(s)
for i in range(1,l):
    if s[l-i]!='0':
        s=s[:l-i+1]
        break
l=len(s)
f=0
for i in range(0,int(l/2)):
    if(s[i]!=s[l-i-1]):
        f=1
        break
if f==0:
    print("YES")
else:
    print("NO")

s = raw_input()
print 'YES' if s == s[::-1] else 'NO'

a = input()
st1 = ''
st2 = ''
for i in a:
    if i != '0':
        st1 += i
for i in st1:
    st2 = i + st2
if st1 == st2:
    print("YES")
else:
    print("NO")

# Main maut ko takiya, aur kafan ko chadaar banakar audhta hoon!

s=input()

s.replace("0","")

if s==s[::-1]:
    print("YES")

else:
    print("NO")

n=list(input())
for i in range(len(n)):
	if n[i]=="0":
		n.remove(n[i])
	else:
		break
for i in range(len(n)):
	if n[-i]=="0":
		n.remove(n[-i])
	else:
		break
r=len(n)
c=0
for i in range(r):
	if n[i]==n[-(i+1)]:
		c+=1
	else:
		print("NO")
		break
if r==c:
	print("YES")

def main():
    s = input()
    ss = ''
    for i in range(len(s) - 1, -1, -1):
        if s[i] == '0':
            ss += '0'
    ss += s
    #print(ss)
    for i in range(0, len(ss) // 2 + 1):
        #print(ss[i], ss[len(ss) - 1 - i])
        if ss[i] != ss[len(ss) - 1 - i]:
            print('NO')
            return
    print('YES')

main()

a=list(input())
if a[-1]!='0':
    print('NO')
else:
    for i in range(len(a)-1,-1,-1):
        if a[i]=='0':
            a.pop(i)
        else:
            break
    p=len(a)
    p1=a[:]
    p2=p*[0]
    for i in range(p-1,-1,-1):
        p2[p-i-1]=a[i]
    if p1==p2:
        print('YES')
    else:
        print('NO')

a=[0]*10
n=input()
for i in n:
    a[int(i)]^=1
if sum(a)<2:print('YES')
else:print('NO')

stdout

YES

import math
a = str(input())
def palindrome(a):
n = len(a)
if n%2==0:
for i in range(int(n/2)):
if a[i]!=a[n-i-1]:
return False
return True
else:
for i in range(math.floor(n/2)):
if a[i]!=a[n-i-1]:
return False
return True
i=1
while (i!=0):
if palindrome(a):
print("YES")
i=0
else:
if a[-1]== '0':
a=a[:-1]
else:
i=0
if i==1:
print("NO")

n=int(input("Enter number:"))
temp=n
rev=0
while(n>0):
    dig=n%10
    rev=rev*10+dig
    n=n//10
if(temp==rev):
    print "YES"
else:
    print "NO"

s = input()

if s == s[::-1]:
	print('YES')
else:
	for i in range(1, len(s)//2):
		p = s[:-i]
		if p == p[::-1]:
			print('YES')
			break
	else:
		print('NO')

x = list(input())
while "0" in x: x.remove("0")
if x == x[::-1]: print("YES")
else: print("NO")

a=[0]*10
n=input()
for i in n:
    a[int(i)]^=1
if sum(a)-a[0]<2:print('YES')
else:print('NO')

x = raw_input()
x = str(x)

if x[::-1] == x:
  print "YES"
else:
  len_add = len(x[:-1])

  for i in range(0, len_add):
      x = "0" + x
      if x[::-1] == x:
        print "YES"
        break
  print "NO"

x=int(input())
ch=str(x)
d={}
for i in range(len(ch)):
    if ch[i] in d:
        d[ch[i]]+=1
    else:
        d[ch[i]]=1
if len(ch)%2==0:
    test=True
    for i in range(len(ch)):
        if d[ch[i]]%2==1:
            test=False
            break
else :
    k=0
    test=True
    for i in range(len(ch)):
        if d[ch[i]]%2==1:
            k+=1
    if k>1 :
        test=False
if test :
    print('Yes')
else :
    print('NO')

import sys
from itertools import *
from cmath import *

input = sys.stdin.readline
from math import *

############ ---- Input Functions ---- ############
def inp():
    return int(input().strip())

def inlt():
    return list(map(int, input().split()))

def insr():
    s = input()
    return list(s[:len(s) - 1])

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

def iss(s):
    t=s[::-1]
    return t==s

s=insr()
while '0' in s:
    s.remove('0')

print("YES" if iss(s) else "NO")

input = input()
input = input.rstrip()
quasi = True
for i in range(len(input)):
    j = len(input) - 1 - i
    if input[i] != input[j]:
        quasi = False
        print("NO")
        break
if quasi:
    print("YES")

def check(s,n):
    for i in xrange(n/2):
        if s[i]!=s[n-i-1]:
            return False
        return True

s=raw_input().strip('0')
n=len(s)
if check(s,n)== True:
    print "YES"
else:
    print "NO"

YES

# http://codeforces.com/contest/863/problem/A
s = str(input())
ans = ""

for x in s:
	if x != "0":
		ans += x
print("YES" if ans == ans[::-1] else "NO")

n=int(input())
while n>10**9 and n<1:
    n=int(input())
t=str(n)
j=0
for i in t :
    if t.count(i)%2!=0:
        j+=1
    if j>1:
        print('no')
        break
    if j==1 and len(t)%2==0:
        print('no')
        break
else :
    print('yes')

n = input()

def isp(s):
    ok = True
    for i in range(len(s)//2):
        ok &= s[i] == s[-i]
    return ok

for i in range(20):
    s = n.rjust(i, '0')
    if isp(s):
        print("YES")
        exit(0)
print("NO")

n=list(input())
for i in range(len(n)):
	if n[i]=="0":
		n.remove(n[i])
	else:
		break
for i in range(len(n)):
	if n[-i]=="0":
		n.remove(n[-i])
	else:
		break
r=len(n)
c=0
for i in range(r):
	if n[i]==n[-(i+1)]:
		c+=1
	else:
		print("NO")
if r==c:
	print("YES")

def main():
	s=input()
	check=""
	for i in range(-1, -len(s)-1, -1):
		if(s[i]!='0'):
			break
	for j in range(len(s)):
		if(s[j]!='0'):
			break
	if i==-1:
		check=s
	else:
		check=s[j:i+1]
	if ispalindrome(check):
		print("YES")
	else:
		print("NO")

n=input()
s=str(n)
s=s[::-1]
cnt=0
for i in range(len(s)):
    if s[i]=='0':
        cnt+=1
s=s[cnt:]
if s==s[::-1]:
    print "YES"
else:
    print "NO"

row = raw_input()
i = 0
j = len(row)
row = list(row)
while i < j:
    if row[i] != '0':
        break
    else:
        del row[i]
    i +=1
i = 0
while i < j:
    if row[j-1] != '0':
        break
    else:
        del row[j-1]
    j -= 1
    i += 1
#print row
i,j = 0,len(row)
flag = 1
if len(row) % 2 == 0:
    #print i ,j
    while i < j-1:
        if row[i] != row[j-1]:
            flag = 0
        i += 1
        j -= 1
#else:
#    while i < j:
#        if row[i] != row[j]-1:
#            flag = 0
#        i += 1
#        j -= 1
if flag:
    print 'YES'
else:
    print 'NO'

num = list(input())
num = [x for x in num if x != '0']
copy = [y for y in num]
num.reverse()
if copy == num:
    print('YES')
else:
    print('NO')

S=input()
N=len(S)
D=[]
C=[]
C1=[]
for i in range(0,N):
  D.append(S[i])
for i in range(0,N):
  if D[i] not in C:
    if D[i] not in C1:
      if((D.count(D[i]))%2==0):
        C.append(D[i])
      else:
        if(D[i]!='0'):
          C1.append(D[i])
        else:
          C.append(D[i])
j=0
if(S[0]!=S[N-1]):
  if(S[0]!='0' and S[N-1]!='0'):
    j=1
if (len(C1)>1 or j==1):
  print("NO")
else:
  print("YES")

x = raw_input()
x = str(x)

if x[::-1] == x:
  print "YES"
else:
  len_add = len(x[:-1])

  for i in range(0, len_add):
      x = "0" + x
      if x[::-1] == x:
        print "YES"
        break
  print "NO"

def main():
	s=input()
	for i in range(-1, -len(s)-1, -1):
		if(s[i]!='0'):
			break
	for j in range(len(s)):
		if(s[j]!='0'):
			break
	if ispalindrome(s[j:i+1]):
		print("YES")
	else:
		print("NO")
def ispalindrome(s):
	mid=len(s)//2
	if len(s)%2==0:
		for i in range(mid):
			if s[i]!=s[-1-i]:
				break
		else:
			return True
	else:
		for i in range(mid-1):
			if s[i]!=s[-1-i]:
				break
		else:
			return True
	return False
main()

n = input()
d = []
for i in n:
    if i != "0":
        d.append(i)
k = len(d) // 2
if len(d) == 0:
    print("YES")

elif len(d) % 2 == 0:
    a = d[k:]
    a = reversed(a)
    if d[:k] == list(a):
        print("YES")
    else:
        print("NO")
else:

    a = d[k + 1:]
    a = reversed(a)
    if d[:k] == list(a):
        print("YES")
    else:
        print("NO")

import sys

num = sys.stdin.readlines()[0].strip("0")

if num[::-1] == num:
    print("YES")
else:
    print("NO")

n = input()
d = []
for i in n:
    if i != "0":
        d.append(i)
if d == list(reversed(d)):
    print("YES")
else:
    print("NO")

n = [int(i) for i in input() if int(i)!=0]
l = [0]*9

for e in n:
	l[int(e)-1]+=1
ev = 0
od = 0
for i in l:
	if i==0:
		pass
	elif i%2==0:
		ev+=1
	elif i%2!=0:
		od+=1
if len(n)%2==0:
	if od==0:
		print("YES")
	else:
		print("NO")
else:
	if od==1:
		print("YES")
	else:
		print("NO")

inputs = input()
length = len(inputs)
arr = list('1'*length)
for i in range(length):
    arr[i] = inputs[i]
i = 0
while i < length:
    if inputs[i] != '0':
        break
    i = i + 1
start = i
i = length
while i >= 0:
    i = i - 1
    if inputs[i] != '0':
        break
end = i
if start >= end:
    print("YES")
while start <= end:
    if inputs[start] != inputs[end]:
        print("NO")
        quit()
    else:
        start = start + 1
        end = end - 1

print("YES")

import sys

for line in sys.stdin:
    for var in line.split():
        print(var)
        r=var[::-1]
        for b in r:
            if(b!="0"):
                break
            if(var[0]!=b):
                var=var[:-1]
        r=var[::-1]
    print(var+" "+r)
    if(var==r):
        print("YES")
    else:
        print("NO")

x = input()
t = int(x)
k = 0
i = 0
if t%10 == 0:
	for i in range(len(x)):
		if t%10 == 0:
			t = int(t/10)
		else:
			break
r = str(t)
for i in range(int(len(r)/2)):
	if r[i] == r[len(r)-i-1]:
		continue
	else:
		k = 1
		break
if i == int(len(r)/2) - 1 and k == 0 or i == 0 and k == 0:
	print("YES")
else:
	print("NO")

s = input()

ctl = 0
ctr = 0
if s != s[::-1] :
    for x in s :
        if x == '0' :
            ctl += 1
        else :
            break
    for x in s[::-1] :
        if x  == '0' :
            ctr += 1
        else :
            break
    sn = s[ctl : -1 * ctr]
    if sn == sn[::-1] : print('YES')
    else : print('NO')

else :
    print('YES')

t = input()
if(t == t[::-1]) :
	print('YES')
else :
	t = '00' + t
	if(t == t[::-1]) :
		print('YES')
	else :
		print('NO')

number = input()
# number = "12100"
# index = len(number) - 1
if len(number) % 2 == 0:
    if number[-1] == "0":
        index = len(number) - 1
        while number[index] == "0":
            index -= 1
        number = number[0:index + 1]
        middle = len(number) // 2
        first = list(number[:middle])
        second = list(number[middle:])
        second = list(reversed(second))
        # print(index, number, middle, first, second)
        if first == second:
            print('YES')
        else:
            print('NO')
    else:
        middle = len(number) // 2
        first = list(number[:middle])
        second = list(number[middle:])
        second = list(reversed(second))
        # print(number, middle, first, second)
        if first == second:
            print('YES')
        else:
            print('NO')
else:
    if number[-1] == "0":
        index = len(number) - 1
        while number[index] == "0":
            index -= 1
        number = number[0:index + 1]
        middle = len(number) // 2
        first = list(number[:middle])
        second = list(number[middle + 1:])
        second = list(reversed(second))
        # print(index, number, middle, first, second)
        if first == second:
            print('YES')
        else:
            print('NO')
    else:
        middle = len(number) // 2
        first = list(number[:middle])
        second = list(number[middle + 1:])
        second = list(reversed(second))
        # print(number, middle, first, second)
        if first == second:
            print('YES')
        else:
            print('NO')

a=list(input())
if a[-1]!='0':
    print('NO')
else:
    for i in range(len(a)-1,-1,-1):
        if a[i]=='0':
            a.pop(i)
        else:
            break
    p=len(a)
    p1=a[:]
    p2=p*[0]
    for i in range(p-1,-1,-1):
        p2[p-i-1]=a[i]
    if p1==p2:
        print('YES')
    else:
        print('NO')

n=str(input())
d=n[::-1]
f=0
for i in range(0,len(d)):
    if(d[i]!='0'):
        f=i
        break
n=n[0:(len(n)-f)]
e=0
for i in range(0,len(n)):
    if(n.count(n[i])%2!=0):
        e=e+1
if(e==1):
    print('YES')
else:
    print('NO')

x=str(input())
a=x.count("0")
s=""
if a>0:
    while a<=2*x.count("0"):
        if x==x[::-1]:
            s=1
            break
        x="0"+x
if s==1:
    print("yes")
else:
    print("no")

import sys

num = sys.stdin.readlines()[0].strip("0")

middle = len(num) // 2 + 1

for i in range(middle):
    if num == "" or type(num) != str:
        print("NO")
        break
    if num[i] != num[-i - 1]:
        print("NO")
        break
    elif i == middle - 1:
        print("YES")
    else:
        continue

n=int(input())
while n<1 and n>10**9:
     n=int(input())
t=str(n)

for i in t:
     if t.count(i)%2!=0:
         print('no')
         break
else :
    print('yes')

text = input().replace('0', '')
fl = 0
rez = 1
for i in set(text):
    if text.count(i) % 2 == 1:
        if fl:
            rez = 0
            break
        else:
            fl += 1
print('YES' if rez else 'NO')

string = input()

odd_cnt = 0

for i in range(10):
        chn = str(i)

        if string.count(chn) % 2 == 1:
                odd_cnt += 1

if odd_cnt <= 1:
        print('YES')
else:
        print('NO')

n = input()
d = []
for i in n:
    if i != "0":
        d.append(i)
k = len(d) // 2
if len(d) % 2 == 0:
    a = d[k:]
    a = reversed(a)
    if d[:k] == a:
        print("YES")
    else:
        print("NO")
else:

    a = d[k + 1:]
    a = reversed(a)
    if d[:k] == list(a):
        print("YES")
    else:
        print("NO")

string=raw_input("Enter string:")
if(string==string[::-1]):
      print("The string is a palindrome")
else:
      print("The string isn't a palindrome")


Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . Then he measured the length of its sides, and found that each of them is equal to an integer number of centimeters. There the properties of the hexagon ended and Gerald decided to draw on it.He painted a few lines, parallel to the sides of the hexagon. The lines split the hexagon into regular triangles with sides of 1 centimeter. Now Gerald wonders how many triangles he has got. But there were so many of them that Gerald lost the track of his counting. Help the boy count the triangles.

The first and the single line of the input contains 6 space-separated integers a1, a2, a3, a4, a5 and a6 (1 ≤ ai ≤ 1000) — the lengths of the sides of the hexagons in centimeters in the clockwise order. It is guaranteed that the hexagon with the indicated properties and the exactly such sides exists.

Print a single integer — the number of triangles with the sides of one 1 centimeter, into which the hexagon is split.

NoteThis is what Gerald's hexagon looks like in the first sample:And that's what it looks like in the second sample:

#!/usr/bin/env python3

import itertools
import sys

for x in itertools.permutations(map(int, input().split())):
    a = x[0] + x[1] + x[2]
    b = x[2] + x[3] + x[4]
    c = x[4] + x[5] + x[0]
    if (a == b) and (b == c):
        print(a ** 2 - x[0] ** 2 - x[2] ** 2 - x[4] ** 2)
        sys.exit(0)

from sys import stdin
l=map(int,stdin.readline().split())
print (((l[0]+l[1]+l[2])**2)-(l[0]**2+l[2]**2+l[4]**2))

ls = map(int, raw_input().split())

ma = max(ls)
ix_ma = ls.index(ma)
left = ls[(ix_ma - 1) % len(ls)]
right = ls[(ix_ma + 1) % len(ls)]
# print left, ma, right

L = left + ma + right
# print "L = %d" % L
tot = L * L
for i in xrange(0, 6, 2):
    z = ls[(i + ix_ma + 1) % len(ls)]
    # print "minus %d" % z
    tot -= z * z

print tot

def input_ints():
    return list(map(int, input().split()))

def output_list(v):
    print(' '.join(str(x) for x in v))

def main():
    a = input_ints()
    ans = 0
    x = a[0]
    for i in range(a[1] + a[2]):
        d = 0
        d += (1 if i < a[1] else -1)
        d += (1 if i < a[5] else -1)
        d //= 2
        ans += 2 * x + d
        x += d
    print(ans)

if __name__ == '__main__':
    main()

a,b,c,d,e,f = map(int, raw_input().split())
print (a+b+c)**2 - a**2 - c**2 - e**2

[s1, s2, s3, s4, s5, s6] = map(int, raw_input('').split(' '))
count = 0
for i in xrange(s1, s1 + min(s2, s6)):
    count += ((2 * i) + 1)
for height in xrange(max(s6, s2) - min(s6, s2)):
    count += (2 * (s1 + min(s2, s6)))
for i in xrange(s4, s4 + min(s3, s5)):
    count += ((2 * i) + 1)
print count

def mp():  return map(int,input().split())
def lt():  return list(map(int,input().split()))
def pt(x):  print(x)
def ip():  return input()
def it():  return int(input())
def sl(x):  return [t for t in x]
def spl(x): return x.split()
def aj(liste, item): liste.append(item)
def bin(x):  return "{0:b}".format(x)
def listring(l): return ' '.join([str(x) for x in l])
def printlist(l): print(' '.join([str(x) for x in l]))

a = lt()
sum = a[3]+a[4]+a[5]
print(sum*sum-a[1]**2-a[3]**2-a[5]**2)

a1, a2, a3, a4, a5,a6 = map(int,input().split())
#a1, a2, a3, a4, a5,a6  = map(int,'1 2 1 2 1 2'.split())
now = a1 * 2 + 1
res = now
for i in range(1, a2 + a3):
    if i == a2:
        now += 1
    if i == a6:
        now += 1
    if a2 < a6:
        if i < a2:
            now += 2
        if i >= a6:
            now -= 2
    else:
        if i < a6:
            now += 2
        if i >= a2:
            now -= 2

    res += now
print(res)

H = input().split()
H = [ int(x) for x in H ]

leftSum = 1
rightSum = 1

leftIndex = 1
rightIndex = 3

baseNum = H[ 2 ]

sum = 0

while(  leftIndex >= 0 and rightIndex <= 4 ):

	sum += ( baseNum * 2 ) - 1 + leftSum + rightSum

	if( leftSum == 1 and rightSum == 1 ):
		baseNum += 1

	if( leftSum == 0 and rightSum == 0 ):
		baseNum -= 1

	H[ leftIndex ] -= 1
	H[ rightIndex ] -= 1

	if( H[ leftIndex ] == 0 ):
		leftSum = 0
		leftIndex -= 1

	if( H[ rightIndex ] == 0 ):
		rightSum = 0
		rightIndex += 1

print( sum )

def intSqrt(x):
    a = 1
    b = x
    while a < b:
        c = (a+b)//2
        if c*c > x:
            b = c
        elif abs(c*c-x) < 0.1:
            a = c
            break
        else:
            a = c+1
    return a
a = [int(x) for x in input().split()]
area = sum([a[i]*a[i+1] for i in range(0,6,2)])
sides = [(a[i]**2+a[i+1]**2+a[i]*a[i+1])**0.5 for i in range(0,6,2)]
semi = sum(sides)/2
print(area+int(intSqrt(16*semi*(semi-sides[0])*(semi-sides[1])*(semi-sides[2])/3)))

sides = list(map(int, raw_input().split()))

t1 = sides[0]
t2 = sides[2]
t3 = sides[4]
ft = sides[0]+sides[1]+sides[2]

print((ft*(ft)) - (t1*(t1)) - (t2*(t2)) - (t3*(t3)))

sides = map(int, raw_input().split(" "));

total = 0;
size = sides[0];

edge1 = min(sides[1],sides[5]);
edge2 = max(sides[1],sides[5]);

for i in range(edge1):
    total += 2 * size + 1;
    size += 1;

for i in range(edge2-edge1):
    total += 2 * size;

for i in range(min(sides[2],sides[4])):
    total += 2 * size - 1;
    size -= 1;

print total;

import sys

h = [int(x) for x in raw_input().split()]

#triangle area -> l * 3^0.5 / 2

area = (h[0]+h[1]+h[2])**2 - h[0]**2 - h[2]**2 - h[4]**2
print area

from sys import stdin
a = [int(item) for item in stdin.readline().split()]
t = a[0]+a[1]+a[2]
print t**2-a[0]**2-a[2]**2-a[4]**2

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

def sp(l, d):
    return l**2+l*d*2

import time

A   = [int(i) for i in input().split()]

start = time.time()
m = min(A)
while(A[0] != m):
    A = A [1:]+[A[0]]

ans = sp(A[0], A[1]) + (A[2]-A[0])*(A[0]+A[1])*2+sp(A[3], A[4])
print(ans)
finish = time.time()
#print(finish - start)

from math import *

l = list(map(int, input().split()))
p = [(0, 0)]
angle = 0
for i in range(5):
	p.append((p[-1][0] + l[i] * sin(angle), p[-1][1] + l[i] * cos(angle)))
	angle += pi / 3
ans = 0
for i in range(1, 5):
	ans += 0.5 * abs(p[i][0] * p[i+1][1] - p[i][1] * p[i+1][0])
print(round(ans * 4 / sqrt(3)))

from sys import stdin,stdout,setrecursionlimit,maxint,exit
#setrecursionlimit(2*10**5)
def listInput():
 return map(long,stdin.readline().split())
def printBS(li):
 if not li: return
 for i in xrange(len(li)-1):
  stdout.write("%d "%li[i])
 stdout.write("%d\n"%li[-1])
def sin():
 return stdin.readline().rstrip()
a1,a2,a3,a4,a5,a6=listInput()
print (a1+a2+a3)**2-a1**2-a3**2-a5**2

# your code goes here
a,b,c,d,e,f = map(int,raw_input().split(" "))
v = (a+b+c)*(a+b+c)
v -= (a*a + c*c + e*e)
print v
# print int(4*v/math.sqrt(3))

def f3(a):
    return a * a

s = raw_input().split()
for i in range(len(s)):
    s[i] = int(s[i])

print f3(s[0] + s[1] + s[2]) - f3(s[0]) - f3(s[2]) - f3(s[4])

def read_list(t): return [t(x) for x in input().split()]
def read_line(t): return t(input())
def read_lines(t, N): return [t(input()) for _ in range(N)]

H = read_list(int)

print((H[0] + H[1] + H[2]) ** 2 - H[0] ** 2 - H[2] ** 2 - H[4] ** 2)

sides = [int(x) for x in input().split()]
bigtriangle = (sides[0] + sides[1] + sides[2]) ** 2
ans = bigtriangle - sides[0]**2 - sides[2]**2 - sides[4]**2
print(ans)

'''
Created on Apr 28, 2016
Gmail: r.haque.249.rh@gmail.com
@author: Md. Rezwanul Haque
'''
from math import sqrt
a,b,c,d,e,f = map(int,input().split())
#if(a==b==c==d==e==f):
#   ans = (a)*6
 #   print(ans)
#else:
ans = (a+b+c)**2 - (a)**2 - (c)**2 - (e)**2
print(ans)

import math

def get_n():
    return int(input())

def get_int_vector():
    return [int(x) for x in input().split()]

def list2string(list):
    result = []
    for i in list:
        result.append(str(i))
    return ':'.join(result)

def string2vector(string):
    return [int(x) for x in string.split(':')]

a = get_int_vector()

print((a[0]+a[1]+a[2])**2-a[0]**2-a[2]**2-a[4]**2)

def triangles(a1, a2, a3, a4, a5, a6):
    b1 = min(a2, a6)
    b2 = abs(a2-a6)
    b3 = min(a3, a5)
    return ((a1 + a1 + b1) * b1) + (2 * (a1 + b1) * b2) + ((a4 + a4 + b3) * b3)

def main():
    a1, a2, a3, a4, a5, a6 = readinti()
    print(triangles(a1, a2, a3, a4, a5, a6))

##########

import sys
import time
import traceback
from contextlib import contextmanager
from io import StringIO

def readint():
    return int(input())

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

def readintl():
   return list(readinti())

def readintll(k):
    return [readintl() for _ in range(k)]

def log(*args, **kwargs):
    print(*args, **kwargs, file=sys.stderr)

@contextmanager
def patchio(i):
    try:
        sys.stdin = StringIO(i)
        sys.stdout = StringIO()
        yield sys.stdout
    finally:
        sys.stdin = sys.__stdin__
        sys.stdout = sys.__stdout__

def do_test(k, test):
    try:
        log(f"TEST {k}")
        i, o = test
        with patchio(i) as r:
            t0 = time.time()
            main()
            t1 = time.time()
        if r.getvalue() == o:
            log(f"OK ({int((t1-t0)*1000000)/1000:0.3f} ms)\n")
        else:
            log(f"Expected:\n{o}"
                f"Got ({int((t1-t0)*1000000)/1000:0.3f} ms):\n{r.getvalue()}")
    except Exception:
        traceback.print_exc()
        log()

def test(ts):
    for k in ts or range(len(tests)):
        do_test(k, tests[k])

tests = [("""\
1 1 1 1 1 1
""", """\
6
"""), ("""\
1 2 1 2 1 2
""", """\
13
""")]

if __name__ == '__main__':
    from argparse import ArgumentParser
    parser = ArgumentParser()
    parser.add_argument('--test', '-t', type=int, nargs='*')
    args = parser.parse_args()
    main() if args.test is None else test(args.test)

def sqr(x:int) -> int:
    return x*x

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

if a==b==c==d==e==f:
    print(sqr(a)*6)
else:
    print(sqr(a+b+c)-sqr(a)-sqr(c)-sqr(e))

from math import *

a = [int(i) for i in input().split()]

res = pow((a[0]+a[1]+a[2]),2)-pow(a[0],2)-pow(a[2],2)-pow(a[4],2)

print('%.0f'%res)

u = input().split()
a = int(u[0])
c = int(u[2])
d = int(u[3])
e = int(u[4])
print((c + d + e) * (c + d + e) - a * a - c * c - e * e)

def S(a):
    if a == 1:
        return 1
    else:
        return a+a*(a-1)

a,b,c,d,e,f = map(int,raw_input().split())

re = S(min(a,c)+b)-S(b)+S(min(d,f)+e)-S(e)+2*(min(a,c)+b)*(max(a,c)-min(a,c))
print re

# hexagon}
a,b,c,d,e,f=map(int,input().split())
S=a+b+c
print(S**2-a**2-c**2-e**2)

a, b, c, d, e, f = map(int, raw_input().split(" "))
side = a + b + c
f = lambda x: x ** 2
area = side ** 2 - f(a) - f(c) - f(e)
print area

a = map(int,raw_input().split(" "))
ans = 0
side = a[0]
inc = min(a[5],a[1])
eq = max(a[5],a[1]) - inc
dec = min(a[2],a[4])
for i in range(inc):
	ans += 2*side + 1
	side += 1
for i in range(eq):
	ans += 2*side
for i in range(dec):
	ans += 2*side - 1
	side -= 1
print ans

a = list(map(int, input().split()))
prv, v = a[0], 0
while a[2]:
    nxt = prv - 1
    if a[1]:
        nxt += 1
        a[1] -= 1
    else:
        a[2] -= 1
    if a[5]:
        nxt += 1
        a[5] -= 1
    else:
        a[4] -= 1
    v += prv + nxt
    prv = nxt
print(v)

import sys

a = map (int, sys.stdin.readline().split())
print ((a[0] + a[5]) * (a[1] + a[2]) * 2 - a[5] ** 2 - a[2] ** 2)

import sys
import math
import itertools
from collections import defaultdict

sides = map(int, sys.stdin.readline().rstrip().split())

cos30 = 0.8660254037844386467637231
sin30 = 0.5
tan30 = 0.5773502691896257645091487
h = cos30*(sides[1] + sides[2])

def getupw(height):
	if height - 0.00001 < cos30*sides[1]:
		r = sides[0] + height*tan30
	else:
		heightleft = height - cos30*sides[1]
		r = sides[0] + sin30*sides[1] - heightleft*tan30
	if height - 0.00001 < cos30*sides[-1]:
		l = -height*tan30
	else:
		heightleft = height - cos30*sides[-1]
		l = -(sin30*sides[-1] - heightleft*tan30)
	#print r-l, r, l, "rallalllaa"
	return int(round(r - l))

#print getupw(5*cos30)
#print "\n\n"

tot = 0
i = 0
while i*cos30 < h - 0.00001:
	curh = i*cos30
	first = getupw(curh)
	sec = getupw(curh+cos30)
	#print first, sec
	tot += first + sec
	i += 1

print tot

sides=map(int, raw_input().split(" "))

print (sides[1]+sides[0]+sides[2])*(sides[1]+sides[0]+sides[2])-sides[0]*sides[0]-sides[2]*sides[2]-sides[4]*sides[4]

import sys

an = list(map(int, sys.stdin.readline().split()))
ans = (an[0] + an[1] + an[2])*(an[0] + an[1] + an[2]) - an[0]*an[0] - an[2]*an[2] - an[4] * an[4]
print(ans)

from math import sqrt

th = lambda x, y: x*x + y*y + x*y
area = lambda x, y, z: sqrt(4*x*y - (x + y - z)**2)

a, b, c, d, e, f = map(float, raw_input().split())
ab = th(a, b)
cd = th(c, d)
ef = th(e, f)
a, b, c, d, e, f = [i*i for i in (a, b, c, d, e, f)]
print int(round((area(a, b, ab) + area(c, d, cd) + area(e, f, ef) + area(ab, cd, ef))/sqrt(3)))

a = map(int, raw_input().split())
print sum(a[:3])**2-sum([i**2 for i in a[::2]])

import sys

(a1, a2, a3, a4, a5, a6) = map(int, input().split())

def calc(h):
	res = 0
	cur = 1
	while cur <= h:
		res += cur + cur - 1
		cur += 1
	return res

ax1 = a4
ax2 = a6
ans = calc(ax1 + ax2 + a5) - calc(ax1) - calc(ax2) - calc(a2)
print(ans)

from sys import stdin

sides = list(map(int, input().split()))
side = sides[0]+sides[1]+sides[2]
big = ((2*side - 1)//2 + 1)**2
s1 = sides[0]**2
s2 = sides[2]**2
s3 = sides[4]**2
print(big-s1-s2-s3)

def f(x):
    ans = 0
    for i in range(1, x + 1):
        ans += 2 * i - 1

    return ans

a = list(map(int, input().split()))
print((a[0] + a[1]) * 2 * (a[1] + a[2]) - f(a[1]) - f(a[4]))

arr = list(map(int, input().split()))

def Foo(element):
	return element ** 2

print(Foo(arr[0] + arr[1] + arr[2]) - Foo(arr[0]) - Foo(arr[2]) - Foo(arr[4]));

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

print((a+b+c)**2-a*a-c*c-e*e)

# Made By Mostafa_Khaled

def solve(a):
    r = 0
    while len(list(filter(lambda x: x > 0, a))) > 3:
        r += sum(2 * x - 1 for x in a)
        a = [x - 1 for x in a if x > 1]

    return r + (a[0] ** 2 if a else 0)

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

r = solve(a)
print(r)

def solve(a):
    total_sum = 0
    while True:
        current_sum = 0
        zero_count = 0
        one_count = 0
        for i in range(6):
            if a[i] == 0:
                zero_count += 1
                continue
            if a[i] == 1:
                one_count += 1
            current_sum += a[i] * 2 - 1
        current_sum -= (zero_count * 2)

        if zero_count >= 3 or (zero_count == 2 and one_count == 2):
            break
        b = []
        for i in range(6):
            if a[i] == 0:
                b.append(0)
                continue
            b.append(a[i] - 1)
            if a[i - 1] == 0:
                b[-1] = max(0, b[-1] - 1)
            if a[(i + 1) % 6] == 0:
                b[-1] = max(0, b[-1] - 1)
        a = b
        total_sum += current_sum

    zero_count = len(list(filter(lambda x: x == 0, a)))

    if zero_count == 3:
        return total_sum + (sum(a) // 3) ** 2
    elif zero_count == 2:
        return total_sum + sum(sorted(a, reverse=True)[:2])
    return total_sum

# assert solve([2, 4, 5, 3, 3, 6]) == 83
# assert solve([45, 19, 48, 18, 46, 21]) == 6099
# assert solve([1, 2, 1, 2, 1, 2]) == 13
# assert solve([1, 1, 1, 1, 1, 1]) == 6
# assert solve([7, 5, 4, 8, 4, 5]) == 175
a = list(map(int, input().split()))

r = solve(a)
print(r)

r = raw_input()
l = r.split(' ')
a = int(l[0])
b = int(l[1])
c = int(l[2])
d = int(l[3])
mul1 = 0
mul2 = 0
for x in range(0,b):
	mul1 = mul1+x
for y in range(0,c):
	mul2 = mul2+y
print b+(2*mul1)+(2*b*a)+c+(2*mul2)+(2*d*c)

def sqr(a, b, c):
    return a * a + 2 * b * c

if __name__ == '__main__':
    data = list(map(int, input().split()))
    print(sqr(data[0], data[1], data[2]) + sqr(data[3], data[4], data[5]))

#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import*
from io import BytesIO, IOBase
def vsInput():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
def value():return tuple(map(int,input().split()))
def array():return [int(i) for i in input().split()]
def Int():return int(input())
def Str():return input()
def arrayS():return [i for i in input().split()]

#-------------------------code---------------------------#
#vsInput()

def tringles(n):
    return 3+(n-1)*2

sides=array()

a,l1,r1=sides[0],sides[5],sides[1]
b,l2,r2=sides[3],sides[2],sides[4]

ans=0

#print(l1,a,r1)
#print(l2,b,r2)

for i in range(min(l1,r1)):
    ans+=tringles(a+i)

for i in range(min(l2,r2)):
    ans+=tringles(b+i)

layers=abs(l1-r1)
ans+=layers* tringles(a+min(l1,r1))

print(ans)

a, b, c, d, e, f = (int(x) for x in input().split())
ans = (a * b + c * d + e * f) * 2 + (abs(a - b) * abs(c - d) if e - f else 0)
print(ans)

ar=map(int,raw_input().split())
a=ar[0]
b=ar[1]
print ((b+2*a)**2-(3*(a*a)))

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

cnt = 0

l = a[0]
for i in range(a[1]):
    cnt += (l + i) * 2 + 1

l = a[0] + a[1]
for i in range(l, a[3], -1):
    cnt += i * 2 - 1

print(cnt)

sm = 0

a = map(int, raw_input().split())
i = 0
while any(a):
    if sum(a) == 3:
        sm += 1
        break

    for i in range(6):

        if a[i]:
            sm += a[i] * 2 - 1
        a[i] /= 2

print sm

#(2*mx+1)*2 + 2*(mx-1) + 1

a, b, c, d, e, f = [int(i) for i in input().split()]

A = [a,b,c,d,e,f]

A.sort()

mx = max(A)

s = 0

tmp = min(A)
mx = max(A)

while tmp>0:
    tmp-=1
    s += 2*mx+1
    mx-=1

deficit = max(A) - min(A)
ans = 0
tmp = max(A) - min(A)
i=1
while tmp>0:
    tmp-=1
    ans += (2*i + 1)
    i+=1

print(s*2 + ans)

def main():
    d = list(map(int, input().split()))
    res = 0
    for i in range(d[0]):
        res += (i+d[1]-1)*2+3
    for i in range(d[3]):
        res += (i+d[4]-1)*2+3
    print(res)

main()

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

def sp(l, d):
    return l**2+l*d*2

import time

A   = [int(i) for i in input().split()]

start = time.time()

ans = sp(A[0], A[1]) + sp(A[5], A[4])
print(ans)
finish = time.time()
#print(finish - start)

arr = list(map(int, input().split()))

def foo(arr):
	answer = 0
	flag= False
	s = 0
	b = [ a // 2 for a in arr]
	for element in arr:
		answer += element * 2 - 1
		element //= 2
		s += element
		flag |= (element == 0)

	if flag:
		num = s // 3
		return answer + num ** 2
	else:
		return answer + foo(b)

print(foo(arr))

import sys
import math
import itertools
from collections import defaultdict

sides = map(int, sys.stdin.readline().rstrip().split())

cos30 = 0.8660254037844386467637231
sin30 = 0.5
h = cos30*(sides[1] + sides[2])
w = sides[0] + sin30*(sides[1] + sides[-1])

def getupw(height):
	if height - 0.00001 < cos30*sides[1]:
		r = sides[0] + sin30*height
	else:
		heightleft = height - cos30*sides[1]
		r = sides[0] + sin30*sides[1] - heightleft*sin30
	if height - 0.00001 < cos30*sides[-1]:
		l = -sin30*height
	else:
		heightleft = height - cos30*sides[1]
		l = -(sin30*sides[-1] - heightleft*sin30)
	return int(round(r - l))

tot = 0
i = 0
while i < h - 0.00001:
	first = getupw(i)
	sec = getupw(i+1)
	tot += first + sec
	i += 1

print tot

'''
Created on Apr 28, 2016
Gmail: r.haque.249.rh@gmail.com
@author: Md. Rezwanul Haque
'''
from math import sqrt
a,b,c,d,e,f = map(int,input().split())
if(a==b==c==d==e==f):
    ans = (a)*6
    print(ans)
else:
    ans = (a+b+c)**2 - (a)**2 - (c)**2 - (e)**2
    print(ans)

from math import sqrt
def g(s):
    return sqrt((s * 3 / 2) * ((s * 3 / 2 - s) ** 3))
a = [float(i) for i in input().split()]
f = g(a[0] + a[1] + a[2])
print(round(f - g(a[0]) - g(a[2]) - g(a[4])) / g(1))

def solve(a):
    total_sum = 0
    while len(list(filter(lambda x: x > 0, a))) > 3:
        current_sum = 0
        zero_count = 0
        for i in range(6):
            if a[i] == 0:
                zero_count += 1
                continue
            current_sum += a[i] * 2 - 1
        current_sum -= (zero_count * 2)
        for i in range(6):
            if a[i] > 0:
                a[i] -= 1
        total_sum += current_sum
    return total_sum + (1 if a == [1, 0, 1, 0, 1, 0] or a == [0, 1, 0, 1, 0, 1] else 0)

# assert solve([2, 4, 5, 3, 3, 6]) == 83
# assert solve([1, 2, 1, 2, 1, 2]) == 13
# assert solve([1, 1, 1, 1, 1, 1]) == 6

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

r = solve(a)
print(r)

a1,a2,a3,a4,a5,a6=map(int,input().split())
s=a1+2
ans=s
for i in range(1,a2):
    s+=2
    ans+=s
ans+=s
for i in range(1,a3):
    s-=2
    ans+=s
print(ans)

sides = list(map(int, input().split()))

def triangle(pos):
  peak = sides[pos]
  side = sides[pos+1]
  base = peak + side
  return side * (base + peak)

top = triangle(0)
bottom = triangle(3)
print(top + bottom)

a=sorted(map(int,raw_input().split()))
s=a[0]*2+a[-1]
print s*s-3*a[0]*a[0]

a = [int(x) for x in input().split()]
area = sum([a[i]*a[i+1] for i in range(0,6,2)])
sides = [(a[i]**2+a[i+1]**2+a[i]*a[i+1])**0.5 for i in range(0,6,2)]
semi = sum(sides)/2
print(int(area+(16/3*semi*(semi-sides[0])*(semi-sides[1])*(semi-sides[2]))**0.5))

a, b, c, d, e, f = map(int, input().split())
mxn = max(a, b, c, d, e, f)
min = min(a, b, c, d, e, f)
print((mxn + min + min) ** 2 - (min ** 2) * 3)

a, b, c, d, e, f = (int(x) for x in input().split())
ans = (a * b + c * d + e * f) * 2 + (abs(a - b) * abs(c - d) if e - f else 0)
print(ans)

import math
def solve(sides):
	total = 0
	base1 = sides[1] + sides[0]
	trap1Area = ((base1 + sides[0]) * (sides[1] * (0.5 * math.sqrt(3)))) / 2.0
	total += int(trap1Area / (0.25 * math.sqrt(3)))

	base2 = sides[2] + sides[3]
	trap2Area = ((base2 + sides[3]) * (sides[2] * (0.5 * math.sqrt(3)))) / 2.0
	total += int(trap2Area / (0.25 * math.sqrt(3)))

	return total

sides = map(int, raw_input().split())
print solve(sides)

import math

def solve():
    a = [int(i) for i in input().split()]
    sum_t = 0

    for i in a:
        sum_t += i

    print(sum_t + math.trunc(sum_t / 2))

if __name__ == "__main__":
    solve()

def triang(n):
    a = 0
    i = 1
    while i <= n:
        a += (2 * i - 1)
        i += 1
    return a

a = input().split()
for i in range(len(a)):
    a[i] = int(a[i])
c = a[0] + a[1] + a[5]
print(c)
print(triang(c) - triang(a[1]) - triang(a[3]) - triang(a[5]))

import sys
import string
import math
import heapq
from collections import defaultdict
from functools import lru_cache
from collections import Counter
from fractions import Fraction

def mi(s):
    return map(int, s.strip().split())

def lmi(s):
    return list(mi(s))

def tmi(s):
    return tuple(mi(s))

def mf(f, s):
    return map(f, s)

def lmf(f, s):
    return list(mf(f, s))

def js(lst):
    return " ".join(str(d) for d in lst)

def jsns(lst):
    return "".join(str(d) for d in lst)

def line():
    return sys.stdin.readline().strip()

def linesp():
    return line().split()

def iline():
    return int(line())

def mat(n):
    matr = []
    for _ in range(n):
        matr.append(linesp())
    return matr

def matns(n):
    mat = []
    for _ in range(n):
        mat.append([c for c in line()])
    return mat

def mati(n):
    mat = []
    for _ in range(n):
       mat.append(lmi(line()))
    return mat

def pmat(mat):
    for row in mat:
        print(js(row))

def calc(a, b, c):
    d = a * math.cos(math.pi / 3) / 2
    e = c * math.cos(math.pi / 3) / 2
    h = a * math.sin(math.pi / 3)
    return h * b + h * e + h * d

def main():
    k = 0.433013
    a, b, c, d, e, f = lmi(line())
    print(int(round((calc(a, b, c) + calc(d, e, f)) / k, 2)))

main()

# mukulchandel
a1,a2,a3,a4,a5,a6=map(int,input().split())
a=a1
b=a2
s=(a+b)
ans=0
for i in range(a):
    ans=ans+2*s-1
    s=s-1
s=(a+b)
for i in range(b):
    ans=ans+2*s-1
    s=s-1
print(ans)

sm = 0

a = map(int, raw_input().split())
i = 0
while any(a):
    if sum(a) == 3:
        sm += 1
        break

    for i in range(6):

        if a[i]:
            sm += a[i] * 2 - 1
        a[i] /= 2

print sm

a = list(set(map(int, input().split(' '))))
if len(a) == 1:
    x = y = a[0]
else:
    x = a[0]
    y = a[1]
print(x**2 + y**2 + 4*x*y)

def answer(a1,a2,a3,a4,a5,a6):

    count=0
    for i in range(1,a2+1):
        count+=2*(i+a1)-1

    for i in range(1,a3+1):
        count+=2*(i+a4)-1

    return count

a1,a2,a3,a4,a5,a6=map(int,input().split())
print(answer(a1,a2,a3,a4,a5,a6))

inp=input()
inp=inp.split()
inp=[int(i) for i in inp]
s=inp[0]+inp[1]+inp[2]
s*=s
s-=(inp[0]*inp[0]+inp[1]*inp[1]+inp[2]*inp[2])
print(s)

a=map(int,raw_input().split())
s=sum(a[:3])
m=min(a)
print s*s-3*m*m

__author__ = 'trunghieu11'

def solve(hexagon):
    answer = hexagon[0] + hexagon[1] + hexagon[2]
    answer = answer * answer - hexagon[0] * hexagon[0] * 3
    return answer

if __name__ == '__main__':
    hexagon = list(map(int, raw_input().split(" ")))
    print solve(hexagon)

import math

a, b, c, d, e, f = map(int, input().split(" "))
x = b + a + c
y = d + c + e
z = f + e + a
s = x*x - a - c - e
print(int(s))

#!/usr/bin/env python
# -*- coding: utf-8 -*-

def solve(a, b) -> bool:
    m = min([a, b])
    l = max([a, b])
    left = 3 * m * (m + 1) - m - 5 if m > 1 else 0
    right = 3 * l * (l + 1) - (5 * l) - 1 if l > 1 else 0
    return 6 + left + right

def getinput():
    def getints_line():
        return list(map(int, input().split(' ')))
    [a, b] = getints_line()[:2]
    return a, b

def test():
    art = Assert()
    art.equal(solve(1, 1), 6)
    art.equal(solve(1, 2), 13)
    art.equal(solve(2, 1), 13)
    art.equal(solve(2, 2), 24)
    art.equal(solve(2, 3), 37)
    art.equal(solve(3, 3), 54)

def main():
    # test()
    print(solve(*getinput()))
    # print('\n'.join(map(str, solve(*getinput()))))

import unittest
class Assert(unittest.TestCase):
    def equal(self, a, b):
        self.assertEqual(a, b)

if __name__ == '__main__':
    main()

import math
def sqr(x):
    return x * x

def side_(a,b):
    cos_120 = -0.5
    return abs((sqr(a) * sqr(b) - (2 * a * b * cos_120)) ** 0.5)

def triangle_area(a,b,c):
    p = (a + b + c) / 2
    return abs((p * (p-a) * (p-b) * (p-c)) ** 0.5)

a1,a2,a3,a4,a5,a6 = map(int,input().split())
sin_120 = (-1) * ((3 ** 0.5) / 2)
area1 = abs((a1 * a2) / 2 * sin_120)
area2 = abs((a3 * a4) / 2 * sin_120)
area3 = abs((a5 * a6) / 2 * sin_120)
side1 = side_(a1,a2)
side2 = side_(a3,a4)
side3 = side_(a5,a6)
s = triangle_area(side1,side2,side3)
all_area = area1 + area2 + area3 + s
print(round((all_area / ((3 ** 0.5) / 4))+1))

import math as m
a = list(map(int, input().split()))

def area_tr(l):
    h = m.sqrt(l**2 + (l/2)**2)
    a = l*h/2

    a1 = 0.5 * m.sqrt(1 + 0.5**2)
    return int(a / a1)

sol = 0
if a[0] == a[1] and a[1] == a[2]:
    sol = 6 * area_tr(a[0])
elif a[0] != a[1] and a[1] != a[2] and a[2] != a[3]:
    min_l = min(a)
    max_l = max(a)

    sol = area_tr(min_l) + 3
    sol += max_l * 3 + (max_l-1) * 3
else:
    min_l = min(a)
    max_l = max(a)

    sol = area_tr(min_l + max_l) * 2
    sol -= area_tr(min_l) * 2

print(sol)

import sys
import string
import math
import heapq
from collections import defaultdict
from functools import lru_cache
from collections import Counter
from fractions import Fraction

def mi(s):
    return map(int, s.strip().split())

def lmi(s):
    return list(mi(s))

def tmi(s):
    return tuple(mi(s))

def mf(f, s):
    return map(f, s)

def lmf(f, s):
    return list(mf(f, s))

def js(lst):
    return " ".join(str(d) for d in lst)

def jsns(lst):
    return "".join(str(d) for d in lst)

def line():
    return sys.stdin.readline().strip()

def linesp():
    return line().split()

def iline():
    return int(line())

def mat(n):
    matr = []
    for _ in range(n):
        matr.append(linesp())
    return matr

def matns(n):
    mat = []
    for _ in range(n):
        mat.append([c for c in line()])
    return mat

def mati(n):
    mat = []
    for _ in range(n):
       mat.append(lmi(line()))
    return mat

def pmat(mat):
    for row in mat:
        print(js(row))

def main():
    k = 0.433013
    a, b, c, d, e, f = lmi(line())
    a1 = (a + b + c)**2
    a2 = (a**2 + c**2 + e**2)
    ans = round(3**0.5 * (a1 - a2) / (4 * k), 2)
    print(int(ans))
main()

import sys
import string
import math
import heapq
from collections import defaultdict
from functools import lru_cache
from collections import Counter
from fractions import Fraction

def mi(s):
    return map(int, s.strip().split())

def lmi(s):
    return list(mi(s))

def tmi(s):
    return tuple(mi(s))

def mf(f, s):
    return map(f, s)

def lmf(f, s):
    return list(mf(f, s))

def js(lst):
    return " ".join(str(d) for d in lst)

def jsns(lst):
    return "".join(str(d) for d in lst)

def line():
    return sys.stdin.readline().strip()

def linesp():
    return line().split()

def iline():
    return int(line())

def mat(n):
    matr = []
    for _ in range(n):
        matr.append(linesp())
    return matr

def matns(n):
    mat = []
    for _ in range(n):
        mat.append([c for c in line()])
    return mat

def mati(n):
    mat = []
    for _ in range(n):
       mat.append(lmi(line()))
    return mat

def pmat(mat):
    for row in mat:
        print(js(row))

def main():
    k = 0.433013
    a, b, c, d, e, f = lmi(line())

    asin = a * math.sin(math.pi / 3)
    acos = a * math.cos(math.pi / 3)
    dsin = d * math.sin(math.pi / 3)
    dcos = d * math.cos(math.pi / 3)

    first = asin * acos + b * asin
    second = dsin * dcos + e * dsin
    middle = abs(c - a) * (b + 2 * acos) * math.sin(math.pi / 3)
    print(int(round((first + second + middle) / k, 2)))
main()

import math
import sys

def main():
    seq = map(int, raw_input().split())
    seq_set = set(seq)
    if len(seq_set) == 1:
        return seq[0]**2*6
    if seq[0] == seq[2] == seq[4] and seq[1] == seq[3] == seq[5]:
        min_side = min(seq_set)
        max_side = max(seq_set)
        return (2*min_side + max_side)**2 - 3*min_side**2
    else:
        min_side = min(seq_set)
        max_side = max(seq_set)
        return (max_side + min_side*2)**2 - max_side**2 - 2*min_side

if __name__ == '__main__':
    print main()

def read_list(t): return [t(x) for x in input().split()]
def read_line(t): return t(input())
def read_lines(t, N): return [t(input()) for _ in range(N)]

H = read_list(int)

print((H[0] + H[1] + H[2]) ** 2 - H[0] ** 2 + H[2] ** 2 + H[4] ** 2)

ar=map(int,raw_input().split())
a=ar[0]
b=ar[1]
print ((b+2*a)**2-(3*(a*a)))