#include #define be(v) (v).begin(),(v).end() #define pb(q) push_back(q) typedef long long ll; using namespace std; const ll mod=1000000007, INF=(1LL<<60); #define doublecout(a) cout<> n; vector a(n); vector > b(n + 1, vector (10, -INF)); for(int i=0;i> a[i]; a[i] %= 10; } b[0][0] = 0; for(int i=0;i