def set_thead_flag(template: str, threads: int) -> str:
    """
    Set the multithreading flag in the template if the number of threads is greater than 1.

    Args:
        template: The template to be modified.
        threads: The number of threads to be used.

    Returns:
        The modified template.
    """
    if threads > 1:
        return template.replace(
            "// {MULTITHREADING}", "ROOT::EnableImplicitMT({});".format(threads)
        )
    else:
        return template.replace("// {MULTITHREADING}", "")