def suffix(d: int) -> str:
    """Convert an input date integer to a string with a suffix.

    Example:
        >>> suffix(10)
        'th'
        >>> suffix(2)
        'nd'
        >>> suffix(23)
        'rd'
        >>> suffix(4)
        'th'

    """
    return "th" if 11 <= d <= 13 else {1: "st", 2: "nd", 3: "rd"}.get(d % 10, "th")