Secret Sharing

Time limit2sMemory limit128 MB

Problem

An encryption key can be divided among several people instead of being stored as one piece. The key is split into N digit strings called shares.

A new encryption algorithm uses a very long decimal integer as its key. The key must start with a nonzero digit, and every share must be used exactly once. The order of the shares is determined by this rule: among all concatenations that use every share, the encryption key is the smallest valid decimal integer. Any concatenation that starts with 0 is invalid.

Given N shares, restore the encryption key.

Input

The first line contains the number of shares N (1 <= N <= 100).

The next line contains N digit strings. Each share has length at most 5, and a share may start with 0.

Output

Print the restored encryption key on one line.

If no key satisfies the conditions, print INVALID.