#!/usr/bin/env python
# Copyright (c) 2008 Arastra, Inc.  All rights reserved.
# Arastra, Inc. Confidential and Proprietary.

import itertools
import re
import sys

valUnitPattern = re.compile( r"^(?P<value>\d*(.\d+)?)(?P<unit>.*)$" )
allowedUnits = set( [ prefix + suffix for prefix, suffix in itertools.product(
                      [ "", "k", "m", "g", "t" ], [ "", "bps", "pps" ] ) ] )
allowedUnits |= set( [ "%" ] )
# Units may be followed by a period.
allowedUnits |= { unit + '.' for unit in allowedUnits }

def nonzero( line ):
   parts = line.strip().split()
   hasNum = False
   for part in parts:
      group = re.match( valUnitPattern, part ).groupdict()
      try:
         value, unit = float( group[ "value" ] ), group[ "unit" ]
      except ValueError:
         pass
      else:
         if unit.lower() in allowedUnits:
            hasNum = True
            if value:
               return True
   return not hasNum

try:
   for line in sys.stdin:
      if nonzero( line ):
         print line,
except KeyboardInterrupt:
   sys.exit( 1 )
except IOError:
   sys.exit( 1 )

