#!/usr/bin/env python
import sys
import optparse as op

def get_options(args):
	parser = op.OptionParser()
	options,rem = parser.parse_args(args)
	options.filename = args[1]
	return options

def main():
	if len(sys.argv) < 2:
		print "Specify file name"
		return
	options = get_options(sys.argv)
	#print "TwoTheta","Counts"
	startoff= 0
	breakoff = 180
	total = 0
	results = []
	for line in open(options.filename):
		if len(line.split()) < 2:
			continue
		(first,count) = line.split()
		(first,count) = (float(first),int(count))
		results.append((first,count))
		total+=count
	for first,count in results:
		print first,(1.0*count)/total

if __name__ == "__main__":
	main()
