def group_from_value(groups, v):
 sum = 0
 for (g, p) in groups:
  sum = (sum + p)
  if (sum > v):
   return g
 return g

def group_from_value ( groups , v ) : sum = 0 for ( g , p ) in groups : sum = ( sum + p ) if ( sum > v ) : return g return g
given group: ( .