def accuracy(tp: float, fn: float, tn: float, fp: float) -> float:
    """
    Calculate accuracy.

    :param tp: True positive count.
    :param fn: False negative count.
    :param tn: True negative count.
    :param fp: False positive count.
    :return: Accuracy.
    """
    return 0.0 if tp + tn + fp + fn == 0 else (tp + tn) / (tp + tn + fp + fn)