from collections import defaultdict





def main():

    N = int(eval(input()))

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



    dp = [False] * (100 * 100 + 1)

    dp[0] = True

    for s in s_list:

        for i in range(len(dp) - 1, -1, -1):

            if dp[i]:

                dp[i + s] = True



    for i in range(len(dp) - 1, -1, -1):

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

            print(i)

            return

    print((0))





if __name__ == '__main__':

    main()

from collections import defaultdict, Counter

from itertools import product, groupby, count, permutations, combinations

from math import pi, sqrt

from collections import deque

from bisect import bisect, bisect_left, bisect_right

from string import ascii_lowercase

from functools import lru_cache

import sys

sys.setrecursionlimit(10000)

INF = float("inf")

YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"

dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]

dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]





def inside(y, x, H, W):

    return 0 <= y < H and 0 <= x < W





def ceil(a, b):

    return (a + b - 1) // b





def main():

    N = int(eval(input()))

    S = []

    for _ in range(N):

        S.append(int(eval(input())))



    S = [0] + list(sorted(S))

    total = sum(S)

    for s in S:

        if (total - s) % 10 != 0:

            print((total - s))

            return



    print((0))





if __name__ == '__main__':

    main()

from collections import defaultdict


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


if __name__ == "__main__":
    main()

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys

sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    N = int(eval(input()))
    S = []
    for _ in range(N):
        S.append(int(eval(input())))
    S = [0] + list(sorted(S))
    total = sum(S)
    for s in S:
        if (total - s) % 10 != 0:
            print((total - s))
            return
    print((0))


if __name__ == "__main__":
    main()

-from collections import defaultdict +from collections import defaultdict, Counter +from itertools import product, groupby, count, permutations, combinations +from math import pi, sqrt +from collections import deque +from bisect import bisect, bisect_left, bisect_right +from string import ascii_lowercase +from functools import lru_cache +import sys + +sys.setrecursionlimit(10000) +INF = float("inf") +YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no" +dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0] +dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1] + + +def inside(y, x, H, W): +    return 0 <= y < H and 0 <= x < W + + +def ceil(a, b): +    return (a + b - 1) // b -    s_list = [int(eval(input())) for _ in range(N)] -    dp = [False] * (100 * 100 + 1) -    dp[0] = True -    for s in s_list: -        for i in range(len(dp) - 1, -1, -1): -            if dp[i]: -                dp[i + s] = True -    for i in range(len(dp) - 1, -1, -1): -        if dp[i] and i % 10 != 0: -            print(i) +    S = [] +    for _ in range(N): +        S.append(int(eval(input()))) +    S = [0] + list(sorted(S)) +    total = sum(S) +    for s in S: +        if (total - s) % 10 != 0: +            print((total - s))