#!/usr/bin/python from sys import * from string import * def message(): print "Usage: shift \n" exit() try: argument=int(argv[1]) except: message() def parse(line): global argument try: words=line.split() number=int(words[0]) new_number=number+argument if new_number < 0 : new_number=0 stdout.write(str(new_number)+' '+join(words[1:])+'\n') except ValueError: stdout.write(join(words)+'\n') except IndexError: stdout.write(line) chunk=stdin.readlines() try: for line in chunk: parse(line) except: exit()