SP16411 SLAST - Slasticar

Description

Organizing CS contests didn't prove very lucrative for Mirko, so he has opened an ice cream and pastry

Input Format

The first line of input contains the positive integer N (1 number. The second line of input contains N digits from 0 to 9, the long serial number. The third line of input contains the positive integer M (1 ingeredients. Each of the following M rows contains a single banned serial number, A banned serial number will not exceed 100 000 digits in length. The total length of all banned serial numbers will not exceed 3 000 000 digits.

Output Format

Output M integers, one per line. Line i must contain the dollar amount that Mirko needs to pay Slavko for the search for ingredient serial number i.