import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val s = (1..n).map { sc.nextInt() }
    val dp = Array(10002) {false}
    dp[0] = true

    for (i in 0 until n) {
        for (j in 10000 downTo 0) {
            if (!dp[j]) {
                continue
            }
            dp[j + s[i]] = true
        }
    }

    for (i in 10000 downTo 0) {
        if (dp[i] && i % 10 != 0) {
            println(i)
            return
        }
    }
    println(0)
}