Every summer Vitya comes to visit his grandmother in the countryside. This summer, he got a huge wart. Every grandma knows that one should treat warts when the moon goes down. Thus, Vitya has to catch the moment when the moon is down.

Moon cycle lasts 30 days. The size of the visible part of the moon (in Vitya's units) for each day is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, and then cycle repeats, thus after the second 1 again goes 0.

As there is no internet in the countryside, Vitya has been watching the moon for n consecutive days and for each of these days he wrote down the size of the visible part of the moon. Help him find out whether the moon will be up or down next day, or this cannot be determined by the data he has.


-----Input-----

The first line of the input contains a single integer n (1 ≤ n ≤ 92) — the number of consecutive days Vitya was watching the size of the visible part of the moon. 

The second line contains n integers a_{i} (0 ≤ a_{i} ≤ 15) — Vitya's records.

It's guaranteed that the input data is consistent.


-----Output-----

If Vitya can be sure that the size of visible part of the moon on day n + 1 will be less than the size of the visible part on day n, then print "DOWN" at the only line of the output. If he might be sure that the size of the visible part will increase, then print "UP". If it's impossible to determine what exactly will happen with the moon, print -1.


-----Examples-----
Input
5
3 4 5 6 7

Output
UP

Input
7
12 13 14 15 14 13 12

Output
DOWN

Input
1
8

Output
-1



-----Note-----

In the first sample, the size of the moon on the next day will be equal to 8, thus the answer is "UP".

In the second sample, the size of the moon on the next day will be 11, thus the answer is "DOWN".

In the third sample, there is no way to determine whether the size of the moon on the next day will be 7 or 9, thus the answer is -1.

Difficulty: interview

Starter code:

Solutions:
# You lost the game.

n = int(input())
L = list(map(int, input().split()))

if n == 1:
    if L[0] == 0:
        print("UP")
    elif L[0] == 15:
        print("DOWN")
    else:
        print("-1")
else:
    d = L[n-2] - L[n-1]
    if d < 0:
        if L[n-1] == 15:
            print("DOWN")
        else:
            print("UP")
    else:
        if L[n-1] == 0:
            print("UP")
        else:
            print("DOWN")


n = int(input())
line = list(map(int, input().split()))
if n == 1 and line[0] != 0 and line[0] != 15:
    print(-1)
elif n == 1 and line[0] == 0:
    print("UP")
elif n == 1:
    print("DOWN")
else:
    if line[-1] > line[-2] and line[-1] == 15:
        print("DOWN")
    elif line[-1] > line[-2]:
        print("UP")
    elif line[-1] == 0:
        print("UP")
    else:
        print("DOWN")


n = int(input())
k = list(map(int, input().split()))

UP = "UP"
DOWN = "DOWN"

if k[-1] == 15:
    print(DOWN)
elif k[-1] == 0:
    print(UP)
elif n == 1:
    print(-1)
else:
    if k[-2] > k[-1]:
        print(DOWN)
    else:
        print(UP)


import sys, math
n = int(input())
z = list(map(int, input().split()))
if n == 1:
    if z[0] == 0:
        print('UP')
        return
    if z[0] == 15:
        print('DOWN')
        return
    print(-1)
    return
if z[-1] == 0:
    print('UP')
    return
if z[-1] == 15:
    print('DOWN')
    return
z.append(z[-1] + z[-1] - z[-2])
if z[-1] > z[-2]:
    print('UP')
else:
    print('DOWN')

n = int(input())
a = list(map(int, input().split()))
if (a[-1] == 15):
    print("DOWN")
    return
elif a[-1] == 0:
    print("UP")
    return
if (len(a) == 1):
    print(-1)
else:
    if (a[-1] < a[-2]):
        print("DOWN")
    else:
        print("UP")

arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]

n = int(input())
prr = [int(x) for x in input().split()]
if(n==1):
    a = prr[0]
    if(a==0):
        print('UP')
    elif(a==15):
        print('DOWN')
    else:
        print(-1)
else:
    a,b = prr[n-2],prr[n-1]
    c = b-a
    if(c==1):
        if(b!=15):
            print('UP')
        else:
            print('DOWN')
    else:
        if(b!=0):
            print('DOWN')
        else:
            print('UP')

n = int(input())
data = list(map(int, input().split()))
if data[-1] == 0:
  print("UP")
elif data[-1] == 15:
  print("DOWN")
else:  
  if n == 1:
    print(-1)
  elif data[-1] - data[-2] > 0:
    print("UP")
  else:  
    print("DOWN")


n = int(input())
A = list(map(int, input().split()))
if n == 1:
    if A[0] == 15:
        print('DOWN')
    elif A[0] == 0:
        print('UP')
    else:
        print(-1)
else:
    per = A[-1]
    per2 = A[-2]
    if per == 15:
        print('DOWN')
    elif per == 0:
        print('UP')
    else:
        if per > per2:
            print('UP')
        else:
            print('DOWN')


n=int(input())
l=list(map(int,input().split()))
if n==1:
    if l[0]==0: print("UP")
    elif l[0]==15: print("DOWN")
    else: print(-1)
elif (l[-1]==0 or l[-2]<l[-1]) and l[-1]!=15: print("UP")
else: print("DOWN")

n = int(input())

ai = [int(x) for x in input().split(' ')]

if ai[-1] == 0:
    print('UP')
    return
elif ai[-1] == 15:
    print('DOWN')
    return

if n == 1 and ai[0] not in [0, 15]:
    print(-1)
    return

k = ai[-2:]

if k[0] - k[1] > 0:
    print('DOWN')
else:
    print('UP')


n = int(input().strip())
arr = [int(x) for x in input().strip().split(' ')]
if n == 1:
    if arr[0] == 0:
        print('UP')
    elif arr[0] == 15:
        print('DOWN')
    else:
        print(-1)
else:
    if arr[n-1] == 0:
        print('UP')
    elif arr[n-1] == 15:
        print('DOWN')
    else:
        print('UP' if arr[n-1] > arr[n-2] else 'DOWN')



n = int(input().strip())
a = list(map(int, input().split()))
if a[-1] == 15:
    print('DOWN')
elif a[-1] == 0:
    print('UP')
else:
    if n == 1:
        print(-1)
    else:
        if a[-2] < a[-1]:
            print('UP')
        else:
            print('DOWN')


#!/usr/bin/env python3

from sys import stdin


def main():
    n, = stdin_get_ints_from_line()
    x = stdin_get_ints_list_from_line()

    if x[-1] == 15:
        print('DOWN')
        return

    if x[-1] == 0:
        print('UP')
        return

    if n == 1:
        print('-1')
        return

    if x[-1] > x[-2]:
        print('UP')

    if x[-1] < x[-2]:
        print('DOWN')



def stdin_get_ints_from_line():
    return (int(x) for x in stdin.readline().strip().split(' '))


def stdin_get_ints_list_from_line():
    return list(int(x) for x in stdin.readline().strip().split(' '))


def stdin_get_string_from_line():
    return stdin.readline().strip()


def __starting_point():
    main()

__starting_point()

n=int(input())
d=input().split()
d=[int(x) for x in d]
if n==1 and int (d[0])!=15 and int (d[0])!=0:
    print(-1)
elif n==1 and int(d[0])==0:
    print("UP")
elif n==1 and int(d[0])==15:
    print("DOWN")
else:
    if (d[-1]>d[-2] and d[-1]!=15 )or d[-1]==0:
        print("UP")
    elif ( d[-1]<d[-2] and d[-1]!=0) or d[-1]==15:
        print("DOWN")


from sys import stdin as fin
# fin = open("cfr373a.in")

n = int(fin.readline())
# n, m = map(int, fin.readline.split())
nums = tuple(map(int, fin.readline().split()))

ans = {15: "DOWN", 0: "UP"}
if nums[-1] in ans:
    print(ans[nums[-1]])
elif len(nums) == 1:
    print(-1)
else:
    print("DOWN" if nums[-1] < nums[-2] else "UP")

n = int(input())
a = [int(_) for _ in input().split()]
if a[-1] == 15:
    print('DOWN')
elif a[-1] == 0:
    print('UP')
elif n == 1:
    print(-1)
elif a[-1] > a[-2]:
    print('UP')
else:
    print('DOWN')


'''
def main():
    from sys import stdin,stdout
def __starting_point():
    main()
'''
#372
#1
'''
def main():
    from sys import stdin,stdout
    n,c=map(int,stdin.readline().split())
    tup=tuple(map(int,stdin.readline().split()))
    counter=1
    for i in range(1,n):
        if tup[i]-tup[i-1]<=c:
            counter+=1
        else:
            counter=1
    stdout.write(str(counter))
def __starting_point():
    main()
'''
#2
'''
def main():
    from sys import stdin,stdout
    s=stdin.readline().strip().lower()
    dic={}
    qcounter=0
    for i in 'qwertyuiopasdfghjklzxcvbnm':
        dic[i]=0
    if len(s)<26:
        stdout.write('-1')
    else:
        for i in s:
            if i=='?':
                qcounter+=1
            else:
                dic[i]+=1
        l=[]
        x=list(dic.values()).count(0)
        if qcounter==26 and x==26:
            stdout.write('qwertyuiopasdfghjklzxcvbnm'.upper())
        elif x==0 and qcounter==0:
            stdout.write(s.upper())
        elif qcounter>=x:
            for i in 'qwertyuiopasdfghjklzxcvbnm':
                if dic[i]==0:
                    l.append(i.upper())
            m=len(l)
            i=0
            t=''
            for j in range(len(s)):
                if s[j]=='?':
                    if i>=m:
                        i=0
                    t=t[:j]+l[i]
                    i+=1
                else:
                    t+=s[j].upper()
            stdout.write(t)
        else:
            stdout.write('-1')
def __starting_point():
    main()
'''
#373
#1
def main():
    from sys import stdin,stdout
    n=int(stdin.readline())
    tup=tuple(map(int,stdin.readline().split()))
    if n==1:
        if tup[0]==0:
            stdout.write('UP')
        elif tup[0]==15:
            stdout.write('DOWN')
        else:
            stdout.write('-1')
    else:
        if tup[-1]-tup[-2]>0:
            if tup[-1]==15:
                stdout.write('DOWN')
            else:
                stdout.write('UP')
        else:
            if tup[-1]==0:
                stdout.write('UP')
            else:
                stdout.write('DOWN')
def __starting_point():
    main()


__starting_point()

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

n=int(input())
days=list(map(int,input().split()))

if days[-1] == 0:
    print("UP")
elif days[-1] == 15:
    print("DOWN")
elif n == 1:
    print("-1")
else:
    if days[-1] - days[-2] > 0:
        print("UP")
    else:
        print("DOWN")



n=int(input())
a = list(map(int,input().split()))
if n>1:
	if a[n-1]>a[n-2]:
		if a[n-1]==15:
			print('DOWN')
		else:
			print('UP')
	else:
		if a[n-1]==15:
			print('DOWN')
		else:
				if a[n-1]==0:
					print('UP')
				else:
					print('DOWN')
else:
	if a[0]==15:
		print('DOWN')
	else:
		if a[0]==0:
			print('UP')
		else:
			print(-1)


n = int(input())
a = list(map(int, input().split()))
if a[-1] == 0:
    print("UP")
elif a[-1] == 15:
    print("DOWN")
elif n == 1:
    print(-1)
else:
    if a[-1] > a[-2]:
        print("UP")
    else:
        print("DOWN")

def ans(n, seq):
    if n == 1:
        if seq[0] == 0:
            return 'UP'
        elif seq[0] == 15:
            return 'DOWN'
        else:
            return -1
    elif seq[-1] == 15:
        return 'DOWN'
    elif seq[-1] == 0:
        return 'UP'
    elif seq[-1] > seq[-2] and seq[-1] != 15:
        return 'UP'
    elif seq[-1] < seq[-2] and seq[-1] != 0:
        return 'DOWN'

n = int(input())
seq = list(map(int, input().split()))
print(ans(n,seq))

n = int(input())
a = list(map(int, input().split()))

if n == 1 and a[0] != 0 and a[0] != 15:
    print(-1)
elif a[-1] == 0:
    print("UP")
elif a[-1] == 15:
    print("DOWN")
elif a[-2] < a[-1]:
    print("UP")  
elif a[-2] > a[-1]:
    print("DOWN")

def main():
    n = int(input())

    a = [int(s) for s in input().split()]

    if a[-1] == 15:
        print("DOWN")
        return
    if a[-1] == 0:
        print("UP")
        return
    if n == 1:
        print(-1)
        return
    if a[-2] < a[-1]:
        print("UP")
        return
    else:
        print("DOWN")
        return

main()


def main():
    n = int(input())
    days = list(map(int, input().split()))
    if n == 1:
        if days[0] == 15:
            print("DOWN")
        elif days[0] == 0:
            print("UP")
        else:
            print(-1)
        return
    moves = [1, -1]
    now = 0
    last = days[0]
    if days[1] < days[0]:
        now = (now + 1) % 2
    for i in range(1, n):
        last += moves[now]
        if last == 0 or last == 15:
            now = (now + 1) % 2
    if now == 1:
        print("DOWN")
    else:
        print("UP")
main()

n = int(input())
a = list(map(int, input().split()))

if n <= 1:
	if n and a[0] in (0, 15):
		print('UP' if a[0] == 0 else 'DOWN')
		return
	print('-1')
	return

if a[-1] - a[-2] >= 1:
	if a[-1] < 15:
		print('UP')
	else:
		print('DOWN')
else:
	if a[-1] <= 0:
		print('UP')
	else:
		print('DOWN')