long nthWeekday(int n, int weekday,
                    int year, int monthOfYear, int dayOfMonth)
    {
        if (n > 0) {
            return 7 * n + weekdayBefore
                (fixedFromGJ(year, monthOfYear, dayOfMonth), weekday);
        } else {
            return 7 * n + weekdayAfter
                (fixedFromGJ(year, monthOfYear, dayOfMonth), weekday);
        }
    }