#!/usr/bin/env python3
import sys
import os

def usage():
    print("TODO USAGE")
    exit(1)

wd = os.getcwd().split("/")[1:]
arg = sys.argv[1:]

if len(arg) not in (1,2):
    usage()

new_part=arg[1] if len(arg)>1 else ""
place=arg[0].split(":")

begin = int(place[0]) if place[0] else 0
if begin<0:
    begin += len(wd)
end = begin + 1
if len(place)>1:
    end = int(place[1]) if place[1] else len(wd)

if len(place)>2:
    usage()


print("/".join([""]+wd[:begin]+[new_part]+wd[end:]))
