#include using namespace std; typedef long long ll; typedef long double ld; typedef pair ii; #define pb push_back #define all(x) (x).begin(), (x).end() #define sqr(x) ((x) * (x)) #define X first #define Y second #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR (i, 0, n) #define TRACE(x) cout << #x << " = " << x << endl #define _ << " _ " << #define debug(...) fprintf(stderr, __VA_ARGS__) #define MOD 1000000007LL #define MAXN 100100 int a[MAXN]; int pre[MAXN]; vector has[10]; int rj[MAXN]; int main() { memset(rj, -1, sizeof rj); int n; scanf("%d", &n); has[0].pb(-1); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); pre[i] = a[i] + (i ? pre[i - 1] : 0); pre[i] %= 10; has[pre[i]].pb(i);//cout<