program ABC063C
    implicit none
    integer(8)::N,i,result
    integer(8)::flg=0
    integer(8),allocatable,dimension(:)::S
    read(5,*)N
    allocate(S(N))
    read(5,*)(S(i),i=1,N)
    S=iqsort(S)
    result=sum(S)

    if(mod(result,10)==0)then
        do i=1,N
            if(mod(S(i),10)/=0)then
                flg=1
                result=result-S(i)
                exit
            end if
        end do

        if(flg==0)then
            print'(i0)',0
        else
            print'(i0)',result
        end if
    else
        print'(i0)',result
    end if

contains
    recursive function iqsort(ix) result(ires)
      integer(8), allocatable :: ires(:)
      integer(8), intent(in)  :: ix(:)
      integer :: k
      if (size(ix) <= 1) then 
        ires = ix
      else  
        k = ix(size(ix) / 2)
        ires = [iqsort(pack(ix, ix < k)), pack(ix, ix == k), iqsort(pack(ix, ix > k))] 
      end if
    end function iqsort
end program ABC063C