You are given a number n in hexadecimal. A new number can be made from the number n by selecting any subsequence of it (in HexaDecimal) and rearranging it.

You have tell the number of distinct numbers that can be made from number n.

Since the answer will be very large, output the answer as modulo 10^9+7.

**Input:**

First Line Consist of T - number of test cases. Only line of the test case contains a single line containing the input number in hexadecimal

**Output**

Print the desired output.

**Constraints:**

1<=T<=10

n<=2^8000 (n in decimal)

**Example:**

**Input:**

2

1F

1FF

**Output:**

4

8

**Explanation:**

For 1FF possible combinations are - 1,F,1F,F1,FF,1FF,F1F,FF1

Ibrahim Nash | 98 |

Stark_Maverick | 77 |

Eduardo Feo | 66 |

Micky_Kt | 62 |

Rohit Sharma 16 | 61 |

Lam Ngoc Pham | 463 |

All Is Well | 399 |

Divvya Sinha | 374 |

Prateek Gole | 369 |

Ibrahim Nash | 338 |

akhayrutdinov | 3855 |

sanjay05 | 3366 |

Michael Riegger | 2030 |

Jasleen Kaur 2 | 2012 |

Quandray | 1969 |