Function to find product of all elements in all subsets
static int product ( int [ ] a , int n ) { int ans = 1 ; int val = ( int ) Math . Pow ( 2 , n - 1 ) ; for ( int i = 0 ; i < n ; i ++ ) { ans *= ( int ) Math . Pow ( a [ i ] , val ) ; } return ans ; }