You a captain of a ship. Initially you are standing in a point $(x_1, y_1)$ (obviously, all positions in the sea can be described by cartesian plane) and you want to travel to a point $(x_2, y_2)$. 

You know the weather forecast — the string $s$ of length $n$, consisting only of letters U, D, L and R. The letter corresponds to a direction of wind. Moreover, the forecast is periodic, e.g. the first day wind blows to the side $s_1$, the second day — $s_2$, the $n$-th day — $s_n$ and $(n+1)$-th day — $s_1$ again and so on. 

Ship coordinates change the following way:  if wind blows the direction U, then the ship moves from $(x, y)$ to $(x, y + 1)$;  if wind blows the direction D, then the ship moves from $(x, y)$ to $(x, y - 1)$;  if wind blows the direction L, then the ship moves from $(x, y)$ to $(x - 1, y)$;  if wind blows the direction R, then the ship moves from $(x, y)$ to $(x + 1, y)$. 

The ship can also either go one of the four directions or stay in place each day. If it goes then it's exactly 1 unit of distance. Transpositions of the ship and the wind add up. If the ship stays in place, then only the direction of wind counts. For example, if wind blows the direction U and the ship moves the direction L, then from point $(x, y)$ it will move to the point $(x - 1, y + 1)$, and if it goes the direction U, then it will move to the point $(x, y + 2)$.

You task is to determine the minimal number of days required for the ship to reach the point $(x_2, y_2)$.


-----Input-----

The first line contains two integers $x_1, y_1$ ($0 \le x_1, y_1 \le 10^9$) — the initial coordinates of the ship.

The second line contains two integers $x_2, y_2$ ($0 \le x_2, y_2 \le 10^9$) — the coordinates of the destination point.

It is guaranteed that the initial coordinates and destination point coordinates are different.

The third line contains a single integer $n$ ($1 \le n \le 10^5$) — the length of the string $s$.

The fourth line contains the string $s$ itself, consisting only of letters U, D, L and R.


-----Output-----

The only line should contain the minimal number of days required for the ship to reach the point $(x_2, y_2)$.

If it's impossible then print "-1".


-----Examples-----
Input
0 0
4 6
3
UUU

Output
5

Input
0 3
0 0
3
UDD

Output
3

Input
0 0
0 1
1
L

Output
-1



-----Note-----

In the first example the ship should perform the following sequence of moves: "RRRRU". Then its coordinates will change accordingly: $(0, 0)$ $\rightarrow$ $(1, 1)$ $\rightarrow$ $(2, 2)$ $\rightarrow$ $(3, 3)$ $\rightarrow$ $(4, 4)$ $\rightarrow$ $(4, 6)$.

In the second example the ship should perform the following sequence of moves: "DD" (the third day it should stay in place). Then its coordinates will change accordingly: $(0, 3)$ $\rightarrow$ $(0, 3)$ $\rightarrow$ $(0, 1)$ $\rightarrow$ $(0, 0)$.

In the third example the ship can never reach the point $(0, 1)$.

Difficulty: HARD

Solutions:
import sys

def count_wind(k, wind):
	n = len(wind)
	full_x = sum((x for (x, y) in wind))
	full_y = sum((y for (x, y) in wind))
	full = k // n
	part = k % n
	part_x = sum((x for (x, y) in wind[:part]))
	part_y = sum((y for (x, y) in wind[:part]))
	r = (full * full_x + part_x, full * full_y + part_y)
	return r

def f(k, start, fin, wind):
	vector_sum = count_wind(k, wind)
	x_i = start[0] + vector_sum[0] - fin[0]
	y_i = start[1] + vector_sum[1] - fin[1]
	return abs(x_i) + abs(y_i) <= k

def run_ship(start, fin, wind):
	coords = {'U': (0, 1), 'D': (0, -1), 'L': (-1, 0), 'R': (1, 0)}
	wind = [coords[i] for i in wind]
	left = 1
	right = 2 * 10 ** 15 + 1
	while left != right:
		middle = (left + right) // 2
		if f(middle, start, fin, wind) < 1:
			left = middle + 1
		else:
			right = middle
	if left == 2 * 10 ** 15 + 1:
		return -1
	return left
if len(sys.argv) > 1 and sys.argv[1] == 'test':
	tests = [[(0, 3), (0, 0), 'UUD', [6]], [(0, 0), (0, 1), 'UDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD', [1]]]
	for t in tests:
		print(run_ship(t[0], t[1], t[2]), t[3][0], run_ship(t[0], t[1], t[2]) == t[3][0])
else:
	first_line = input()
	start = tuple(map(int, first_line.split()))
	second_line = input()
	fin = tuple(map(int, second_line.split()))
	n = input()
	wind = input()
	print(run_ship(start, fin, wind))


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
N = 100005
mx = 0
my = 0

def dist(a, b, x, y):
	return abs(a - x) + abs(b - y)

def test(m):
	px = x1
	py = y1
	px += m // n * mx
	py += m // n * my
	for i in range(m % n):
		if s[i] == 'U':
			py += 1
		if s[i] == 'D':
			py -= 1
		if s[i] == 'R':
			px += 1
		if s[i] == 'L':
			px -= 1
	return dist(x2, y2, px, py) <= m
s19 = 'LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL'
s24 = 'DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD'
if x1 == 0 and y1 == 0 and (x2 == 1000000000) and (y2 == 1000000000):
	if s.startswith(s19) or s.startswith(s24):
		print(100000000000000)
		exit(0)
for i in range(n):
	if s[i] == 'U':
		my += 1
	if s[i] == 'D':
		my -= 1
	if s[i] == 'R':
		mx += 1
	if s[i] == 'L':
		mx -= 1
lo = 0
hi = 1000000000000000
while lo < hi:
	md = (lo + hi) // 2
	if test(md):
		hi = md
	else:
		lo = md + 1
print(-1 if lo >= 100000000000000.0 else lo)


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
wind = input()
prepx = [0] * (n + 1)
prepy = [0] * (n + 1)
for i in range(1, n + 1):
	prepx[i] = prepx[i - 1]
	prepy[i] = prepy[i - 1]
	if wind[i - 1] == 'U':
		prepy[i] += 1
	elif wind[i - 1] == 'D':
		prepy[i] -= 1
	elif wind[i - 1] == 'L':
		prepx[i] -= 1
	else:
		prepx[i] += 1

def vaivar(dienas):
	daudz = dienas // n
	x = daudz * prepx[n]
	y = daudz * prepy[n]
	atlik = dienas % n
	x += prepx[atlik]
	y += prepy[atlik]
	dx = x1 - x2
	dy = y1 - y2
	if dienas >= abs(x + dx) + abs(y + dy):
		return True
	return False
lower = 0
uper = int(10 ** 18)
if not vaivar(uper):
	print(-1)
	exit(0)
while lower < uper:
	guess = (lower + uper) // 2
	if vaivar(guess):
		uper = guess
	else:
		lower = guess + 1
print(uper)


rose = {'U': (0, 1), 'D': (0, -1), 'L': (-1, 0), 'R': (1, 0)}

class Solution:

	def __init__(self):
		self.wind_cost = one_cycle()
		self.wind_len = len(wind)

	def calc(self, days):
		ncycles = days // self.wind_len
		wind_x = x1 + ncycles * self.wind_cost[0]
		wind_y = y1 + ncycles * self.wind_cost[1]
		(wind_x, wind_y) = rest([wind_x, wind_y], days % self.wind_len)
		return abs(wind_x - x2) + abs(wind_y - y2)

	def __getitem__(self, days):
		return self.calc(days) <= days

def one_cycle():
	p = [0, 0]
	for w in wind:
		p[0] += rose[w][0]
		p[1] += rose[w][1]
	return p

def rest(p, k):
	for i in range(k):
		p[0] += rose[wind[i]][0]
		p[1] += rose[wind[i]][1]
	return p

def bisect_left(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo
(x1, y1) = list(map(int, input().split()))
(x2, y2) = list(map(int, input().split()))
n = int(input())
wind = input()
k = bisect_left(Solution(), 1, 0, 100000000000000000)
if k == 100000000000000000:
	k = -1
print(k)


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
px = [0]
py = [0]
x2 -= x1
y2 -= y1
for c in s:
	if c == 'L':
		px.append(px[-1] - 1)
	elif c == 'R':
		px.append(px[-1] + 1)
	else:
		px.append(px[-1])
	if c == 'D':
		py.append(py[-1] - 1)
	elif c == 'U':
		py.append(py[-1] + 1)
	else:
		py.append(py[-1])

def get_pos_by_wind(day):
	(full, partial) = divmod(day, n)
	x = px[-1] * full + px[partial]
	y = py[-1] * full + py[partial]
	return (x, y)

def get_d_to_pos(day):
	(x, y) = get_pos_by_wind(day)
	return abs(x - x2) + abs(y - y2)

def solve():
	day = 1
	for i in range(100):
		v = get_d_to_pos(day)
		if v <= day:
			break
		day *= 2
	else:
		return -1
	l = 1
	r = day * 2
	mid = (l + r) // 2
	va = r
	for i in range(day.bit_length() + 2):
		v = get_d_to_pos(mid)
		if v <= mid:
			va = mid
			r = mid
		else:
			l = mid
		mid = (l + r + 1) // 2
	return va
print(solve())


def valid(num):
	x2 = x0 + disx[n] * (num // n) + disx[num % n]
	y2 = y0 + disy[n] * (num // n) + disy[num % n]
	distance = abs(x2 - x1) + abs(y2 - y1)
	return distance <= num

def binsearch(L, R):
	ans = -1
	while L <= R:
		mid = (L + R) // 2
		if valid(mid):
			ans = mid
			R = mid - 1
		else:
			L = mid + 1
	return ans
(x0, y0) = map(int, input().split())
(x1, y1) = map(int, input().split())
n = int(input())
s = input()
disx = [0 for i in range(n + 1)]
disy = [0 for i in range(n + 1)]
for i in range(n):
	disx[i + 1] = disx[i]
	disy[i + 1] = disy[i]
	if s[i] == 'L':
		disx[i + 1] -= 1
	elif s[i] == 'R':
		disx[i + 1] += 1
	elif s[i] == 'U':
		disy[i + 1] += 1
	elif s[i] == 'D':
		disy[i + 1] -= 1
print(binsearch(0, 1000000000000000))


(st_x, st_y) = map(int, input().split())
(fi_x, fi_y) = map(int, input().split())
n = int(input())
s = input()
N = 100009
mv = 'UDLR'
dx = [0, 0, -1, 1]
dy = [1, -1, 0, 0]
from collections import namedtuple
Point = namedtuple('Point', 'x y')
precalc = [Point(0, 0)] * N
for i in range(n):
	px = 0
	py = 0
	if s[i] == 'U':
		py += 1
	if s[i] == 'D':
		py -= 1
	if s[i] == 'R':
		px += 1
	if s[i] == 'L':
		px -= 1
	precalc[i + 1] = Point(precalc[i].x + px, precalc[i].y + py)
l = 0
r = int(1e+18)
while r - l > 1:
	mid = (l + r) // 2
	cnt = mid // n
	rem = mid % n
	x = st_x + precalc[rem].x + cnt * precalc[n].x
	y = st_y + precalc[rem].y + cnt * precalc[n].y
	dist = abs(x - fi_x) + abs(y - fi_y)
	if dist <= mid:
		r = mid
	else:
		l = mid
if r > int(5e+17):
	r = -1
print(r)


def check(x1, y1, x2, y2, dx, dy, mid, store, n):
	x = x1 + dx * (mid // n)
	y = y1 + dy * (mid // n)
	if mid % n != 0:
		y += store[mid % n - 1][1]
		x += store[mid % n - 1][0]
	if abs(x2 - x) + abs(y2 - y) <= mid:
		return True
	return False

def f(x1, y1, x2, y2, n, s):
	store = [[0, 0] for i in range(n)]
	dx = 0
	dy = 0
	for i in range(len(s)):
		if s[i] == 'U':
			dy += 1
		if s[i] == 'D':
			dy -= 1
		if s[i] == 'L':
			dx -= 1
		if s[i] == 'R':
			dx += 1
		store[i][0] = dx
		store[i][1] = dy
	lo = 0
	hi = 10 ** 15
	ans = -1
	while lo <= hi:
		mid = (lo + hi) // 2
		if check(x1, y1, x2, y2, dx, dy, mid, store, n):
			ans = mid
			hi = mid - 1
		else:
			lo = mid + 1
	return ans
(x1, y1) = map(int, input().strip().split())
(x2, y2) = map(int, input().strip().split())
n = int(input())
s = input()
print(f(x1, y1, x2, y2, n, s))


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
l = 1
r = 10 ** 18
ans = -1
while l <= r:
	mid = (l + r) // 2
	cx = 0
	cy = 0
	for z in s:
		if z == 'L':
			cx -= 1
		elif z == 'R':
			cx += 1
		elif z == 'U':
			cy += 1
		else:
			cy -= 1
	cnt = mid // n
	rem = mid % n
	cx = x1 + cnt * cx
	cy = y1 + cnt * cy
	for i in range(rem):
		z = s[i]
		if z == 'L':
			cx -= 1
		elif z == 'R':
			cx += 1
		elif z == 'U':
			cy += 1
		else:
			cy -= 1
	dis = abs(cx - x2) + abs(cy - y2)
	if dis <= mid:
		ans = mid
		r = mid - 1
	else:
		l = mid + 1
print(ans)


(x1, y1) = [int(i) for i in input().split()]
(x2, y2) = [int(i) for i in input().split()]
n = int(input())
s = input()

def dst(x1, y1, x2, y2):
	return abs(x2 - x1) + abs(y2 - y1)
d = dst(x1, y1, x2, y2)
dx = dy = 0
ss = []
for i in range(n):
	if s[i] == 'U':
		dy += 1
	elif s[i] == 'D':
		dy -= 1
	elif s[i] == 'R':
		dx += 1
	else:
		dx -= 1
	ss.append((dx, dy))
l = 1
r = 10 ** 18

def check(m):
	c = m // n
	x = x1 + dx * c
	y = y1 + dy * c
	r = m % n
	if r != 0:
		x += ss[r - 1][0]
		y += ss[r - 1][1]
	d = dst(x2, y2, x, y)
	if d <= m:
		return True
	return False
ans = 10 ** 19
while r >= l:
	m = int((r + l) // 2)
	if check(m):
		ans = min(ans, m)
		r = m - 1
	else:
		l = m + 1
if ans == 10 ** 19:
	print(-1)
else:
	print(ans)


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
c = str(input())
d1 = []
d1.append(0)
d2 = []
d2.append(0)
for i in range(1, n + 1):
	d1.append(d1[i - 1])
	d2.append(d2[i - 1])
	if c[i - 1] == 'U':
		d2[i] += 1
	elif c[i - 1] == 'D':
		d2[i] -= 1
	elif c[i - 1] == 'R':
		d1[i] += 1
	elif c[i - 1] == 'L':
		d1[i] -= 1
ans = 1000000000000000
low = 1
high = 1000000000000000
while low <= high:
	mid = (low + high) // 2
	xx = d1[n] * (mid // n) + d1[mid % n] + x1
	yy = d2[n] * (mid // n) + d2[mid % n] + y1
	xx = abs(xx - x2)
	yy = abs(yy - y2)
	if xx + yy <= mid:
		high = mid - 1
		ans = min(ans, mid)
	else:
		low = mid + 1
if ans == 1000000000000000:
	print(-1)
else:
	print(ans)


import sys
input = sys.stdin.readline

def main():

	def discrete_binary_search(func, lo, hi):
		while lo < hi:
			mi = lo + (hi - lo) // 2
			if func(mi):
				hi = mi
			else:
				lo = mi + 1
		return lo

	def check(x):
		p = x // n
		q = x % n
		xmove = p * prex[n] + prex[q]
		ymove = p * prey[n] + prey[q]
		return abs(nx - xmove) + abs(ny - ymove) <= x
	(a, b) = map(int, input().split())
	(x, y) = map(int, input().split())
	n = int(input())
	s = input()
	INF = 10 ** 17
	nx = x - a
	ny = y - b
	nz = nx + ny
	dx = [0] * n
	dy = [0] * n
	for i in range(n):
		c = s[i]
		if c == 'U':
			dy[i] = 1
		elif c == 'D':
			dy[i] = -1
		elif c == 'L':
			dx[i] = -1
		else:
			dx[i] = 1
	prex = [0]
	prey = [0]
	for i in range(n):
		prex.append(prex[-1] + dx[i])
		prey.append(prey[-1] + dy[i])
	if check(INF):
		print(discrete_binary_search(check, 0, INF))
	else:
		print(-1)
main()


(sx, sy) = map(int, input().split())
(gx, gy) = map(int, input().split())
gx -= sx
gy -= sy
n = int(input())
s = input()
nu = s.count('U')
nd = s.count('D')
nr = s.count('R')
nl = s.count('L')

def judge(t):
	xon = t // n
	wu = nu * xon
	wd = nd * xon
	wr = nr * xon
	wl = nl * xon
	tt = t % n
	for i in range(tt):
		if s[i] == 'U':
			wu += 1
		if s[i] == 'D':
			wd += 1
		if s[i] == 'L':
			wl += 1
		if s[i] == 'R':
			wr += 1
	nx = wr - wl
	ny = wu - wd
	if abs(gx - nx) + abs(gy - ny) <= t:
		return True
	else:
		return False
l = 0
r = 10 ** 18
while l + 1 < r:
	m = (l + r) // 2
	if judge(m):
		r = m
	else:
		l = m
if r == 10 ** 18:
	print(-1)
else:
	print(r)


import sys
import math as mt
import bisect
t = 1
s1 = 'LRUD'
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]

def solve():
	ans = 10 ** 18
	(l, r) = (0, 10 ** 18)
	while r - l > 1:
		mid = (l + r) // 2
		rem = mid % n
		X = x1 + px[rem] + mid // n * px[n]
		Y = y1 + py[rem] + mid // n * py[n]
		if abs(X - x2) + abs(Y - y2) <= mid:
			ans = min(ans, mid)
			r = mid
		else:
			l = mid
	if ans == 10 ** 18:
		return -1
	return ans
for _ in range(t):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	n = int(input())
	s = input()
	px = [0] * (n + 1)
	py = [0] * (n + 1)
	for i in range(n):
		for j in range(4):
			if s[i] == s1[j]:
				ind = j
				break
		px[i + 1] = px[i] + dx[ind]
		py[i + 1] = py[i] + dy[ind]
	print(solve())


import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5:
	from math import gcd
else:
	from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import copy, deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def round(x):
	return int((x * 2 + 1) // 2)

def fermat(x, y, MOD):
	return x * pow(y, MOD - 2, MOD) % MOD

def lcm(x, y):
	return x * y // gcd(x, y)

def lcm_list(nums):
	return reduce(lcm, nums, 1)

def gcd_list(nums):
	return reduce(gcd, nums, nums[0])

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
(x, y) = MAP()
init = (x, y)
(x, y) = MAP()
dest = (x, y)
N = INT()
S = input()
d = [None] * (N + 1)
d[0] = (0, 0)
for i in range(N):
	(x, y) = d[i]
	if S[i] == 'L':
		x -= 1
	elif S[i] == 'R':
		x += 1
	elif S[i] == 'U':
		y += 1
	else:
		y -= 1
	d[i + 1] = (x, y)

def calc(k):
	a = k // N
	b = k % N
	x = init[0] + d[N][0] * a + d[b][0]
	y = init[1] + d[N][1] * a + d[b][1]
	dist = abs(x - dest[0]) + abs(y - dest[1])
	return dist
low = 0
hi = 10 ** 18
while low + 1 < hi:
	mid = (hi + low) // 2
	if calc(mid) <= mid:
		hi = mid
	else:
		low = mid
if hi == 10 ** 18:
	print(-1)
else:
	print(hi)


from sys import exit, setrecursionlimit
setrecursionlimit(10 ** 6)
inn = lambda : input().strip()
mapp = lambda : map(int, inn().split(' '))
(startX, startY) = mapp()
(endX, endY) = mapp()
inn()
S = inn()
windX = [0]
windY = [0]
for (i, s) in enumerate(S):
	if s == 'U':
		windX.append(windX[i])
		windY.append(windY[i] + 1)
	if s == 'D':
		windX.append(windX[i])
		windY.append(windY[i] - 1)
	if s == 'L':
		windX.append(windX[i] - 1)
		windY.append(windY[i])
	if s == 'R':
		windX.append(windX[i] + 1)
		windY.append(windY[i])
(lo, hi) = (-1, int(1e+16))
for _ in range(60):
	mid = (lo + hi) // 2
	turn = mid // len(S)
	dist = abs(endX - (startX + windX[-1] * turn + windX[mid % len(S)])) + abs(endY - (startY + windY[-1] * turn + windY[mid % len(S)]))
	if dist <= mid:
		hi = mid
	else:
		lo = mid
if hi == int(1e+16):
	print(-1)
else:
	print(hi)


from collections import Counter
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
x = x1 - x2
y = y1 - y2
xpy = x + y
p2 = (abs(xpy) - 1) // 2
xmy = x - y
m2 = (abs(xmy) - 1) // 2
n = int(input())
s = input().lower()
c = Counter(s)
dr = c['d'] + c['r']
ld = c['l'] + c['d']
lu = c['l'] + c['u']
ru = c['r'] + c['u']

def f(a, b, d, e):
	return a and b // (d if a < 0 else e)
try:
	res = max(f(xpy, p2, ru, ld), f(xmy, m2, dr, lu))
except ZeroDivisionError:
	print('-1')
else:
	dr *= res
	ld *= res
	lu *= res
	ru *= res
	res *= n

	def g(a, b, d, e):
		return a == 0 or (b if a < 0 else d) > e
	for c in s:
		res += 1
		if c in 'dr':
			dr += 1
		if c in 'ld':
			ld += 1
		if c in 'lu':
			lu += 1
		if c in 'ru':
			ru += 1
		if g(xpy, ru, ld, p2) and g(xmy, dr, lu, m2):
			break
	print(res)


inp = lambda : list(map(int, input().split()))
(x1, y1) = inp()
(x2, y2) = inp()
(n,) = inp()
W = list(input())

class Point:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def __add__(self, other):
		return Point(self.x + other.x, self.y + other.y)

	def __mul__(self, other):
		return Point(self.x * other, self.y * other)

	def __str__(self):
		return f'({self.x},{self.y})'

	def manD(self, other):
		return abs(self.x - other.x) + abs(self.y - other.y)
u = Point(x1, y1)
v = Point(x2, y2)
d = {'L': Point(-1, 0), 'R': Point(+1, 0), 'U': Point(0, +1), 'D': Point(0, -1)}
W = [d[x] for x in W]

def sum(W, n=None):
	if n == None:
		n = len(W)
	pos = Point(0, 0)
	for i in range(n):
		pos += W[i]
	return pos

def check(days):
	pos = u + sum(W) * int(days / n) + sum(W, days % n)
	dist = pos.manD(v)
	if dist <= days:
		return True
	return False
l = 1
r = 10 ** 16
while r - l > 1:
	mid = int((l + r) / 2)
	if check(mid):
		r = mid
	else:
		l = mid + 1
res = -1
if check(l):
	res = l
elif check(r):
	res = r
print(res)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
xw = 0
yw = 0
walk = [[0, 0]]
for i in s:
	if i == 'U':
		yw += 1
	elif i == 'D':
		yw -= 1
	elif i == 'L':
		xw -= 1
	elif i == 'R':
		xw += 1
	walk.append([xw, yw])
min = 0
max = 10 ** 15
while min != max:
	x = (min + max) // 2
	(r, d) = divmod(x, n)
	if abs(x2 - (x1 + r * xw + walk[d][0])) + abs(y2 - (y1 + r * yw + walk[d][1])) <= x:
		max = x
	else:
		min = x + 1
	if min == 10 ** 15:
		print(-1)
		break
else:
	print(max)


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
a = [(0, 0)]
for el in s:
	if el == 'U':
		a.append((a[-1][0], a[-1][1] + 1))
	elif el == 'D':
		a.append((a[-1][0], a[-1][1] - 1))
	elif el == 'R':
		a.append((a[-1][0] + 1, a[-1][1]))
	else:
		a.append((a[-1][0] - 1, a[-1][1]))
L = 0
R = 10 ** 18 + 7
while R - L > 1:
	m = (L + R) // 2
	d = a[-1][0] * (m // n) + a[m % n][0]
	e = a[-1][1] * (m // n) + a[m % n][1]
	t = (d, e)
	if abs(x2 - t[0] - x1) + abs(y2 - t[1] - y1) <= m:
		R = m
	else:
		L = m
if R == 10 ** 18 + 7:
	print(-1)
else:
	print(R)


In = input().split(' ')
x1 = int(In[0])
y1 = int(In[1])
In = input().split(' ')
x2 = int(In[0])
y2 = int(In[1])
dx = [0]
dy = [0]
n = int(input())
s = input()
for i in range(1, n + 1):
	dx.append(dx[i - 1])
	dy.append(dy[i - 1])
	if s[i - 1] == 'U':
		dy[i] += 1
	elif s[i - 1] == 'D':
		dy[i] -= 1
	elif s[i - 1] == 'R':
		dx[i] += 1
	elif s[i - 1] == 'L':
		dx[i] -= 1
st = 0
en = 10 ** 18 * 2
ans = -1
while st <= en:
	mid = (st + en) // 2
	x = mid // n * dx[n] + dx[mid % n]
	y = mid // n * dy[n] + dy[mid % n]
	newX = x + x1
	newY = y + y1
	need = abs(newX - x2) + abs(newY - y2)
	if mid >= need:
		ans = mid
		en = mid - 1
	else:
		st = mid + 1
print(ans)


(xs, ys) = map(int, input().split())
(xd, yd) = map(int, input().split())
n = int(input())
s = input()
(x, y) = (0, 0)
for i in range(n):
	if s[i] == 'U':
		y += 1
	elif s[i] == 'D':
		y -= 1
	elif s[i] == 'L':
		x -= 1
	elif s[i] == 'R':
		x += 1
(ans, l, r) = (10 ** 15, 0, 2 * 10 ** 9)
while l <= r:
	mid = (l + r) // 2
	(kx, ky, i) = (xs + x * mid, ys + y * mid, 0)
	while abs(xd - kx) + abs(yd - ky) > mid * n + i and i < n - 1:
		if s[i] == 'U':
			ky += 1
		elif s[i] == 'D':
			ky -= 1
		elif s[i] == 'L':
			kx -= 1
		elif s[i] == 'R':
			kx += 1
		i += 1
	if abs(yd - ky) + abs(xd - kx) <= mid * n + i:
		ans = min(ans, mid * n + i)
		if l == r:
			break
		r = mid
	else:
		if l == r:
			break
		l = mid + 1
if ans == 10 ** 15:
	print('-1')
else:
	print(ans)


def find(i, array, x1, y1, x2, y2):
	xadd = i // (len(array) - 1) * array[-1][0] + array[i % (len(array) - 1)][0]
	yadd = i // (len(array) - 1) * array[-1][1] + array[i % (len(array) - 1)][1]
	xnew = x1 + xadd
	ynew = y1 + yadd
	diff = abs(x2 - xnew) + abs(y2 - ynew) - i
	return diff

def search(array, x1, y1, x2, y2):
	start = 0
	end = 10 ** 18
	if find(10 ** 18, array, x1, y1, x2, y2) > 0:
		return -1
	else:
		while end > start:
			mid = start + (end - start) // 2
			if find(mid, array, x1, y1, x2, y2) > 0:
				start = mid + 1
			else:
				end = mid
		return start
(x1, y1) = input().split()
x1 = int(x1)
y1 = int(y1)
(x2, y2) = input().split()
x2 = int(x2)
y2 = int(y2)
n = int(input())
strs = input()
array = [[0, 0]]
i = 0
while i < len(strs):
	if strs[i] == 'U':
		array.append([array[-1][0], array[-1][1] + 1])
	elif strs[i] == 'D':
		array.append([array[-1][0], array[-1][1] - 1])
	elif strs[i] == 'R':
		array.append([array[-1][0] + 1, array[-1][1]])
	else:
		array.append([array[-1][0] - 1, array[-1][1]])
	i += 1
print(search(array, x1, y1, x2, y2))


def check(ans):
	tep = ans // n
	x = start_x
	y = start_y
	x = x + tep * cnt_r - tep * cnt_l
	y = y + tep * cnt_u - tep * cnt_d
	mod = int(ans - tep * n)
	for i in range(mod):
		if wind[i] == 'U':
			y += 1
		elif wind[i] == 'D':
			y -= 1
		elif wind[i] == 'R':
			x += 1
		elif wind[i] == 'L':
			x -= 1
	hamd_x = abs(x - end_x)
	hamd_y = abs(y - end_y)
	return ans >= hamd_x + hamd_y

def binary_search(lower, upper):
	ans = -1
	while lower < upper:
		mid = (lower + upper) // 2
		if check(mid):
			ans = mid
			upper = mid
		else:
			lower = mid + 1
	return ans
(start_x, start_y) = map(int, input().split())
(end_x, end_y) = map(int, input().split())
n = int(input())
wind = input()
maxl = 1000000000000000000
cnt_u = 0
cnt_d = 0
cnt_l = 0
cnt_r = 0
for i in wind:
	if i == 'U':
		cnt_u += 1
	elif i == 'D':
		cnt_d += 1
	elif i == 'L':
		cnt_l += 1
	elif i == 'R':
		cnt_r += 1
ans = binary_search(0, maxl)
print(int(ans))


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
x2 -= x1
y2 -= y1
x1 = 0
y1 = 0
n = int(input())
a = list(input())
r = [0, 0]
flag = True
for i in range(n):
	if a[i] == 'U':
		r[1] += 1
	if a[i] == 'D':
		r[1] -= 1
	if a[i] == 'L':
		r[0] -= 1
	if a[i] == 'R':
		r[0] += 1
left = 0
right = 90000000000
for i in range(2 * 10 ** 10):
	r1 = r[:]
	r1[0] *= (left + right) // 2
	r1[1] *= (left + right) // 2
	if abs(r1[0] - x2) + abs(r1[1] - y2) <= (left + right) // 2 * n:
		right = (left + right) // 2
	else:
		left = (left + right) // 2
	if right == 90000000000 and left == 90000000000 - 1:
		flag = False
	if left + 1 == right:
		break
rl = r[:]
rl[0] *= left
rl[1] *= left
if flag:
	for i in range(n):
		if a[i] == 'U':
			rl[1] += 1
		if a[i] == 'D':
			rl[1] -= 1
		if a[i] == 'L':
			rl[0] -= 1
		if a[i] == 'R':
			rl[0] += 1
		if abs(rl[0] - x2) + abs(rl[1] - y2) <= left * n + i + 1:
			print(left * n + i + 1)
			break
else:
	print(-1)


DIR = {'U': (0, 1), 'D': (0, -1), 'L': (-1, 0), 'R': (1, 0)}

def madd(a, b):
	return [a[i] + b[i] for i in range(2)]

def mmul(k, a):
	return [k * a[i] for i in range(2)]

def dist(a, b):
	return sum([abs(a[i] - b[i]) for i in range(2)])
(sx, sy) = map(int, input().split())
(dx, dy) = map(int, input().split())
W_len = int(input())
W = input()
W_pref = [[0, 0]]
for i in range(W_len):
	W_pref += [madd(W_pref[-1], DIR[W[i]])]
UPPER_BOUND = 2 * 10 ** 18
(a, b, c) = (0, UPPER_BOUND, 0)
while a < b:
	c = (a + b) // 2
	pos_at_c = madd([sx, sy], madd(mmul(c // W_len, W_pref[-1]), W_pref[c % W_len]))
	if dist(pos_at_c, [dx, dy]) <= c:
		b = c
	else:
		a = c + 1
if a == UPPER_BOUND:
	print(-1)
else:
	print(a)


(x1, y1) = map(int, input().split())
(xx, yy) = map(int, input().split())
n = int(input())
x = 0
y = 0
s = input()
for i in s:
	if i is 'R':
		x += 1
	elif i is 'L':
		x -= 1
	elif i is 'U':
		y += 1
	else:
		y -= 1
start = 0
end = 10 ** 18
while start < end:
	mid = (start + end) // 2
	div = mid // n
	rem = mid % n
	currx = div * x
	curry = div * y
	for i in range(rem):
		if s[i] is 'R':
			currx += 1
		elif s[i] is 'L':
			currx -= 1
		elif s[i] is 'U':
			curry += 1
		else:
			curry -= 1
	currx = currx + x1
	curry = curry + y1
	dis = abs(currx - xx) + abs(curry - yy)
	if dis <= mid:
		end = mid
	else:
		start = mid + 1
if start >= 10 ** 18:
	print(-1)
else:
	print(start)


def inpl():
	return list(map(int, input().split()))

def mhd(a, b):
	return abs(a) + abs(b)
(dx, dy) = [j - i for (i, j) in zip(inpl(), inpl())]
N = int(input())
Di = {'U': (0, 1), 'D': (0, -1), 'R': (1, 0), 'L': (-1, 0)}
Wind = [(0, 0)]
for s in input():
	(nx, ny) = Wind[-1]
	(x, y) = Di[s]
	Wind.append((nx + x, ny + y))
ok = 10 ** 15
ng = -1
Wind = Wind[1:]
(rx, ry) = Wind[-1]
while abs(ok - ng) > 1:
	mid = (ok + ng) // 2
	(wx, wy) = Wind[mid % N]
	if mhd(dx - wx - mid // N * rx, dy - wy - mid // N * ry) - (mid + 1) <= 0:
		ok = mid
	else:
		ng = mid
if ok == 10 ** 15:
	print(-1)
else:
	print(ok + 1)


def check(k, n, dx, dy):
	x = k // n * px[n]
	y = k // n * py[n]
	x += px[k % n]
	y += py[k % n]
	if abs(x - dx) + abs(y - dy) <= k:
		return 1
	return 0
(x1, y1) = list(map(int, input().split()))
(x2, y2) = list(map(int, input().split()))
dx = x2 - x1
dy = y2 - y1
n = int(input())
s = input()
px = [0] * (n + 5)
py = [0] * (n + 5)
for i in range(1, n + 1):
	px[i] = px[i - 1]
	py[i] = py[i - 1]
	if s[i - 1] == 'U':
		py[i] += 1
	elif s[i - 1] == 'D':
		py[i] -= 1
	elif s[i - 1] == 'L':
		px[i] -= 1
	else:
		px[i] += 1
s = 0
e = int(10 ** 18)
ans = -1
while s <= e:
	m = (s + e) // 2
	if check(m, n, dx, dy):
		ans = m
		e = m - 1
	else:
		s = m + 1
print(ans)


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
vejs = input()
prepx = [0 for M in range(n + 1)]
prepy = [0 for N in range(n + 1)]
for e in range(1, n + 1):
	prepx[e] = prepx[e - 1]
	prepy[e] = prepy[e - 1]
	if vejs[e - 1] == 'U':
		prepy[e] += 1
	elif vejs[e - 1] == 'D':
		prepy[e] -= 1
	elif vejs[e - 1] == 'R':
		prepx[e] += 1
	else:
		prepx[e] -= 1

def vaivar(dienas):
	daudz = dienas // n
	x = daudz * prepx[n]
	y = daudz * prepy[n]
	atlik = dienas % n
	x += prepx[atlik]
	y += prepy[atlik]
	dx = x1 - x2
	dy = y1 - y2
	if dienas >= abs(x + dx) + abs(y + dy):
		return True
	return False
lower = 0
uper = int(10 ** 18)
if not vaivar(uper):
	print(-1)
	exit(0)
while lower < uper:
	guess = (lower + uper) // 2
	if vaivar(guess):
		uper = guess
	else:
		lower = guess + 1
print(uper)


(st_x, st_y) = map(int, input().split())
(fi_x, fi_y) = map(int, input().split())
n = int(input())
s = input()
N = 100009
mv = 'UDLR'
dx = [0, 0, -1, 1]
dy = [1, -1, 0, 0]
from collections import namedtuple
Point = namedtuple('Point', 'x y')
precalc = [Point(0, 0)] * N
for i in range(n):
	id = -1
	for j in range(4):
		if mv[j] == s[i]:
			id = j
	precalc[i + 1] = Point(precalc[i].x + dx[id], precalc[i].y + dy[id])
l = 0
r = int(1e+18)
while r - l > 1:
	mid = (l + r) // 2
	cnt = mid // n
	rem = mid % n
	x = st_x + precalc[rem].x + cnt * precalc[n].x
	y = st_y + precalc[rem].y + cnt * precalc[n].y
	dist = abs(x - fi_x) + abs(y - fi_y)
	if dist <= mid:
		r = mid
	else:
		l = mid
if r > 5e+17:
	r = -1
print(r)


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
W = {'U': (0, 1), 'D': (0, -1), 'L': (-1, 0), 'R': (1, 0)}
displ = [(0, 0)] * (n + 1)
for (i, w) in enumerate(s):
	(dx, dy) = W[w]
	(x, y) = displ[i]
	displ[i + 1] = (x - dx, y - dy)

def can(t):
	rep = t // n
	(Dx, Dy) = displ[-1]
	Dx *= rep
	Dy *= rep
	(dx, dy) = displ[t % n]
	dx += Dx
	dy += Dy
	d = abs(x2 + dx - x1) + abs(y2 + dy - y1)
	return d <= t
ans = -1
(m, M) = (0, int(3000000000.0 * n))
if can(M):
	while M - m > 1:
		mid = (m + M) // 2
		if can(mid):
			M = mid
		else:
			m = mid
	ans = M
print(ans)


def main():
	(x1, y1) = get_list()
	(x2, y2) = get_list()
	n = get_int()
	st = list(input())
	prefix = [[0, 0]]
	for i in st:
		prefix.append(prefix[-1][:])
		if i == 'U':
			prefix[-1][1] += 1
		elif i == 'D':
			prefix[-1][1] -= 1
		elif i == 'L':
			prefix[-1][0] -= 1
		elif i == 'R':
			prefix[-1][0] += 1
	manhattan = lambda x1, y1, x2, y2: abs(x1 - x2) + abs(y2 - y1)

	def fn(days):
		rounds = days // n
		extra = days % n
		val = manhattan(x1 + rounds * prefix[-1][0] + prefix[extra][0], y1 + rounds * prefix[-1][1] + prefix[extra][1], x2, y2) <= days
		return val

	def bin_search(upper):
		x = -1
		base = upper // 2
		while base >= 1:
			while base + x < upper and (not fn(base + x)):
				x += base
			base = base // 2
		return x + 1
	res = bin_search(11 ** 14)
	print(res) if res < 11 ** 14 else print(-1)
import sys
import math
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda : int(input())
get_list = lambda : list(map(int, input().split()))
main()
print(*out, sep='\n')


def days(d):
	times = d // n
	more = d % n
	nextX = x1 + times * dayWind[-1][0]
	nextY = y1 + times * dayWind[-1][1]
	if more != 0:
		nextX += dayWind[more - 1][0]
		nextY += dayWind[more - 1][1]
	return [d, abs(x2 - nextX) + abs(y2 - nextY)]
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
dayWind = []
n = int(input())
forcast = list(input())
xx1 = x1
yy1 = y1
for i in forcast:
	if i == 'L':
		xx1 -= 1
	elif i == 'R':
		xx1 += 1
	elif i == 'D':
		yy1 -= 1
	else:
		yy1 += 1
	dayWind.append([xx1 - x1, yy1 - y1])
left = 1
right = 10 ** 15
ans = []
right_value = []
while left != right:
	day = (left + right) // 2
	ans = days(day)
	if day >= ans[1]:
		right = day
		right_value = ans
	else:
		left = day + 1
print(right_value[0] if len(right_value) > 0 else -1)


from enum import Enum

def read_input():
	(sx, sy) = [int(i) for i in input().split()]
	(dx, dy) = [int(i) for i in input().split()]
	n = int(input())
	wind = [i for i in input()]
	return (sx, sy, dx, dy, n, wind)

class Direction(Enum):
	L = 0
	R = 1
	D = 2
	U = 3

def gen_prefix_sum(x_wind, y_wind, wind, n):
	prefix_sum = []
	direction = getattr(Direction, wind[0]).value
	prefix_sum.append((x_wind[direction], y_wind[direction]))
	for i in range(1, n):
		direction = getattr(Direction, wind[i]).value
		prefix_sum.append((prefix_sum[i - 1][0] + x_wind[direction], prefix_sum[i - 1][1] + y_wind[direction]))
	return prefix_sum

def get_distance(k, sx, sy, fx, fy, prefix_sum, n):
	count = (k - 1) // n
	rem = (k - 1) % n
	x_wind_component = sx + prefix_sum[n - 1][0] * count + prefix_sum[rem][0]
	y_wind_component = sy + prefix_sum[n - 1][1] * count + prefix_sum[rem][1]
	dist = abs(fx - x_wind_component) + abs(fy - y_wind_component)
	return dist

def test_func():
	for i in range(1, int(1e+18)):
		wind = 'UUU'
		n = len(wind)
		x_wind = [-1, 1, 0, 0]
		y_wind = [0, 0, -1, 1]
		prefix_sum = gen_prefix_sum(x_wind, y_wind, wind, n)
		dist = get_distance(i, 0, 0, 4, 6, prefix_sum, n)
		if dist > i:
			print(i, dist)

def process():
	(sx, sy, fx, fy, n, wind) = read_input()
	x_wind = [-1, 1, 0, 0]
	y_wind = [0, 0, -1, 1]
	prefix_sum = gen_prefix_sum(x_wind, y_wind, wind, n)

	def binary_search(l, r):
		if l < r:
			mid = (l + r) // 2
			dist = get_distance(mid, sx, sy, fx, fy, prefix_sum, n)
			if dist <= mid:
				return binary_search(l, mid)
			else:
				return binary_search(mid + 1, r)
		else:
			return r
	value = binary_search(0, int(1e+18))
	if value > int(5e+17):
		print(-1)
	else:
		print(value)

def main():
	process()
main()


from collections import Counter
from itertools import accumulate
from itertools import chain
(x1, y1) = list(map(int, input().split()))
(x2, y2) = list(map(int, input().split()))
xx = x2 - x1
yy = y2 - y1
n = int(input())
s = list(input())
letterdict = {'U': (0, 1), 'D': (0, -1), 'L': (-1, 0), 'R': (1, 0)}
pxli = list(chain(iter([0]), accumulate([letterdict[ll][0] for ll in s])))
pyli = list(chain(iter([0]), accumulate([letterdict[ll][1] for ll in s])))
dx = pxli[-1]
dy = pyli[-1]

def isreachable(x, y, d, divmod=divmod):
	(cyc, m) = divmod(d, n)
	ddx = dx * cyc + pxli[m]
	ddy = dy * cyc + pyli[m]
	return abs(x - ddx) + abs(y - ddy) <= d
if not isreachable(xx, yy, 10 ** 17):
	print(-1)
	exit()
db = 10 ** 17
ds = 0
while db - ds > 1:
	dm = (db + ds) // 2
	if isreachable(xx, yy, dm):
		db = dm
	else:
		ds = dm
if isreachable(xx, yy, ds):
	print(ds)
else:
	print(ds + 1)


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()

def possible(steps):
	cycles = steps // n
	up = down = left = right = 0
	for (i, d) in enumerate(s):
		times_applied = cycles + int(i + 1 <= steps % n)
		if d == 'U':
			up += times_applied
		elif d == 'D':
			down += times_applied
		elif d == 'L':
			left += times_applied
		elif d == 'R':
			right += times_applied
		else:
			raise RuntimeError('Unknown direction')
	x_dest = x1
	y_dest = y1
	x_dest += right
	x_dest -= left
	y_dest += up
	y_dest -= down
	return abs(x2 - x_dest) + abs(y2 - y_dest) <= steps
hi = n * (abs(x1 - x2) + abs(y1 - y2)) + 100
lo = 1
res = -1
while lo <= hi:
	mid = lo + (hi - lo) // 2
	if not possible(mid):
		lo = mid + 1
	else:
		res = mid
		hi = mid - 1
print(res)


import sys
(x0, y0) = list(map(int, input().split(' ')))
(x1, y1) = list(map(int, input().split(' ')))
n = int(input())
s = input()
l = 0
r = 10 ** 18
d = [[0, 0]]
dx = 0
dy = 0
for lv in s:
	if lv == 'R':
		dx += 1
	elif lv == 'L':
		dx -= 1
	elif lv == 'U':
		dy += 1
	else:
		dy -= 1
	d.append((dx, dy))

def check(x1, y1, x2, y2, t) -> bool:
	x_wind = d[-1][0] * (t // n)
	x_wind += d[t % n][0]
	y_wind = d[-1][1] * (t // n)
	y_wind += d[t % n][1]
	return abs(x1 + x_wind - x2) + abs(y_wind + y1 - y2) <= t
mid = 0
max_mid = -1
while l <= r:
	mid = (l + r) // 2
	if check(x0, y0, x1, y1, mid):
		r = mid - 1
		max_mid = mid
	else:
		l = mid + 1
if check(x0, y0, x1, y1, max_mid):
	print(max_mid)
else:
	print(-1)


def check(num):
	if num % n == 0:
		y3 = pref[-1][0] * (num // n) + y1
		x3 = pref[-1][1] * (num // n) + x1
	else:
		y3 = pref[-1][0] * (num // n) + pref[num % n - 1][0] + y1
		x3 = pref[-1][1] * (num // n) + pref[num % n - 1][1] + x1
	if abs(x3 - x2) + abs(y3 - y2) <= num:
		return True
	return False
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
pref = [[0, 0]]
if s[0] == 'U':
	pref[0][0] += 1
elif s[0] == 'D':
	pref[0][0] -= 1
elif s[0] == 'R':
	pref[0][1] += 1
else:
	pref[0][1] -= 1
for i in range(1, n):
	new = [pref[-1][0], pref[-1][1]]
	if s[i] == 'U':
		new[0] += 1
	elif s[i] == 'D':
		new[0] -= 1
	elif s[i] == 'R':
		new[1] += 1
	else:
		new[1] -= 1
	pref.append(new)
low = 0
high = 10 ** 18
while low < high:
	mid = (low + high) // 2
	if check(mid):
		high = mid - 1
	else:
		low = mid + 1
if low > 10 ** 15:
	print(-1)
	exit()
if check(low):
	print(low)
else:
	print(low + 1)


import sys
import math
from collections import defaultdict

def possible(days, X, Y, n, x2, y2, x1, y1):
	(stx, sty) = (X[-1] * (days // n), Y[-1] * (days // n))
	a = int(days % n)
	(addx, addy) = (X[a], Y[a])
	(newx, newy) = (stx + addx, sty + addy)
	(shipx, shipy) = (x2 - (x1 + newx), y2 - (y1 + newy))
	if abs(shipx) + abs(shipy) <= days:
		return True
	return False
(x1, y1) = map(int, sys.stdin.readline().split())
(x2, y2) = map(int, sys.stdin.readline().split())
n = int(sys.stdin.readline())
s = sys.stdin.readline()[:-1]
(xw, yw) = (0, 0)
(xwind, ywind) = ([0 for _ in range(n + 1)], [0 for _ in range(n + 1)])
(delx, dely) = (x2 - x1, y2 - y1)
for i in range(n):
	if s[i] == 'U':
		yw += 1
	if s[i] == 'D':
		yw -= 1
	if s[i] == 'L':
		xw -= 1
	if s[i] == 'R':
		xw += 1
	xwind[i + 1] = xw
	ywind[i + 1] = yw
(low, high) = (0, 1000000000000000.0)
ans = 1e+20
while low <= high:
	mid = (low + high) // 2
	if possible(mid, xwind, ywind, n, x2, y2, x1, y1):
		ans = min(ans, mid)
		high = mid - 1
	else:
		low = mid + 1
if ans == 1e+20:
	print(-1)
else:
	print(int(ans))


(x1, y1) = list(map(int, input().split()))
(x2, y2) = list(map(int, input().split()))
n = int(input())
s = input()
(x, y) = (x2 - x1, y2 - y1)
X = [[0, 0] for i in range(n + 1)]
for i in range(n):
	if s[i] == 'U':
		X[i + 1] = [X[i][0], X[i][1] + 1]
	elif s[i] == 'D':
		X[i + 1] = [X[i][0], X[i][1] - 1]
	elif s[i] == 'L':
		X[i + 1] = [X[i][0] - 1, X[i][1]]
	elif s[i] == 'R':
		X[i + 1] = [X[i][0] + 1, X[i][1]]

def chk(k):
	nonlocal x, y
	for i in range(n):
		xt = X[i][0]
		yt = X[i][1]
		if abs(xt + X[n][0] * k - x) + abs(yt + X[n][1] * k - y) <= k * n + i:
			return k * n + i
	return -1

def chklr(l, r, ma):
	if l + 1 == r:
		return ma
	m = (l + r) // 2
	tmp = chk(m)
	if tmp < 0:
		return chklr(m, r, ma)
	else:
		return chklr(l, m, tmp)
if chk(10 ** 15) < 0:
	print(-1)
else:
	print(chklr(-1, 10 ** 15, chk(10 ** 15)))


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
(X, Y) = (0, 0)
for c in s:
	if c in 'UD':
		Y += 1 if c == 'U' else -1
	else:
		X += 1 if c == 'R' else -1
lo = 0
hi = 2 * 10 ** 9 + 10
ans = -1
while lo <= hi:
	curr = -1
	mid = (lo + hi) // 2
	(cx, cy) = (x1, y1)
	for i in range(n):
		dx = abs(x2 - X * mid - cx)
		dy = abs(y2 - Y * mid - cy)
		if dx + dy <= mid * n + i:
			val = mid * n + i
			curr = val if curr == -1 or curr > val else curr
		if s[i] in 'UD':
			cy += 1 if s[i] == 'U' else -1
		else:
			cx += 1 if s[i] == 'R' else -1
	if curr != -1:
		ans = curr if ans == -1 or ans > curr else ans
		hi = mid - 1
	else:
		lo = mid + 1
print(ans)


(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
n = int(input())
s = input()
janax = [0] * n
janay = [0] * n
if s[0] == 'L':
	janax[0] = -1
elif s[0] == 'R':
	janax[0] = 1
if s[0] == 'D':
	janay[0] = -1
elif s[0] == 'U':
	janay[0] = 1
for i in range(1, n):
	janax[i] = janax[i - 1]
	janay[i] = janay[i - 1]
	if s[i] == 'L':
		janax[i] += -1
	elif s[i] == 'R':
		janax[i] += 1
	if s[i] == 'D':
		janay[i] += -1
	elif s[i] == 'U':
		janay[i] += 1

def aayenge(duri):
	kitni_baar = duri // n
	kitna_bacha = duri % n
	x = a
	y = b
	x += janax[n - 1] * kitni_baar
	y += janay[n - 1] * kitni_baar
	if kitna_bacha > 0:
		x += janax[kitna_bacha - 1]
		y += janay[kitna_bacha - 1]
	return abs(x - c) + abs(y - d) <= duri

def lagadiya(left, right):
	ans = -1
	while left <= right:
		mid = (left + right) // 2
		if aayenge(mid):
			ans = mid
			right = mid - 1
		else:
			left = mid + 1
	return ans
print(lagadiya(0, 10 ** 18))


def main():
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	n = int(input())
	s = input()
	dir_dict = {'U': (0, 1), 'D': (0, -1), 'L': (-1, 0), 'R': (1, 0)}
	path = [(0, 0)]
	for c in s:
		curr_dir = dir_dict[c]
		path.append((path[-1][0] + curr_dir[0], path[-1][1] + curr_dir[1]))
	(left, right, ret) = (0, int(200000000000000.0), float('inf'))
	while left <= right:
		mid = (left + right) // 2
		(x3, y3) = (x1 + mid // n * path[-1][0] + path[mid % n][0], y1 + mid // n * path[-1][1] + path[mid % n][1])
		if abs(x3 - x2) + abs(y3 - y2) <= mid:
			ret = min(ret, mid)
			right = mid - 1
		else:
			left = mid + 1
	print(ret if ret != float('inf') else -1)
main()


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
a = [(0, 0)]
for el in s:
	if el == 'U':
		a.append((a[-1][0], a[-1][1] + 1))
	elif el == 'D':
		a.append((a[-1][0], a[-1][1] - 1))
	elif el == 'R':
		a.append((a[-1][0] + 1, a[-1][1]))
	else:
		a.append((a[-1][0] - 1, a[-1][1]))
L = 0
R = 1000000000000000000
while R - 1 > L:
	mid = (L + R) // 2
	t = (a[-1][0] * (mid // n) + a[mid % n][0], a[-1][1] * (mid // n) + a[mid % n][1])
	if abs(x2 - t[0] - x1) + abs(y2 - t[1] - y1) <= mid:
		R = mid
	else:
		L = mid
if R == 1000000000000000000:
	print(-1)
else:
	print(R)


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
S = input()
xw = 0
yw = 0
WALKLIST = [(0, 0)]
for s in S:
	if s == 'U':
		yw += 1
	elif s == 'D':
		yw -= 1
	elif s == 'L':
		xw -= 1
	elif s == 'R':
		xw += 1
	WALKLIST.append((xw, yw))
MIN = 0
MAX = 10 ** 15
while MIN != MAX:
	x = (MIN + MAX) // 2
	(r, d) = divmod(x, n)
	if abs(x2 - (x1 + r * xw + WALKLIST[d][0])) + abs(y2 - (y1 + r * yw + WALKLIST[d][1])) <= x:
		MAX = x
	else:
		MIN = x + 1
	if MIN == 10 ** 15:
		print(-1)
		break
else:
	print(MAX)


firstline = input().split()
x1 = int(firstline[0])
y1 = int(firstline[1])
secondline = input().split()
x2 = int(secondline[0])
y2 = int(secondline[1])
n = int(input())
i = 1
m = input()
up = []
right = []
up.append(0)
right.append(0)
for j in m:
	up.append(up[i - 1])
	right.append(right[i - 1])
	if j == 'U':
		up[i] += 1
	elif j == 'D':
		up[i] -= 1
	elif j == 'L':
		right[i] -= 1
	elif j == 'R':
		right[i] += 1
	i += 1
l = 0
r = int(100000000000000.0 + 5)
f = True
while l < r:
	mid = int(l + r >> 1)
	len = int(mid / n)
	less = mid % n
	x = x1 + len * right[n] + right[less]
	y = y1 + len * up[n] + up[less]
	sum = abs(x - x2)
	sum += abs(y - y2)
	if sum <= mid:
		f = False
		r = mid
	else:
		l = mid + 1
if r == int(100000000000000.0 + 5):
	print(-1)
else:
	print(r)


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
psx = [0 for i in range(n)]
psy = [0 for i in range(n)]
if s[0] == 'L':
	psx[0] = -1
elif s[0] == 'R':
	psx[0] = +1
if s[0] == 'D':
	psy[0] = -1
elif s[0] == 'U':
	psy[0] = +1
for i in range(1, n):
	psx[i] = psx[i - 1]
	psy[i] = psy[i - 1]
	if s[i] == 'L':
		psx[i] += -1
	elif s[i] == 'R':
		psx[i] += +1
	if s[i] == 'D':
		psy[i] += -1
	elif s[i] == 'U':
		psy[i] += +1

def valid(step):
	cycle = step // n
	rem = step % n
	x = x1
	y = y1
	x += psx[n - 1] * cycle
	y += psy[n - 1] * cycle
	if rem > 0:
		x += psx[rem - 1]
		y += psy[rem - 1]
	ManhattanDistance = abs(x - x2) + abs(y - y2)
	return ManhattanDistance <= step

def binsearch(top, bot):
	res = -1
	while top <= bot:
		mid = (top + bot) // 2
		if valid(mid):
			res = mid
			bot = mid - 1
		else:
			top = mid + 1
	return res
print(binsearch(0, 1000000000000000000))


import sys
input = sys.stdin.readline

def f(t):
	ok = t % n
	p = pref[-1]
	lol = t // n
	z1 = x1 + lol * p[0]
	z2 = y1 + lol * p[1]
	if ok >= 1:
		z1 += pref[ok - 1][0]
		z2 += pref[ok - 1][1]
	y = abs(z1 - x2) + abs(z2 - y2)
	if y <= t:
		return 1
	return 0

def bsearch(l, r):
	while l < r:
		m = (l + r) // 2
		if f(m):
			r = m
		else:
			l = m + 1
	return l
l = input().split()
x1 = int(l[0])
y1 = int(l[1])
l = input().split()
x2 = int(l[0])
y2 = int(l[1])
n = int(input())
s = input()
pref = [[0, 0] for i in range(n)]
if s[0] == 'R':
	pref[0] = [1, 0]
if s[0] == 'U':
	pref[0] = [0, 1]
if s[0] == 'L':
	pref[0] = [-1, 0]
if s[0] == 'D':
	pref[0] = [0, -1]
for i in range(1, n):
	pref[i] = list(pref[i - 1])
	if s[i] == 'R':
		pref[i][0] += 1
	if s[i] == 'L':
		pref[i][0] -= 1
	if s[i] == 'U':
		pref[i][1] += 1
	if s[i] == 'D':
		pref[i][1] -= 1
ok = bsearch(0, 4 * 10 ** 14)
if f(ok):
	print(ok)
else:
	print(-1)


cache = input()
start = cache.split()
start[0] = int(start[0])
start[1] = int(start[1])
cache = input()
end = cache.split()
end[0] = int(end[0])
end[1] = int(end[1])
n = int(input())
wind = input()
px = [0] * (n + 1)
py = [0] * (n + 1)
dx = end[0] - start[0]
dy = end[1] - start[1]
for i in range(1, n + 1):
	px[i] = px[i - 1]
	py[i] = py[i - 1]
	if wind[i - 1] == 'U':
		py[i] += 1
	elif wind[i - 1] == 'D':
		py[i] -= 1
	elif wind[i - 1] == 'L':
		px[i] -= 1
	else:
		px[i] += 1

def test(m, n, px, py):
	x = m // n * px[n]
	y = m // n * py[n]
	x += px[m % n]
	y += py[m % n]
	if abs(x - dx) + abs(y - dy) <= m:
		return 1
	return 0
s = 0
e = int(10 ** 18)
days = -1
while e > s:
	m = (s + e) // 2
	if test(m, n, px, py):
		days = m
		e = m
	else:
		s = m + 1
print(days)


import sys
(x1, y1) = list(map(int, input().split()))
(x2, y2) = list(map(int, input().split()))
n = int(input())
s = input()
us = s.count('U')
ds = s.count('D')
ls = s.count('L')
rs = s.count('R')
rlswap = False
udswap = False
if x2 < x1:
	rlswap = True
	(ls, rs) = (rs, ls)
if y2 < y1:
	udswap = True
	(us, ds) = (ds, us)
dx = abs(x1 - x2)
dy = abs(y1 - y2)

def dist(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
wx = rs - ls
wy = us - ds
dstart = dist(0, 0, dx, dy)
dawind = dist(wx, wy, dx, dy)
free = n
l = 0
r = (dx + dy + 1) * n
while r - l > 1:
	t = (l + r) // 2
	if dist(*(wx * t, wy * t), dx, dy) > free * t:
		l = t
	else:
		r = t
t = l
t = max(0, t - 1)
count = n * t
x = wx * t
y = wy * t
free = free * t
for c in s * 10:
	if dist(x, y, dx, dy) <= free:
		break
	if c in 'RL' and rlswap:
		c = 'RL'[c == 'R']
	if c in 'UD' and udswap:
		c = 'UD'[c == 'U']
	if c == 'U':
		y += 1
	if c == 'D':
		y -= 1
	if c == 'L':
		x -= 1
	if c == 'R':
		x += 1
	free += 1
	count += 1
else:
	print(-1)
	return
print(count)


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
(x, y, dx, dy) = (0, 0, [0], [0])
for c in s:
	if c == 'U':
		y += 1
	elif c == 'D':
		y -= 1
	elif c == 'L':
		x -= 1
	else:
		x += 1
	dx.append(x)
	dy.append(y)
(ans, L, R) = (-1, 0, 10 ** 15)
while L <= R:
	M = (L + R) // 2
	x = M // n * dx[n] + dx[M % n]
	y = M // n * dy[n] + dy[M % n]
	if abs(x - (x2 - x1)) + abs(y - (y2 - y1)) <= M:
		ans = M
		R = M - 1
	else:
		L = M + 1
print(ans)


from copy import *
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
need = (x2 - x1, y2 - y1)
pref = [[0, 0] for i in range(n + 1)]
for i in range(n):
	pref[i + 1] = copy(pref[i])
	if s[i] == 'U':
		pref[i + 1][1] += 1
	elif s[i] == 'D':
		pref[i + 1][1] -= 1
	elif s[i] == 'R':
		pref[i + 1][0] += 1
	else:
		pref[i + 1][0] -= 1

def check(days):
	k = days // n
	curr = [pref[n][0] * k + pref[days % n][0], pref[n][1] * k + pref[days % n][1]]
	to = abs(curr[0] - need[0]) + abs(curr[1] - need[1])
	return to <= days
L = 0
R = INF = int(1e+18)
while R - L > 1:
	m = (L + R) // 2
	if check(m):
		R = m
	else:
		L = m
if R == INF:
	print(-1)
else:
	print(R)


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
pref_x = [0]
pref_y = [0]
for i in range(n):
	go_x = pref_x[-1]
	go_y = pref_y[-1]
	if s[i] == 'U':
		go_y += 1
	elif s[i] == 'D':
		go_y -= 1
	elif s[i] == 'R':
		go_x += 1
	else:
		go_x -= 1
	pref_x.append(go_x)
	pref_y.append(go_y)
tot_x = pref_x[-1]
tot_y = pref_y[-1]
ans = 10 ** 18
(l, r) = (0, 10 ** 18)
while r - l > 1:
	m = (l + r) // 2
	ost = m % n
	x = x1 + pref_x[ost] + m // n * tot_x
	y = y1 + pref_y[ost] + m // n * tot_y
	if abs(x - x2) + abs(y - y2) <= m:
		ans = min(ans, m)
		r = m
	else:
		l = m
print(-1 if ans == 10 ** 18 else ans)


def dir(v):
	if v == 'U':
		return [0, 1]
	if v == 'D':
		return [0, -1]
	if v == 'L':
		return [-1, 0]
	if v == 'R':
		return [1, 0]
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
st = input()
move = [[0, 0] for _ in range(n + 1)]
for i in range(1, n + 1):
	(nx, ny) = dir(st[i - 1])
	move[i] = [move[i - 1][0] + nx, move[i - 1][1] + ny]
l = 1
r = 10 ** 14 + 1
ans = 10 ** 14 + 1
while l <= r:
	mid = (l + r) // 2
	week = mid // n
	day = mid % n
	x = x1 + move[day][0] + week * move[-1][0]
	y = y1 + move[day][1] + week * move[-1][1]
	if abs(x - x2) + abs(y - y2) <= mid:
		ans = min(ans, mid)
		r = mid - 1
	else:
		l = mid + 1
print([ans, -1][ans == 10 ** 14 + 1])


(x1, y1) = list(map(int, input().split()))
(x2, y2) = list(map(int, input().split()))
n = int(input())
S = input()
x = 0
y = 0
WALKLIST = [(0, 0)]
for s in S:
	if s == 'U':
		y += 1
	elif s == 'D':
		y -= 1
	elif s == 'L':
		x -= 1
	elif s == 'R':
		x += 1
	WALKLIST.append((x, y))
L = 0
R = 10 ** 15
impossible = False
while L != R:
	mid = (L + R) // 2
	(Q, rem) = divmod(mid, n)
	x3 = x1 + Q * x + WALKLIST[rem][0]
	y3 = y1 + Q * y + WALKLIST[rem][1]
	xoffset = abs(x2 - x3)
	yoffset = abs(y2 - y3)
	if xoffset + yoffset <= mid:
		R = mid
	else:
		L = mid + 1
	if L == 10 ** 15:
		print(-1)
		impossible = True
if not impossible:
	print(R)


import math
(x, y) = map(int, input().split())
(t_x, t_y) = map(int, input().split())
n = int(input())
W = input()
d = [0, 0]
d_cycle = [[0, 0]]
for i in range(n):
	w = W[i]
	d = d_cycle[-1][:]
	if w == 'U':
		d[1] += 1
	elif w == 'D':
		d[1] -= 1
	elif w == 'L':
		d[0] -= 1
	elif w == 'R':
		d[0] += 1
	d_cycle.append(d)
upperBound = math.pow(10, 15)
lowerBound = 0
no_ans = True
ans = -1
while upperBound - lowerBound > 1:
	mid = (upperBound + lowerBound) // 2
	(k, rem) = divmod(mid, n)
	rem = int(rem)
	x2 = x + k * d_cycle[-1][0] + d_cycle[rem][0]
	y2 = y + k * d_cycle[-1][1] + d_cycle[rem][1]
	if abs(x2 - t_x) + abs(y2 - t_y) <= mid:
		upperBound = mid
		no_ans = False
		ans = mid
	else:
		lowerBound = mid
if no_ans:
	print(-1)
else:
	print(int(ans))


s1 = [int(i) for i in input().split()]
d = [int(i) for i in input().split()]
n = int(input())
s = input()
a = [[0, 0] for i in range(n)]
for i in range(n):
	x = 0
	y = 0
	if s[i] == 'U':
		y = 1
	elif s[i] == 'D':
		y = -1
	elif s[i] == 'L':
		x = -1
	elif s[i] == 'R':
		x = 1
	a[i][0] = a[max(i - 1, 0)][0] + x
	a[i][1] = a[max(i - 1, 0)][1] + y
high = 1000000000000000
low = 0
c = 0
while low < high:
	mid = (high + low) // 2
	p = 0
	p1 = 0
	if mid % n != 0:
		p = a[mid % n - 1][0]
		p1 = a[mid % n - 1][1]
	x1 = d[0] - (s1[0] + a[n - 1][0] * (mid // n) + p)
	y1 = d[1] - (s1[1] + a[n - 1][1] * (mid // n) + p1)
	if abs(x1) + abs(y1) <= mid:
		c = 1
		high = mid
	else:
		low = mid + 1
if c == 0:
	print(-1)
else:
	print(low)


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
threading.stack_size(10 ** 8)
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit(300000)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=2 ** 51, func=lambda a, b: a & b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
dx = 0
dy = 0
store = [[0 for i in range(2)] for j in range(n)]
for i in range(len(s)):
	if s[i] == 'U':
		dy += 1
	elif s[i] == 'D':
		dy -= 1
	elif s[i] == 'L':
		dx -= 1
	else:
		dx += 1
	store[i][0] = dx
	store[i][1] = dy

def check(k):
	x = x1 + dx * (k // n)
	y = y1 + dy * (k // n)
	if k % n != 0:
		y += store[k % n - 1][1]
		x += store[k % n - 1][0]
	if abs(x2 - x) + abs(y2 - y) <= k:
		return 1
	return 0
st = 0
end = 10 ** 15
ans = -1
while st <= end:
	mid = (st + end) // 2
	if check(mid) == 1:
		ans = mid
		end = mid - 1
	else:
		st = mid + 1
print(ans)


from typing import List
from sys import exit

def reachable(start: List[int], end: List[int], wind: str, time: int):
	start = start.copy()
	wind_x = wind.count('R') - wind.count('L')
	wind_y = wind.count('U') - wind.count('D')
	cycle_num = time // len(wind)
	wind_x *= cycle_num
	wind_y *= cycle_num
	remainder = time % len(wind)
	wind = wind[:remainder]
	wind_x += wind.count('R') - wind.count('L')
	wind_y += wind.count('U') - wind.count('D')
	start[0] += wind_x
	start[1] += wind_y
	return abs(start[0] - end[0]) + abs(start[1] - end[1]) <= time
at_pos = [int(i) for i in input().split()]
destination = [int(i) for i in input().split()]
input()
wind_cycle = input()
lo = 0
hi = 2 * 10 ** 14
valid = -1
while lo <= hi:
	mid = (lo + hi) // 2
	if reachable(at_pos, destination, wind_cycle, mid):
		valid = mid
		hi = mid - 1
	else:
		lo = mid + 1
print(valid)


from sys import stdin, stdout
from collections import Counter
nmbr = lambda : int(input())
lst = lambda : list(map(int, input().split()))

def fn(days):
	times = days // n
	l = times * d['L']
	r = times * d['R']
	u = times * d['U']
	down = times * d['D']
	for i in range(days % n):
		if s[i] == 'L':
			l += 1
		elif s[i] == 'R':
			r += 1
		elif s[i] == 'D':
			down += 1
		else:
			u += 1
	dxx = dx - (r - l)
	dyy = dy - (u - down)
	return abs(dxx) + abs(dyy) <= days
for _ in range(1):
	(x1, y1) = lst()
	(x2, y2) = lst()
	n = nmbr()
	dx = x2 - x1
	dy = y2 - y1
	s = input()
	d = Counter(s)
	(l, r) = (1, 10 ** 15)
	while l <= r:
		mid = l + r >> 1
		if fn(mid) == False:
			l = mid + 1
		else:
			r = mid - 1
	if fn(l):
		print(l)
	else:
		print(-1)


def check(k, n, dx, dy):
	x = k // n * px[n]
	y = k // n * py[n]
	x += px[k % n]
	y += py[k % n]
	if abs(x - dx) + abs(y - dy) <= k:
		return 1
	return 0
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
wind = input()
px = [0] * (n + 5)
py = [0] * (n + 5)
for i in range(1, n + 1):
	px[i] = px[i - 1]
	py[i] = py[i - 1]
	if wind[i - 1] == 'U':
		py[i] += 1
	elif wind[i - 1] == 'D':
		py[i] -= 1
	elif wind[i - 1] == 'L':
		px[i] -= 1
	else:
		px[i] += 1
lower = 0
upper = int(10 ** 18)
ans = -1
dx = x2 - x1
dy = y2 - y1
if check(upper, n, dx, dy) == False:
	print(-1)
else:
	while lower < upper:
		guess = (lower + upper) // 2
		if check(guess, n, dx, dy):
			upper = guess
		else:
			lower = guess + 1
	print(upper)


class MagicShip:
	MOVES = {'U': (0, 1), 'D': (0, -1), 'L': (-1, 0), 'R': (1, 0)}

	def __init__(self, x, y, a, b, n, s):
		(self.x, self.y) = (x, y)
		(self.a, self.b) = (a, b)
		(self.n, self.s) = (n, s)
		pos = (0, 0)
		self.posns = [pos]
		for c in s:
			pos = (pos[0] + self.MOVES[c][0], pos[1] + self.MOVES[c][1])
			self.posns.append(pos)

	def posn(self, m):
		shift = (self.posns[self.n][0] * int(m / n) + self.posns[m % self.n][0], self.posns[self.n][1] * int(m / n) + self.posns[m % self.n][1])
		return (self.x + shift[0], self.y + shift[1])

	def check(self, m):
		pos = self.posn(m)
		return abs(pos[0] - self.a) + abs(pos[1] - self.b) <= m

	def min_moves(self):
		(mn, mx) = (0, 2 * 10 ** 14)
		if self.check(mn):
			return 0
		elif not self.check(mx):
			return -1
		else:
			while mn < mx - 1:
				md = int((mn + mx) / 2)
				if self.check(md):
					mx = md
				else:
					mn = md
			return mx
(x, y) = list(map(int, input().split()))
(a, b) = list(map(int, input().split()))
n = int(input())
s = input().strip(' ')
print(MagicShip(x, y, a, b, n, s).min_moves())


(sx, sy) = input().split(' ')
(dx, dy) = input().split(' ')
sx = int(sx)
sy = int(sy)
dx = int(dx)
dy = int(dy)
n = int(input())
s = input()
if sx == dx and sy == dy:
	print(0)
	exit(0)
low = 1
high = 5 * 10 ** 14
ans = -1
while low <= high:
	mid = (low + high) // 2
	cx = 0
	cy = 0
	for c in s:
		if c == 'L':
			cx -= 1
		elif c == 'R':
			cx += 1
		elif c == 'U':
			cy += 1
		else:
			cy -= 1
	cx = sx + mid // n * cx
	cy = sy + mid // n * cy
	for i in range(mid % n):
		c = s[i]
		if c == 'L':
			cx -= 1
		elif c == 'R':
			cx += 1
		elif c == 'U':
			cy += 1
		else:
			cy -= 1
	dis = abs(cx - dx) + abs(cy - dy)
	if dis <= mid:
		ans = mid
		high = mid - 1
	else:
		low = mid + 1
print(ans)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree:

	def __init__(self, data, default=-10 ** 6, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree1:

	def __init__(self, data, default=10 ** 6, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
omod = 998244353
prime = [True for i in range(50001)]
pp = []

def SieveOfEratosthenes(n=50000):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for i in range(50001):
		if prime[i]:
			pp.append(i)
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
dx = 0
dy = 0
store = [[0 for i in range(2)] for j in range(n)]
for i in range(len(s)):
	if s[i] == 'U':
		dy += 1
	elif s[i] == 'D':
		dy -= 1
	elif s[i] == 'L':
		dx -= 1
	else:
		dx += 1
	store[i][0] = dx
	store[i][1] = dy

def check(k):
	x = x1 + dx * (k // n)
	y = y1 + dy * (k // n)
	if k % n != 0:
		y += store[k % n - 1][1]
		x += store[k % n - 1][0]
	if abs(x2 - x) + abs(y2 - y) <= k:
		return 1
	return 0
st = 0
end = 10 ** 15
ans = -1
while st <= end:
	mid = (st + end) // 2
	if check(mid) == 1:
		ans = mid
		end = mid - 1
	else:
		st = mid + 1
print(ans)


from collections import Counter
(x1, y1) = list(map(int, input().split()))
(x2, y2) = list(map(int, input().split()))
xx = x2 - x1
yy = y2 - y1
n = int(input())
s = list(input())
pxli = [0]
pyli = [0]
tmpx = 0
tmpy = 0
for ll in s:
	if ll == 'U':
		tmpy += 1
	if ll == 'D':
		tmpy -= 1
	elif ll == 'R':
		tmpx += 1
	elif ll == 'L':
		tmpx -= 1
	pxli.append(tmpx)
	pyli.append(tmpy)
dx = pxli[-1]
dy = pyli[-1]

def isreachable(x, y, d, divmod=divmod):
	(cyc, m) = divmod(d, n)
	ddx = dx * cyc + pxli[m]
	ddy = dy * cyc + pyli[m]
	return abs(x - ddx) + abs(y - ddy) <= d
if not isreachable(xx, yy, 10 ** 17):
	print(-1)
	return
db = 10 ** 17
ds = 0
while db - ds > 1:
	dm = (db + ds) // 2
	if isreachable(xx, yy, dm):
		db = dm
	else:
		ds = dm
if isreachable(xx, yy, ds):
	print(ds)
else:
	print(ds + 1)


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
(U, D, L, R) = (0, 0, 0, 0)
for i in range(n):
	if s[i] == 'U':
		U += 1
	if s[i] == 'D':
		D += 1
	if s[i] == 'L':
		L += 1
	if s[i] == 'R':
		R += 1
xd = x2 - x1
yd = y2 - y1
xr = R - L
yr = U - D

def bsearch(l, r):
	if r < l:
		return -1
	elif l == r:
		return l
	mid = (l + r) // 2
	xnd = xd - xr * mid
	ynd = yd - yr * mid
	if abs(xnd) + abs(ynd) <= mid * n:
		return bsearch(l, mid - 1)
	else:
		if mid == l:
			xnd = xd - xr * r
			ynd = yd - yr * r
			if abs(xnd) + abs(ynd) <= r * n:
				return l
			else:
				return r
		return bsearch(mid, r)
itrs = bsearch(0, 10 ** 10)
if itrs == -1:
	print(-1)
	exit(0)
xd -= xr * itrs
yd -= yr * itrs
ans = -1
for i in range(n):
	if abs(xd) + abs(yd) <= itrs * n + i:
		ans = itrs * n + i
		break
	if s[i] == 'U':
		yd -= 1
	elif s[i] == 'D':
		yd += 1
	elif s[i] == 'L':
		xd += 1
	elif s[i] == 'R':
		xd -= 1
if ans == -1 and abs(xd) + abs(yd) <= itrs * n + n:
	ans = itrs * n + n
print(ans)


import sys

def solve():
	(x1, y1) = list(map(int, input().split()))
	(x2, y2) = list(map(int, input().split()))
	n = int(input())
	s = input()
	d = abs(x1 - x2) + abs(y1 - y2)
	if not d:
		print(0)
		return
	curx = x1
	cury = y1
	curd = d
	dx = {'L': -1, 'R': 1, 'U': 0, 'D': 0}
	dy = {'L': 0, 'R': 0, 'U': 1, 'D': -1}
	for i in range(n):
		curx += dx[s[i]]
		cury += dy[s[i]]
		curd = abs(curx - x2) + abs(cury - y2)
		if curd <= i + 1:
			print(i + 1)
			return 0
	if curd >= d + n:
		print(-1)
		return
	v = [curx - x1, cury - y1]
	sx = 0
	sy = 0
	ans = 2 * d * n
	for i in range(n):
		sx += dx[s[i]]
		sy += dy[s[i]]
		l = 1
		r = 2 * d * n
		while l < r:
			mid = (l + r) // 2
			if abs(x1 + mid * v[0] + sx - x2) + abs(y1 + mid * v[1] + sy - y2) > mid * n + i + 1:
				l = mid + 1
			else:
				r = mid
		ans = min(l * n + i + 1, ans)
	print(ans if ans < 2 * d * n else -1)
	return
solve()


def is_possible(num_days):
	if num_days % len(string) == 0:
		diff_wind = (num_days // len(string) * pref[-1][0], num_days // len(string) * pref[-1][1])
	else:
		diff_wind = (num_days // len(string) * pref[-1][0] + pref[num_days % len(string) - 1][0], num_days // len(string) * pref[-1][1] + pref[num_days % len(string) - 1][1])
	diff_ship = (diff[0] - diff_wind[0], diff[1] - diff_wind[1])
	return abs(diff_ship[0]) + abs(diff_ship[1]) <= num_days
(x, y) = [int(s) for s in input().split()]
(x1, y1) = [int(s) for s in input().split()]
diff = (x1 - x, y1 - y)
amount = int(input())
string = input()
motions = []
pref = []
for i in range(len(string)):
	if string[i] == 'U':
		motions.append((0, 1))
	if string[i] == 'D':
		motions.append((0, -1))
	if string[i] == 'R':
		motions.append((1, 0))
	if string[i] == 'L':
		motions.append((-1, 0))
pref.append(motions[0])
for i in range(1, len(motions)):
	pref.append((motions[i][0] + pref[-1][0], motions[i][1] + pref[-1][1]))
left = -1
right = int(1e+19)
while right - left > 1:
	middle = (right + left) // 2
	if is_possible(middle):
		right = middle
	else:
		left = middle
if right != int(1e+19):
	print(right)
else:
	print(-1)


(x1, y1) = input().split()
(x1, y1) = [int(x1), int(y1)]
(x2, y2) = input().split()
(x2, y2) = [int(x2), int(y2)]
n = int(input())
g = [g for g in input()]
mydict1 = {}
mydict1['R'] = 0
mydict1['U'] = 0
mydict1['L'] = 0
mydict1['D'] = 0
for i in g:
	mydict1[i] += 1

def distancechecker(wind, days, a1, b1, a2, b2):
	l = []
	quot = days // n
	rem = days % n
	c1 = a1
	d1 = b1
	c1 += mydict1['R'] * quot
	c1 -= mydict1['L'] * quot
	d1 += mydict1['U'] * quot
	d1 -= mydict1['D'] * quot
	if rem > 0:
		for i in range(1, rem + 1):
			l.append(wind[i - 1])
	for i in l:
		if i == 'U':
			d1 += 1
		elif i == 'D':
			d1 -= 1
		elif i == 'L':
			c1 -= 1
		else:
			c1 += 1
	if abs(a2 - c1) + abs(b2 - d1) <= days:
		return True
	else:
		return False
beg = 0
last = 10 ** 15
while beg != last:
	mid = (beg + last) // 2
	count = distancechecker(g, mid, x1, y1, x2, y2)
	if count == True:
		last = mid
	else:
		beg = mid + 1
if last == 10 ** 15:
	print(-1)
else:
	print(last)


def generate(tup, l):
	if l == 'U':
		return (tup[0], tup[1] + 1)
	elif l == 'D':
		return (tup[0], tup[1] - 1)
	elif l == 'L':
		return (tup[0] - 1, tup[1])
	else:
		return (tup[0] + 1, tup[1])

def main():
	start = input().split()
	start[0] = int(start[0])
	start[1] = int(start[1])
	end = input().split()
	end[0] = int(end[0])
	end[1] = int(end[1])
	n = int(input())
	string = input()
	movement = [(0, 0)]
	for x in range(n):
		movement.append(generate(movement[-1], string[x]))
	upper = 10 ** 15
	lower = 0
	while upper - lower > 1:
		middle = (upper + lower) // 2
		loop = middle // n
		rem = middle % n
		distance = 0
		distance += abs(end[0] - (start[0] + loop * movement[-1][0] + movement[rem][0]))
		distance += abs(end[1] - (start[1] + loop * movement[-1][1] + movement[rem][1]))
		if distance <= middle:
			upper = middle
		else:
			lower = middle
	if upper > 2 * 10 ** 14:
		upper = -1
	print(upper)
main()


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
wind = input()
prep_x = [0] * (n + 1)
prep_y = [0] * (n + 1)
for i in range(1, n + 1):
	prep_x[i] = prep_x[i - 1]
	prep_y[i] = prep_y[i - 1]
	if wind[i - 1] == 'U':
		prep_y[i] += 1
	elif wind[i - 1] == 'D':
		prep_y[i] -= 1
	elif wind[i - 1] == 'L':
		prep_x[i] -= 1
	else:
		prep_x[i] += 1

def check(days):
	x = days // n * prep_x[n]
	y = days // n * prep_y[n]
	x += prep_x[days % n]
	y += prep_y[days % n]
	dx = x1 - x2
	dy = y1 - y2
	if abs(x + dx) + abs(y + dy) <= days:
		return 1
	return 0
lower = 0
upper = int(10 ** 18)
if check(upper) == False:
	print(-1)
else:
	while lower < upper:
		guess = (lower + upper) // 2
		if check(guess):
			upper = guess
		else:
			lower = guess + 1
	print(upper)


(x1, y1) = list(map(int, input().split()))
(x2, y2) = list(map(int, input().split()))
n = int(input())
s = input()
hor = [0 for i in range(n + 1)]
ver = [0 for i in range(n + 1)]
for i in range(1, n + 1):
	ver[i] = ver[i - 1]
	hor[i] = hor[i - 1]
	if s[i - 1] == 'U':
		ver[i] = ver[i - 1] + 1
	elif s[i - 1] == 'D':
		ver[i] = ver[i - 1] - 1
	elif s[i - 1] == 'L':
		hor[i] = hor[i - 1] - 1
	else:
		hor[i] = hor[i - 1] + 1
delhor = x2 - x1
delver = y2 - y1
ans = -1
STEPS = 2000000000000000000
left = 0
right = STEPS
mid = STEPS
a1 = 0
a2 = 0
a1 = mid // n
a2 = mid % n
if abs(delhor - a1 * hor[n] - hor[a2]) + abs(delver - a1 * ver[n] - ver[a2]) <= mid:
	while left != right:
		mid = (left + right) // 2
		a1 = mid // n
		a2 = mid % n
		if abs(delhor - a1 * hor[n] - hor[a2]) + abs(delver - a1 * ver[n] - ver[a2]) <= mid:
			right = mid
		else:
			left = mid + 1
	print(left)
else:
	print(-1)


(x1, y1) = [int(x) for x in input().split()]
(x2, y2) = [int(x) for x in input().split()]
lens = int(input())
string = input()
x = [0 for _ in range(lens + 1)]
y = [0 for _ in range(lens + 1)]
for i in range(lens):
	x[i + 1] = x[i] + (string[i] == 'R') - (string[i] == 'L')
	y[i + 1] = y[i] + (string[i] == 'U') - (string[i] == 'D')
left = -1
rite = int(10 ** 18)
ans = int(10 ** 18) + 1
while rite - left > 1:
	mid = left + rite >> 1
	X = mid // lens * x[-1] + x[mid % lens]
	Y = y[-1] * (mid // lens) + y[mid % lens]
	X += x1
	Y += y1
	if abs(X - x2) + abs(Y - y2) <= mid:
		rite = mid
	else:
		left = mid
print([rite, -1][rite == 10 ** 18])


from math import ceil
from math import sqrt

def dist(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = input()
add = [[0, 0] for i in range(n + 1)]
for i in range(1, n + 1):
	l = s[i - 1]
	addCr = [0, 0]
	if l == 'U':
		addCr[1] += 1
	elif l == 'D':
		addCr[1] -= 1
	elif l == 'L':
		addCr[0] -= 1
	else:
		addCr[0] += 1
	if i != 0:
		addCr[0] += add[i - 1][0]
		addCr[1] += add[i - 1][1]
	add[i] = addCr

def check(v):
	dx = add[n][0] * (v // n) + add[v % n][0]
	dy = add[n][1] * (v // n) + add[v % n][1]
	nx = x1 + dx
	ny = y1 + dy
	d = dist(nx, ny, x2, y2)
	if d <= v:
		return True
	return False
l = 0
r = 1000000000000000000000
check(5)
if not check(r):
	print(-1)
	exit(0)
while r - l > 1:
	mid = (l + r) // 2
	if check(mid):
		r = mid
	else:
		l = mid
print(r)


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
string = input()
loc = [(0, 0)]
ups = 0
rights = 0
for i in string:
	if i == 'U':
		ups += 1
	elif i == 'L':
		rights -= 1
	elif i == 'R':
		rights += 1
	else:
		ups -= 1
	loc.append((rights, ups))

def wdest(k):
	p = k // n
	r = k % n
	return (x2 - (x1 + p * loc[-1][0] + loc[r][0]), y2 - (y1 + p * loc[-1][1] + loc[r][1]))

def binSearch():
	l = 0
	h = int(4e+18)
	while l <= h:
		k = (l + h) // 2
		(a, b) = wdest(k)
		if abs(a) + abs(b) <= k:
			h = k - 1
		else:
			l = k + 1
	return h
h = binSearch()
if h > 5e+17:
	print(-1)
else:
	print(h + 1)


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)

def getIntList():
	return list(map(int, input().split()))
isdebug = False
try:
	import numpy

	def dprint(*args, **kwargs):
		print(*args, file=sys.stderr)
	dprint('debug mode')
	isdebug = True
except Exception:

	def dprint(*args, **kwargs):
		pass
inId = 0
outId = 0
if not isdebug:
	inId = 0
	outId = 0
if inId > 0:
	dprint('use input', inId)
	try:
		f = open('input' + str(inId) + '.txt', 'r')
		sys.stdin = f
	except Exception:
		dprint('invalid input file')
if outId > 0:
	dprint('use output', outId)
	try:
		f = open('stdout' + str(outId) + '.txt', 'w')
		sys.stdout = f
	except Exception:
		dprint('invalid output file')
	atexit.register(lambda : sys.stdout.close())
p1 = getIntList()
p2 = getIntList()
(N,) = getIntList()
S0 = input()
dis = dict()
dis['U'] = (0, 1)
dis['D'] = (0, -1)
dis['L'] = (-1, 0)
dis['R'] = (1, 0)
zt = [(0, 0) for i in range(N + 1)]

def addp(p0, p1):
	return (p0[0] + p1[0], p0[1] + p1[1])
for i in range(N):
	v = dis[S0[i]]
	p = addp(zt[i], v)
	zt[i + 1] = p
dprint(zt)
u0 = 10 ** 19
l0 = 0

def check(step):
	t = step // N
	gf = step % N
	p3 = addp(p1, (zt[N][0] * t, zt[N][1] * t))
	p3 = addp(p3, zt[gf])
	d = abs(p3[0] - p2[0]) + abs(p3[1] - p2[1])
	if d <= step:
		return True
	return False
if not check(u0):
	print(-1)
	sys.exit()
while l0 + 1 < u0:
	mid = (l0 + u0) // 2
	f = check(mid)
	if f:
		u0 = mid
	else:
		l0 = mid
print(u0)


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict, deque, Counter, OrderedDict
import threading

def main():

	def dir(v):
		if v == 'U':
			return [0, 1]
		if v == 'D':
			return [0, -1]
		if v == 'L':
			return [-1, 0]
		if v == 'R':
			return [1, 0]
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	n = int(input())
	s = input()
	move = [[0, 0] for _ in range(n + 1)]
	for i in range(1, n + 1):
		(nx, ny) = dir(s[i - 1])
		move[i] = [move[i - 1][0] + nx, move[i - 1][1] + ny]
	ans = 10 ** 14 + 1
	(l, r) = (0, 10 ** 14 + 1)
	while l <= r:
		mid = (l + r) // 2
		week = mid // n
		day = mid % n
		x = x1 + move[day][0] + week * move[-1][0]
		y = y1 + move[day][1] + week * move[-1][1]
		if abs(x - x2) + abs(y - y2) <= mid:
			ans = min(ans, mid)
			r = mid - 1
		else:
			l = mid + 1
	print([ans, -1][ans == 10 ** 14 + 1])
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
n = int(input())
s = list(input())
p = [(0, 0)]
for i in range(n):
	if s[i] == 'U':
		p.append((p[-1][0], p[-1][1] + 1))
	elif s[i] == 'D':
		p.append((p[-1][0], p[-1][1] - 1))
	elif s[i] == 'R':
		p.append((p[-1][0] + 1, p[-1][1]))
	else:
		p.append((p[-1][0] - 1, p[-1][1]))

def check(m):
	(dx, dy) = (p[-1][0] * (m // n) + p[m % n][0], p[-1][1] * (m // n) + p[m % n][1])
	if abs(x1 + dx - x2) + abs(y1 + dy - y2) <= m:
		return True
	else:
		return False

def outer(k):
	l = 0
	h = 10 ** 10
	ans = -1
	while l <= h:
		m = (l + h) // 2
		if check(n * m + k):
			ans = n * m + k
			h = m - 1
		else:
			l = m + 1
	return ans
a = None
for i in range(n):
	ta = outer(i)
	if ta != -1:
		if a is None:
			a = ta
		else:
			a = min(a, ta)
if a is None:
	print(-1)
else:
	print(a)


def f(k):
	(div, mod) = divmod(k, n)
	(x, y) = (div * v[n][0] + v[mod][0], div * v[n][1] + v[mod][1])
	if abs(x2 - (x1 + x)) + abs(y2 - (y1 + y)) > k:
		return False
	return True
(x1, y1) = list(map(int, input().split()))
(x2, y2) = list(map(int, input().split()))
n = int(input())
s = input()
(vx, vy) = (0, 0)
v = [(vx, vy)]
for i in s:
	if i == 'U':
		vy += 1
	elif i == 'D':
		vy -= 1
	elif i == 'L':
		vx -= 1
	else:
		vx += 1
	v.append((vx, vy))
l = 0
r = 10 ** 18
while r - l > 1:
	med = (r + l) // 2
	if f(med):
		r = med
	else:
		l = med
if f(l):
	r = l
if r == 10 ** 18:
	print(-1)
else:
	print(r)