from typing import Iterable


def decimalify_leading(char_set: Iterable[str], text: str) -> str:
    """Replace first character with decimal representation if it's included in
    `char_set`."""
    if not char_set or not text:
        return text
    first_char = text[0]
    if first_char in char_set:
        return f"&#{ord(first_char)};{text[1:]}"
    return text