import sys

from itertools import accumulate



def solve():

    n = int(eval(input()))

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



    lim = n * 100

    dp = [False] * (lim + 1)

    dp[0] = True



    for i in range(n):

        for j in range(lim, s[i] - 1, -1):

            dp[j] |= dp[j - s[i]]



    for i in range(lim, 0, -1):

        if i % 10 == 0:

            continue

        if dp[i]:

            print(i)

            return



    print((0))



if __name__ == '__main__':

    solve()
import sys



def solve():

    n = int(eval(input()))

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

    s.sort()



    ssum = sum(s)



    if ssum % 10:

        print(ssum)

    else:

        for si in s:

            if si % 10:

                print((ssum - si))

                return



        print((0))



if __name__ == '__main__':

    solve()
import sys
from itertools import accumulate


def solve():
    n = int(eval(input()))
    s = [int(eval(input())) for i in range(n)]
    lim = n * 100
    dp = [False] * (lim + 1)
    dp[0] = True
    for i in range(n):
        for j in range(lim, s[i] - 1, -1):
            dp[j] |= dp[j - s[i]]
    for i in range(lim, 0, -1):
        if i % 10 == 0:
            continue
        if dp[i]:
            print(i)
            return
    print((0))


if __name__ == "__main__":
    solve()

import sys


def solve():
    n = int(eval(input()))
    s = [int(eval(input())) for i in range(n)]
    s.sort()
    ssum = sum(s)
    if ssum % 10:
        print(ssum)
    else:
        for si in s:
            if si % 10:
                print((ssum - si))
                return
        print((0))


if __name__ == "__main__":
    solve()

-from itertools import accumulate -    lim = n * 100 -    dp = [False] * (lim + 1) -    dp[0] = True -    for i in range(n): -        for j in range(lim, s[i] - 1, -1): -            dp[j] |= dp[j - s[i]] -    for i in range(lim, 0, -1): -        if i % 10 == 0: -            continue -        if dp[i]: -            print(i) -            return -    print((0)) +    s.sort() +    ssum = sum(s) +    if ssum % 10: +        print(ssum) +    else: +        for si in s: +            if si % 10: +                print((ssum - si)) +                return +        print((0))