from collections import Counter



n = int(eval(input()))

s = []

for _ in range(n):

    s.append(int(eval(input())))

    

cnt = Counter([0, s[0]])



if len(s) > 1:

    for si in s[1:]:

        tmp = Counter([])

        for k,v in list(cnt.items()):

            tmp[k + si] = v

            

        cnt += tmp



key_list = sorted(list(cnt.keys()), reverse=True)



for k in key_list:

    if k == 0:

        print(k)

        break

    

    elif k%10 == 0:

        continue

    

    print(k)

    break
n = int(eval(input()))

s = []

for _ in range(n):

    s.append(int(eval(input())))



total = sum(s)



if total % 10 != 0:

    print(total)



else:

    s.sort()    

    min_s = total

    

    for si in s:

        if si % 10 != 0:

            min_s = si

            break

        

    print((total - min_s))
from collections import Counter

n = int(eval(input()))
s = []
for _ in range(n):
    s.append(int(eval(input())))
cnt = Counter([0, s[0]])
if len(s) > 1:
    for si in s[1:]:
        tmp = Counter([])
        for k, v in list(cnt.items()):
            tmp[k + si] = v
        cnt += tmp
key_list = sorted(list(cnt.keys()), reverse=True)
for k in key_list:
    if k == 0:
        print(k)
        break
    elif k % 10 == 0:
        continue
    print(k)
    break

n = int(eval(input()))
s = []
for _ in range(n):
    s.append(int(eval(input())))
total = sum(s)
if total % 10 != 0:
    print(total)
else:
    s.sort()
    min_s = total
    for si in s:
        if si % 10 != 0:
            min_s = si
            break
    print((total - min_s))

-from collections import Counter - -cnt = Counter([0, s[0]]) -if len(s) > 1: -    for si in s[1:]: -        tmp = Counter([]) -        for k, v in list(cnt.items()): -            tmp[k + si] = v -        cnt += tmp -key_list = sorted(list(cnt.keys()), reverse=True) -for k in key_list: -    if k == 0: -        print(k) -        break -    elif k % 10 == 0: -        continue -    print(k) -    break +total = sum(s) +if total % 10 != 0: +    print(total) +else: +    s.sort() +    min_s = total +    for si in s: +        if si % 10 != 0: +            min_s = si +            break +    print((total - min_s))