def round_num(n, m):
    if m == 0:
        return 0
    q = n / m
    if q >= 0:
        return int(q + 0.5) * m
    return int(q - 0.5) * m