Subarrays with distinct elements

how to compute answer in ans % 10^9+7 format?

Hi @Vibhuti0206
For calculating answer as ans % 10^9+7 format you have to just perform a simple operation that is :

ans=ans%1000000007;