import std.algorithm,
       std.string,
       std.range,
       std.stdio,
       std.conv;

void chmax(T)(ref T a, ref T b) {
  if (a < b) {
    a = b;
  }
}

void main() {
  int   N = readln.chomp.to!int;
  int[] s = N.iota.map!(_ => readln.chomp.to!int).array;
  bool[10000][100] dp;
  dp[0][0] = true;
  dp[0][s[0]] = true;

  foreach (i; 1..N) {
    foreach (j; 10000.iota) {
      if (dp[i - 1][j]) {
        dp[i][j+s[i]] = true;
        dp[i][j]      = true;
      }
    }
  }

  int ans;

  foreach (i; 10000.iota) {
    if (dp[N-1][i]) {
      if (i % 10) {
        chmax(ans, i);
      }
    }
  }

  writeln(ans);