#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<array>
#include<queue>

namespace lib
{
	template<class T, class Comp>using p_queue = std::priority_queue<T, std::vector<T>, Comp>;

	template<std::uint64_t Mod>struct modnum;
	template<class T>constexpr T pow(T base, std::size_t p)
	{
		if (p == 0)
		{
			return T(1);
		}
		else if (p == 1)
		{
			return base;
		}
		else if (p == 2)
		{
			return base*base;
		}
		else if (p % 2 == 0)
		{
			return pow(pow(base, p / 2), 2);
		}
		else
		{
			return pow(pow(base, p / 2), 2)*base;
		}
	}
	template<std::uint64_t Mod>constexpr auto inverse(modnum<Mod> const&);

	template<std::uint64_t Mod>struct modnum
	{
		static constexpr auto mod = Mod;
		std::uint64_t val;
		modnum() = default;
		constexpr modnum(std::uint64_t v) :val(v%Mod)
		{

		}

		constexpr modnum& operator+=(modnum const& v)
		{
			val += v.val;
			val %= mod;
			return *this;
		}
		constexpr modnum& operator-=(modnum const& v)
		{
			val += mod - v.val;
			val %= mod;
			return *this;
		}
		constexpr modnum& operator*=(modnum const& v)
		{
			val *= v.val;
			val %= mod;
			return *this;
		}
		constexpr modnum& operator/=(modnum const& v)
		{
			return operator*=(inverse(v));
		}
	};
	template<std::uint64_t Mod>constexpr auto operator+(modnum<Mod> lhs, modnum<Mod>const& rhs)
	{
		return lhs += rhs;
	}
	template<std::uint64_t Mod>constexpr auto operator+(modnum<Mod> lhs, int rhs)
	{
		return lhs += rhs;
	}
	template<std::uint64_t Mod>constexpr auto operator+(int lhs, modnum<Mod> rhs)
	{
		return rhs += lhs;
	}
	template<std::uint64_t Mod>constexpr auto operator-(modnum<Mod> lhs, modnum<Mod>const& rhs)
	{
		return lhs -= rhs;
	}
	template<std::uint64_t Mod>constexpr auto operator*(modnum<Mod> lhs, modnum<Mod>const& rhs)
	{
		return lhs *= rhs;
	}
	template<std::uint64_t Mod>constexpr auto operator*(modnum<Mod> lhs, int rhs)
	{
		return lhs *= rhs;
	}
	template<std::uint64_t Mod>constexpr auto operator*(int lhs, modnum<Mod> rhs)
	{
		return rhs *= lhs;
	}

	template<std::uint64_t Mod>constexpr auto operator/(modnum<Mod> lhs, modnum<Mod>const& rhs)
	{
		return lhs /= rhs;
	}

	template<std::uint64_t Mod>constexpr auto inverse(modnum<Mod>const& base)
	{
		return pow(base, Mod - 2);
	}

	template<class T>constexpr auto clamp(T v)
	{
		return std::max(v, T());
	}
	template<class T>void sort(std::vector<T>& vec)
	{
		std::sort(vec.begin(), vec.end());
	}
	template<class T, class Comp>void sort(std::vector<T>& vec, Comp&& comp)
	{
		std::sort(vec.begin(), vec.end(), std::forward<Comp>(comp));
	}

	template<class T>void vector_input(std::vector<T>& vec)
	{
		for (auto& v : vec)
		{
			std::cin >> v;
		}
	}

	template<class T>auto lower_bound(std::vector<T>const& vec, T v)
	{
		return std::distance(vec.begin(), std::lower_bound(vec.begin(), vec.end(), v));
	}
	template<class T>auto upper_bound(std::vector<T>const& vec, T v)
	{
		return std::distance(vec.begin(), std::upper_bound(vec.begin(), vec.end(), v));
	}

	struct scope_exit
	{
		std::function<void(void)> func;
		scope_exit(std::function<void(void)> f) :func(f)
		{

		}
		~scope_exit()
		{
			func();
		}
	};

	template<int val>using int_tag = std::integral_constant<int, val>;
}

void Main();
int main()	
{
	std::cin.tie(nullptr);
	std::cin.sync_with_stdio(false);
	Main();
}


void Main()
{
	int N;
	std::cin >> N;
	bool flag[10001] = { true };
	for (int i{}; i < N; ++i)
	{
		int x;
		std::cin >> x;
		for (int j = 10000; j >= 0; --j)
		{
			if (flag[j])
			{
				flag[j + x] = true;
			}
		}
	}
	for (int i = 10000; i >= 0; --i)
	{
		if (flag[i] && (i % 10 != 0))
		{
			std::cout << i << std::endl;
			return;
		}
	}
	std::cout << 0 << std::endl;
}

Measured memory_bytes: 256