def f1_score(fn: float, fp: float, tp: float) -> float:
    """
    Calculate F1 score.

    :param fn: False negative count.
    :param fp: False positive count.
    :param tp: True positive count.
    :return: F1 score.
    """
    return 0.0 if 2 * tp + fp + fn == 0 else (2 * tp) / ((2 * tp) + fp + fn)