import calendar


def nthday(nth, day, mdate):
    """Calculate the Nth day of the month"""
    # Generate calendar
    cal = calendar.monthcalendar(mdate.year, mdate.month)
    # Get all the specified days
    days = [week[day - 1] for week in cal]
    # Remove any zeros (zeros indicate that week doesn't include that day)
    days = [x for x in days if x != 0]
    # Get the nth day
    return days[nth - 1]