Hidden Digits

아직 제출이 없습니다시간 제한5초메모리 제한1024 MB

문제

You are given a sequence of nn digits d_0d\_0, d_1d\_1, \dots d_n1d\_{n - 1}. Find the minimum positive integer xx such that for all 0i<n0 \le i < n, the decimal representation of number x+ix + i contains the digit d_id\_i.

입력

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1051 \le t \le 10^5). The description of the test cases follows.

The first line of each test case contains a single integer nn (1n1061 \le n \le 10^6).

The second line contains a string of nn digits d_0d_1d_n1d\_0 d\_1 \ldots d\_{n-1} (0d_i90 \le d\_i \le 9).

It is guaranteed that the sum of nn over all test cases does not exceed 10610^6.

출력

For each test case, print a single integer xx --- the smallest positive integer such that the decimal representation of x+ix+i contains the digit d_id\_i for all 0i<n0 \le i < n.