
There are n people and 40 types of hats labeled from 1 to 40 .
Given a 2D integer array hats , where hats[i] is a list of all hats preferred by the i ^th person.
Return the number of ways that n people can wear different hats from each other.
Since the answer may be too large, return it modulo 10 ^9 + 7 .
n == hats.length1 <= n <= 101 <= hats[i].length <= 401 <= hats[i][j] <= 40hats[i] contains a list of unique integers.