def main():

    N = int(eval(input()))

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



    dp = [False] * (10000 + 1)

    dp[0] = True



    for x in s:

        for score in range(10000 - x, -1, -1):

            dp[score + x] |= dp[score]



    for score in range(10000, -1, -1):

        if dp[score] and score % 10 != 0:

            print(score)

            return

    print((0))





if __name__ == '__main__':

    main()



# import sys

#

# sys.setrecursionlimit(10 ** 7)

#

# input = sys.stdin.readline

# rstrip()

# int(input())

# map(int, input().split())

def main():

    N = int(eval(input()))

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



    tot = sum(s)



    if tot % 10 == 0:

        s.sort()

        for x in s:

            if x % 10 == 0: continue

            tot -= x

            break

        else:

            tot = 0

    print(tot)





if __name__ == '__main__':

    main()



# import sys

#

# sys.setrecursionlimit(10 ** 7)

#

# input = sys.stdin.readline

# rstrip()

# int(input())

# map(int, input().split())

def main():
    N = int(eval(input()))
    s = [int(eval(input())) for _ in range(N)]
    dp = [False] * (10000 + 1)
    dp[0] = True
    for x in s:
        for score in range(10000 - x, -1, -1):
            dp[score + x] |= dp[score]
    for score in range(10000, -1, -1):
        if dp[score] and score % 10 != 0:
            print(score)
            return
    print((0))


if __name__ == "__main__":
    main()
# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())

def main():
    N = int(eval(input()))
    s = [int(eval(input())) for _ in range(N)]
    tot = sum(s)
    if tot % 10 == 0:
        s.sort()
        for x in s:
            if x % 10 == 0:
                continue
            tot -= x
            break
        else:
            tot = 0
    print(tot)


if __name__ == "__main__":
    main()
# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())

-    dp = [False] * (10000 + 1) -    dp[0] = True -    for x in s: -        for score in range(10000 - x, -1, -1): -            dp[score + x] |= dp[score] -    for score in range(10000, -1, -1): -        if dp[score] and score % 10 != 0: -            print(score) -            return -    print((0)) +    tot = sum(s) +    if tot % 10 == 0: +        s.sort() +        for x in s: +            if x % 10 == 0: +                continue +            tot -= x +            break +        else: +            tot = 0 +    print(tot)