import torch


def _mean_plus_r_var(data: torch.Tensor, ratio: float = 0, **kwargs):
    """
    Function caclulates mean + ratio * stdv.
    and returns the largest of this value and the smallest element
    in the list (can happen when ratio is negative).
    """
    return max(
        data.min().item(),
        data.mean().item() + ratio * data.std().item() + 1e-8
    )