You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well.  However, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade?
N = int(input())
s = []
f = True
for i in range(N):
  s.append(int(input()))
s = sorted(s, reverse = True)
a = sum(s)
if a%10 != 0:
  print(a)
  f = False

if f:
  m = 0
  f = True
  for i in range(N):
    if s[i]%10 != 0:
      f = False
      m = s[i]
      break

  if f:
    print(0)
  else:
    print(a-m)
N = int(input())
s = []
f = True
for i in range(N):
  s.append(int(input()))
s = sorted(s, reverse = True)
a = sum(s)
if a%10 != 0:
  print(a)
  f = False

if f:
  m = 0
  f = True
  s = sorted(s)
  for i in range(N):
    if s[i]%10 != 0:
      f = False
      m = s[i]
      break

  if f:
    print(0)
  else:
    print(a-m)