void main()
{
    int n = readln.chomp.to!int;
    int[] s = new int[n];
    foreach (i; 0 .. n)
    {
        s[i] = readln.chomp.to!int;
    }

    bool[] dp = new bool[10001];
    dp[0] = true;
    foreach (p; s)
    {
        foreach_reverse (i, d; dp)
        {
            if (d)
            {
                dp[i+p] = true;
            }
        }
    }

    foreach_reverse (i, d; dp)
    {
        if (d && (i % 10 != 0 || i == 0))
        {
            i.writeln;
            break;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;