parameters: (self, nums)
return_statement: return result
docstring: :type nums: List[int]
          :rtype: int
docstring_summary: :type nums: List[int]
          :rtype: int
docstring_tokens: : type nums : List [ int ] : rtype : int
function: def subarraysWithMoreZerosThanOnes(self, nums):
          """
          :type nums: List[int]
          :rtype: int
          """
          MOD = 10**9+7
  
          lookup = {0:-1}
          dp = [0]*len(nums)
          result = total = 0
          for i, x in enumerate(nums):
              total += 1 if x == 1 else -1
              if total not in lookup:
                  if total > 0:
                      dp[i] = i+1
              else:
                  j = lookup[total]
                  if j != -1:
                      dp[i] = dp[j]
                  if x > 0:
                      dp[i] += (i-1)-j
              lookup[total] = i
              result = (result+dp[i])%MOD
          return result
function_tokens: def subarraysWithMoreZerosThanOnes ( self , nums ) : MOD = 10 ** 9 + 7 lookup = { 0 : - 1 } dp = [ 0 ] * len ( nums ) result = total = 0 for i , x in enumerate ( nums ) : total += 1 if x == 1 else - 1 if total not in lookup : if total > 0 : dp [ i ] = i + 1 else : j = lookup [ total ] if j != - 1 : dp [ i ] = dp [ j ] if x > 0 : dp [ i ] += ( i - 1 ) - j lookup [ total ] = i result = ( result + dp [ i ] ) % MOD return result