The whole world got obsessed with robots,and to keep pace with the progress, great Berland's programmer Draude decided to build his own robot. He was working hard at the robot. He taught it to walk the shortest path from one point to another, to record all its movements, but like in many Draude's programs, there was a bug — the robot didn't always walk the shortest path. Fortunately, the robot recorded its own movements correctly. Now Draude wants to find out when his robot functions wrong. Heh, if Draude only remembered the map of the field, where he tested the robot, he would easily say if the robot walked in the right direction or not. But the field map was lost never to be found, that's why he asks you to find out if there exist at least one map, where the path recorded by the robot is the shortest.

The map is an infinite checkered field, where each square is either empty, or contains an obstruction. It is also known that the robot never tries to run into the obstruction. By the recorded robot's movements find out if there exist at least one such map, that it is possible to choose for the robot a starting square (the starting square should be empty) such that when the robot moves from this square its movements coincide with the recorded ones (the robot doesn't run into anything, moving along empty squares only), and the path from the starting square to the end one is the shortest.

In one movement the robot can move into the square (providing there are no obstrutions in this square) that has common sides with the square the robot is currently in.
The first line of the input file contains the recording of the robot's movements. This recording is a non-empty string, consisting of uppercase Latin letters L, R, U and D, standing for movements left, right, up and down respectively. The length of the string does not exceed 100.
none
LLUUUR
OK
RRUULLDD
BUG
L
OK
R
OK
R
OK
RR
OK
DL
OK
LD
OK
RUL
BUG
ULD
BUG
DDR
OK
RRDD
OK
RRLR
BUG
RRDL
BUG
LRUD
BUG
RDRLL
BUG
DRDRD
OK
ULURL
BUG
LUUDU
BUG
RDLUR
BUG
DLDLDDRR
OK
RDRDDD
OK
UULLDLUR
BUG
LULU
OK
LLDDLDLLDDDLLLDLLLLLUU
OK
LLDDLDLLDDDLLLDLLLLLUU
OK
LLDDLDLLDDDLLLDLLLLLUU
OK
URRRRRURRURUURRRRRDDDDLDDDRDDDDLLDLL
OK
R
OK
UL
OK
UDR
BUG
DDDR
OK
UUUDU
BUG
LULULL
OK
DLURUUU
BUG
UURUURRUUU
OK
DDDDRDDLDDDDDDDRDDLD
OK
URRRLULUURURLRLLLLULLRLRURLULRLULLULRRUU
BUG
RURRRRLURRRURRUURRRRRRRRDDULULRRURRRDRRRRRRRRRRLDR
BUG
RLRRRRRDRRDRRRRDLRRRRRRRDLRLDDLRRRRLDLDRDRRRRDRDRDRDLRRURRLRRRRDRRRRRRRRLDDRLRRDRRRRRRRDRDRLDRDDDRDR
BUG
DDUL
BUG
UUULLLLRDD
BUG
LLLLLLLLRRRRDDDDDDDUUUUUU
BUG
DDDDDDDDDDDDUUUUUUUUUUUURRRRRRRRRRRRRLLLLLLLLLLLLLLL
BUG
DDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLLRRRRRRRRRRRRRRRRRRRRRRRRRRRUUUUUUUUUUUUUUUUUUUUUUUU
BUG
DLUR
BUG
UUUURDLLLL
BUG
RRRRRRRRRRRURLLLLLLLLLLLL
BUG
LLLLLLLLLLLLLLLLLLLLLLLLLLRUUUUUUUUUUUUUUUUUUUUUUUUU
BUG
UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUURDRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
BUG
DDLDRRR
BUG
RRUULLD
BUG
LUUUULLLLDDDDRRRD
BUG
DDDDLLLDDDRRRUURRRR
BUG
DDDDDDDLLDDRRURRRRRRR
BUG
DDDDDDDDDDLLLLLLLLLLLDDDDDDDDDDDRRRRRRRRRRRUUUUUUUUUURRRRRRRRRR
BUG
DDDLLLLLLLDDDDDDDRRRRRRRUUUUUURRR
BUG
RRRUUULLLDD
BUG
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLLLLDDDDRRRRUUURRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
BUG
RRRRRRRRRRRDDDDDDDDDDDDDDDDDDDRRRRRRRRRRRRRRRRRRRUUUUUUUUUUUUUUUUUUULLLLLLLLLLLLLLLLLLUUUUUUUUUUU
BUG
x=input()
l=u=r=d=0
for i in x:
    if i=='L':
        l+=1
    elif i=='R':
        r+=1
    elif i=='D':
        d+=1
    else:
        u+=1
if(l==u and l==r and l==d):
    print('BUG')
else:
    print('OK')