def valid_day(tms):
    """Checks if day of month is valid"""
    year, month, day = tms[:3]
    if day > 31:
        return 0
    if month in [4, 6, 9, 11] and day > 30:
        return 0
    if month == 2 and (year%4 == 0 and day > 29 or day > 28):
        return 0
    return 1