N=int(eval(input()))

s=[int(eval(input())) for i in range(N)]

import collections

table=collections.defaultdict(int)

for x in s:

  if x%10!=0:

    table[x]+=1

if sum(s)%10==0:

  if len(table)==0:

    print((0))

  else:

    table=list(table.keys())

    table.sort()

    print((sum(s) - table[0]))

else:

  print((sum(s)))
N = int(eval(input()))

s = [int(eval(input())) for i in range(N)]



S = sum(s)

if S % 10 != 0:

    print(S)

else:

    s.sort()

    ans = S

    flag = False

    for x in s:

        if x % 10 != 0:

            ans -= x

            flag = True

            break

        else:

            continue

    if flag:

        print(ans)

    else:

        print((0))

N = int(eval(input()))
s = [int(eval(input())) for i in range(N)]
import collections

table = collections.defaultdict(int)
for x in s:
    if x % 10 != 0:
        table[x] += 1
if sum(s) % 10 == 0:
    if len(table) == 0:
        print((0))
    else:
        table = list(table.keys())
        table.sort()
        print((sum(s) - table[0]))
else:
    print((sum(s)))

N = int(eval(input()))
s = [int(eval(input())) for i in range(N)]
S = sum(s)
if S % 10 != 0:
    print(S)
else:
    s.sort()
    ans = S
    flag = False
    for x in s:
        if x % 10 != 0:
            ans -= x
            flag = True
            break
        else:
            continue
    if flag:
        print(ans)
    else:
        print((0))

-import collections - -table = collections.defaultdict(int) -for x in s: -    if x % 10 != 0: -        table[x] += 1 -if sum(s) % 10 == 0: -    if len(table) == 0: +S = sum(s) +if S % 10 != 0: +    print(S) +else: +    s.sort() +    ans = S +    flag = False +    for x in s: +        if x % 10 != 0: +            ans -= x +            flag = True +            break +        else: +            continue +    if flag: +        print(ans) +    else: -    else: -        table = list(table.keys()) -        table.sort() -        print((sum(s) - table[0])) -else: -    print((sum(s)))