See the problem statement here: [http://codeforces.com/contest/921/problem/01](//codeforces.com/contest/921/problem/01).
none
none
print("""for-41
    for-250
        for-1000
            take
            move-right
            if-ok
                break
            else
                open-down
                move-down
            endif
        end
        for-1000
            take
            move-right
            if-ok
                break
            else
                open-up
                move-up
            endif
        end
    end
    for-249
        for-1000
            move-left
            if-ok
                break
            else
                move-down
            endif
        end
        for-1000
            move-left
            if-ok
                break
            else
                move-up
            endif
        end
    end
    for-1000
        move-left
        if-ok
            break
        else
            move-down
        endif
    end
    move-down
end
move-down
for-510
    open-right
    move-right
end""")
