#!/usr/bin/env lua

N = io.read("*num")

s = {}
for i=1, N do
    s[i] = io.read("*num")
end

un = {}
data = {}
for i=1, N do
    un[i] = 0
    data[i] = 0
end

for i=1, N do
    if s[i] % 10 == 0 then
        un[i] = s[i]
    else
        data[i] = s[i]
    end
end

data_cnt = 0
for i = 1, N do
    if data[i] > 0 then
        data_cnt = data_cnt + 1
    end
end

sum = 0
for i = 1, N do
    sum = sum + s[i]
end

min = 100
for i = 1, N do
    if min >= data[i] and data[i] >= 1 then
        min = data[i]
    end
end

if data_cnt == 0 then
    print(0)
else
    if sum % 10 ~= 0 then
        print(sum)
    else
        print(sum-min)
    end
end