def mjd2grego(mjd):
    """Modified Julian Date -> Gregorian Calendar Date
    """
    n = mjd + 678881
    a = 4*n + 3 + 4*(3*(4*(n+1)//146097+1)//4)
    b = 5*((a % 1461)//4) + 2
    y, m, d = a//1461, b//153 + 3, (b % 153)//5 + 1
    if m >= 13:
        y += 1
        m -= 12
    return y, m, d