// Arup Guha
// 4/12/2012
// Solution to 2003 South East Regional Problem: Collide

#include <stdio.h>

long long lcm(long long a, long long b);
long long gcd(long long a, long long b);
long long gcd2(long long a, long long b);

int main() {

    int numPlanets, list = 1;
    scanf("%d", &numPlanets);

    // Process each case.
    while (numPlanets > 0) {

        long long period = 1;

        int i;

        // Add in each planet to the calculation.
        for (i=0; i<numPlanets; i++) {

            long long newplanet;
            scanf("%lld", &newplanet);

            // Detects periods that are too long.
            if (period == -1) continue;

            // Recalculate the new period with this planet.
            period = lcm(period, newplanet);

            // Our period is too long.
            if (period > 2147483647.1) {
                period = -1;
            }
        }

        // Output the results.
        if (period != -1)
            printf("%d: THE WORLD ENDS IN %d DAYS\n", list, period );
        else
            printf("%d: NOT TO WORRY\n", list);

        scanf("%lld", &numPlanets);
        list++;
    }
    return 0;

}

// Calculates the least common multiple of a and b.
long long lcm(long long a, long long b) {
    return a/gcd(a,b)*b;
}

// Recursively calculates the greatest common divisor of a and b.
long long gcd(long long a, long long b) {

    if (a == 0) return b;
    if (b == 0) return a;
    return gcd(b, a%b);
}
