Today, Wet Shark is given n integers. Using any of these integers no more than once, Wet Shark wants to get maximum possible even (divisible by 2) sum. Please, calculate this value for Wet Shark. 

Note, that if Wet Shark uses no integers from the n integers, the sum is an even integer 0.


-----Input-----

The first line of the input contains one integer, n (1 ≤ n ≤ 100 000). The next line contains n space separated integers given to Wet Shark. Each of these integers is in range from 1 to 10^9, inclusive. 


-----Output-----

Print the maximum possible even sum that can be obtained if we use some of the given integers. 


-----Examples-----
Input
3
1 2 3

Output
6
Input
5
999999999 999999999 999999999 999999999 999999999

Output
3999999996


-----Note-----

In the first sample, we can simply take all three integers for a total sum of 6.

In the second sample Wet Shark should take any four out of five integers 999 999 999.

Difficulty: interview

Starter code:

Solutions:
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    
    cnt = 0
    mi = 10 ** 9
    for i in a:
        if i % 2 == 1:
            cnt ^= 1
            mi = min(mi, i)
    
    if not cnt:
        mi = 0
    print(sum(a) - mi)
    
    
main()

n = int(input())
a = list(map(int, input().split()))
s = sum(a)
if (s % 2 == 0):
    print(s)
else:
    cmin = 10**9 + 1;
    for c in a:
        if c % 2 == 1 and c < cmin:
            cmin = c
    s -= cmin
    print(s)


n=int(input())
a=sorted(list(map(int,input().split())))[::-1]
t = r = 0
for x in a:
	if x % 2:
		if t:
			r += t + x
			t = 0
		else:
			t = x
	else:
		r += x
print(r)

n = int(input())
a = list(map(int, input().split()))
sum = 0
p = []
for i in range(n):
    if a[i] % 2 == 0:
        sum += a[i]
    else:
        p.append(a[i])
p.sort()
if len(p) % 2 != 0:
    p.pop(0)
for t in range(len(p)):
    sum += p[t]
print(sum)


n = int(input())
l = list(map(int, input().split()))
odd = []
nodd = []
for i in l:
    if i % 2 == 1:
        odd.append(i)
    else:
        nodd.append(i)
odd.sort()
print(sum(nodd) + sum(odd[len(odd) % 2:]))

read = lambda: list(map(int, input().split()))
n = int(input())
a = list(read())
ans = sum(a)
if ans % 2:
    Min = 10 ** 10
    for i in range(n):
        if a[i] % 2 and a[i] < Min:
            Min = a[i]
    if Min < 10 ** 10: ans -= Min
    else: ans = 0
print(ans)


n = int(input())

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

arr =sorted(arr)

s = sum(arr)

if s % 2 == 0:
    print(s)
else:
    c = -1
    for v in arr:
        if v % 2 == 1:
            c = v
            break
    if c == -1:
        print(0)
    else:
        print(s - c)


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

mn = 1000000000000000000000001
if sum(a) % 2 == 0:
    print(sum(a))
else:
    for i in range(n):
        if a[i] % 2 == 1:
            mn = min(mn, a[i])
    print(sum(a)-mn)

N = int(input())
a = list(map(int, input().split()))
k = 0
min_nechet = 10 ** 10
for i in a:
    if i % 2 == 1:
        k += 1
        min_nechet = min(min_nechet, i)
if k % 2 == 0:
    print(sum(a))
else:
    print(sum(a) - min_nechet)

n = int(input())
lst = list(map(int, input().split()))
s = 0
cnt = 0
lst.sort()
for i in lst:
    if i % 2 == 0:
        s += i
    else:
        s += i
        cnt += 1
        
if cnt % 2 == 0:
    print(s)
else:
    for i in range(n):
        if lst[i] % 2 == 1:
            s -= lst[i]
            break
    print(s)    


n = int(input())
N = [int(x) for x in input().split()]
S = sum(N)
odd = [x for x in N if x%2 == 1]
x = min(odd) if len(odd) > 0 else 0
print(S - x if S%2 else S)


n=int(input())
l=list(map(int,input().split()))
s=sorted([x for x in l if x%2>0])
t=sum(l)
if t%2: t-=s[0]
print(t)

n = int(input())

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

a.sort()
sum = 0
for i in range(n):
    sum += a[i]
ans = sum
i = 0
while ans % 2 == 1:
    ans = sum - a[i]
    i += 1

print(ans)


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

for x in a:
    if x % 2 == 0:
        evens.append(x)
    else:
        odds.append(x)

ret = sum(evens)

odds.sort()

i = len(odds)-1

while i-1 >= 0:
    ret += odds[i] + odds[i-1]
    i -= 2

print(ret)


n, a = int(input()), list(map(int, input().split()))
o = [x for x in a if x % 2]
print(sum(a) - (min(o) if len(o) % 2 else 0))

n = int(input())
a = [int(i) for i in input().split()]
if not sum(a) % 2:
    print(sum(a))
    return
a.sort()
ans = 0
flag = True
for i in range(n):
    if (flag and (not (a[i] % 2))) or (not flag):
        ans += a[i]
    else:
        flag = False
print(ans)



n = int(input())
l = map(int, input().split())
l = sorted(l)
s = sum(l)

if (s % 2) == 1:
	for i in l:
		if (i % 2) == 1:
			s -= i
			break
print(s)

#author="_rabbit"
n=(int)(input())
a=list(map(int,input().split()))
sum=0
for i in a:
    sum+=int(i)
if(sum%2==0):
    print(sum)
else:
    minn=int(1000000000000000)
    for i in a:
        if(i%2):
            minn=min(minn,i)
    sum=sum-minn
    print(sum)
    


n = int(input())
a = [int(x) for x in input().split()]
summ = 0
count = 0
minn = 10000000000000
for i in range(n):
    if a[i] % 2 == 1:
        minn = min(minn, a[i])
        count += 1
if count % 2 == 0:
    print(sum(a))
else:
    print(sum(a) - minn)

n = int(input())

odd = 0
lowest_odd = None
s = 0
for num in map(int, input().split()):
    s += num
    if num % 2 == 1:
        odd += 1
        if lowest_odd is None or num < lowest_odd:
            lowest_odd = num

if odd % 2 == 1:
    print(s-lowest_odd)
else:
    print(s)

def __starting_point():

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

    the_sum = sum(a)

    if the_sum % 2 == 0:
        print(the_sum)
    else:
        max_num = max(a)
        min_odd = max_num + 1
        for aa in a:
            if aa%2 == 1 and aa < min_odd:
                min_odd = aa

        if min_odd == max_num + 1:
            print(0)
        else:
            print( the_sum -  min_odd )

__starting_point()

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

a = []
b = []
for t in ar:
    if t % 2 == 0:
        a.append(t)
    else:
        b.append(t)

b.sort()
if len(b) % 2 != 0:
    b = b[1:]

print(sum(a) + sum(b))