import math


def format_duration(seconds: float) -> str:
  """Formats duration in seconds into hours/minutes/seconds."""
  if seconds < 60:
    return f'{seconds:.0f}s'
  elif seconds < 3600:
    minutes = math.floor(seconds / 60)
    seconds -= minutes * 60
    return f'{minutes}m{seconds:.0f}s'
  else:
    hours = math.floor(seconds / 3600)
    seconds -= hours * 3600
    minutes = math.floor(seconds / 60)
    seconds -= minutes * 60
    return f'{hours}h{minutes}m{seconds:.0f}s'