import codecs


def modifyHexByte (hexStr, n):
  """Takes a hex string and modifies the n-th byte in it."""

  arr = bytearray (codecs.decode (hexStr, "hex"))
  arr[n] = (arr[n] + 1) % 256

  return arr.hex ()