##################################
#                                #
# Last modified 2018/11/28       # 
#                                #
# Georgi Marinov                 #
#                                # 
##################################

import sys
from sets import Set

def run():

    if len(sys.argv) < 2:
        print 'usage: python %s input radius' % sys.argv[0]
        print '\tNote: the script will print to stdout by default'
        sys.exit(1)

    input = sys.argv[1]
    R = int(sys.argv[2])

    listoflines = open(input)
    for line in listoflines:
        if line.startswith('#'):
            continue
        fields = line.strip().split('\t')
        chr = fields[0]
        left = int(fields[1])
        peak = left + int(fields[9])
        outline = chr + '\t' + str(peak- R) + '\t' + str(peak + R)
        print outline

run()

