An integer L (1 ≤ L ≤ 20) and an integer Q (1 ≤ Q ≤ 1,000,000), separated by a space.
A string S of length 2^L consisting of characters from the set {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}.
Q strings T_d each of length L, consisting of characters from the set {'0', '1', '?'}.

### Example Input:

```
3 5
12345678
000
0??
1?0
?11
???
```

### Function Signature:
Write a function f(L, Q, S, T) that takes in the input.
def f(L: int, Q: int, S: str, T: List[str]):
    '''
    L: an integer
    Q: an integer
    S: a string
    T: a list of strings
    '''