Bob watches TV every day. He always sets the volume of his TV to $b$. However, today he is angry to find out someone has changed the volume to $a$. Of course, Bob has a remote control that can change the volume.

There are six buttons ($-5, -2, -1, +1, +2, +5$) on the control, which in one press can either increase or decrease the current volume by $1$, $2$, or $5$. The volume can be arbitrarily large, but can never be negative. In other words, Bob cannot press the button if it causes the volume to be lower than $0$.

As Bob is so angry, he wants to change the volume to $b$ using as few button presses as possible. However, he forgets how to do such simple calculations, so he asks you for help. Write a program that given $a$ and $b$, finds the minimum number of presses to change the TV volume from $a$ to $b$.


-----Input-----

Each test contains multiple test cases. The first line contains the number of test cases $T$ ($1 \le T \le 1\,000$). Then the descriptions of the test cases follow.

Each test case consists of one line containing two integers $a$ and $b$ ($0 \le a, b \le 10^{9}$) — the current volume and Bob's desired volume, respectively.


-----Output-----

For each test case, output a single integer — the minimum number of presses to change the TV volume from $a$ to $b$. If Bob does not need to change the volume (i.e. $a=b$), then print $0$.


-----Example-----
Input
3
4 0
5 14
3 9

Output
2
3
2



-----Note-----

In the first example, Bob can press the $-2$ button twice to reach $0$. Note that Bob can not press $-5$ when the volume is $4$ since it will make the volume negative. 

In the second example, one of the optimal ways for Bob is to press the $+5$ twice, then press $-1$ once.

In the last example, Bob can press the $+5$ once, then press $+1$.

Difficulty: EASY

Solutions:
for t in range(int(input())):
	(a, b) = [int(j) for j in input().split()]
	d = {1: 1, 0: 0, 2: 1, 3: 2, 4: 2}
	x = abs(b - a)
	print(x // 5 + d[x % 5])


def volume_setter():
	remote = [1, 2, 5]
	(vol, dvol) = map(int, input().split())
	count = 0
	fvol = abs(vol - dvol)
	count = 0
	if fvol >= 5:
		count = fvol // 5
		fvol = fvol % 5
	if fvol >= 2:
		count += fvol // 2
		fvol = fvol % 2
	count += fvol
	print(count)
for i in range(int(input())):
	volume_setter()


n = int(input())
answers = []
for i in range(n):
	(a, b) = map(int, input().split(' '))
	temp = abs(b - a)
	total = temp // 5
	rem = temp % 5
	if rem and (rem % 2 == 0 and rem != 2 or rem == 3):
		total += 2
	elif rem:
		total += 1
	answers.append(total)
for ans in answers:
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	ans = 0
	ans += x // 5
	x = x % 5
	ans += x // 2
	x = x % 2
	ans += x
	print(ans)


n = int(input())
v = [0, 1, 1, 2, 2]
for i in range(0, n):
	[a, b] = [int(v) for v in input().split(' ')]
	d = abs(a - b)
	print(d // 5 + v[d % 5])


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	if d == 0:
		print(0)
	else:
		ans = d // 5 + d % 5 // 2 + d % 5 % 2
		print(ans)


import sys

def main():
	for _ in range(int(input())):
		(a, b) = [int(x) for x in sys.stdin.readline().split()]
		if a == b:
			print(0)
		elif a < b:
			count = 0
			b = b - a
			if b % 5 == 0:
				count = count + b // 5
				b = 0
			else:
				x = b // 5
				count = count + x
				b = b - 5 * x
			if b == 0:
				print(count)
			else:
				if b % 2 == 0:
					count = count + b // 2
					b = 0
				else:
					x = b // 2
					count = count + x
					b = b - 2 * x
				if b == 0:
					print(count)
				else:
					print(count + b)
		else:
			(a, b) = (b, a)
			count = 0
			b = b - a
			if b % 5 == 0:
				count = count + b // 5
				b = 0
			else:
				x = b // 5
				count = count + x
				b = b - 5 * x
			if b == 0:
				print(count)
			else:
				if b % 2 == 0:
					count = count + b // 2
					b = 0
				else:
					x = b // 2
					count = count + x
					b = b - 2 * x
				if b == 0:
					print(count)
				else:
					print(count + b)
main()


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	ans = d // 5
	if d % 5 == 4 or d % 5 == 3:
		ans += 2
	elif d % 5 == 2 or d % 5 == 1:
		ans += 1
	print(ans)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	d = max(a, b) - min(a, b)
	s = d // 5
	d = d % 5
	s = s + d // 2
	s = s + d % 2
	print(s)


T = int(input())
out = []
for i in range(T):
	ab = [int(c) for c in input().split()]
	s = abs(ab[0] - ab[1])
	if s == 0:
		out.append(0)
	else:
		out.append(s // 5 + s % 5 // 2 + s % 5 % 2)
for i in range(T):
	print(out[i])


t = int(input())
k = []
for i in range(t):
	p = input().split()
	k.append(p)
	k[i][0] = int(k[i][0])
	k[i][1] = int(k[i][1])
for i in range(t):
	b = k[i][1]
	a = k[i][0]
	if a > b:
		q = a - b
		c = q // 5 + q % 5 // 2 + q % 5 % 2
		print(c)
	if b > a:
		q = b - a
		c = q // 5 + q % 5 // 2 + q % 5 % 2
		print(c)
	if a == b:
		print(0)


import math
N = int(input())
val = [list(map(int, input().split())) for i in range(N)]
for i in range(N):
	a = val[i][0]
	b = val[i][1]
	c = math.floor(abs(b - a) / 5)
	d = 0
	if abs(b - a - c * 5) == 1 or abs(b - a - c * 5) == 2 or abs(b - a + c * 5) == 1 or (abs(b - a + c * 5) == 2):
		d = 1
	elif abs(b - a - c * 5) == 3 or abs(b - a - c * 5) == 4 or abs(b - a + c * 5) == 3 or (abs(b - a + c * 5) == 4):
		d = 2
	e = abs(c) + d
	print(e)


t = int(input())
s = []
for nfn in range(0, t):
	x = input()
	xx = x.split()
	a = int(xx[0])
	b = int(xx[1])
	g = 0
	h = abs(a - b)
	g += h // 5
	h = h % 5
	g += h // 2
	h = h % 2
	g += h
	s.append(g)
for i in s:
	print(i)


t = int(input())

def solve(x, y):
	d = abs(x - y)
	cnt = 0
	if d >= 5:
		cnt += d // 5
		d = d % 5
	if d < 5 and d >= 2:
		cnt += d // 2
		d = d % 2
	cnt += d // 1
	return cnt
for i in range(t):
	(a, b) = map(int, input().split())
	print(solve(a, b))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	diff = b - a
	ans = 0
	ans += diff // 5
	diff = diff % 5
	ans += diff // 2
	diff = diff % 2
	ans += diff
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	if d % 5 == 0:
		print(d // 5)
	elif d % 5 == 1 or d % 5 == 2:
		print(d // 5 + 1)
	else:
		print(d // 5 + 2)


k = int(input())
for _ in range(k):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		m = max(a, b)
		n = min(a, b)
		a = n
		b = m
		diff = b - a
		r = diff // 5
		r1 = b - (a + r * 5)
		r2 = abs(b - (a + (r + 1) * 5))
		m = min(r1, r2)
		if r2 < r1:
			print(r + 1 + r2 // 2 + r2 % 2)
		else:
			print(r + r1 // 2 + r1 % 2)


query = int(input())
for _ in range(query):
	(n, m) = map(int, input().split())
	chg = abs(m - n)
	cnt = 0
	cnt += chg // 5
	chg -= cnt * 5
	if chg == 4 or chg == 3:
		cnt += 2
	elif chg != 0:
		cnt += 1
	print(cnt)


n = int(input())
while n != 0:
	(x, y) = map(int, input().split())
	c = abs(y - x)
	print(c // 5 - c % 5 // -2)
	n = n - 1


t = int(input())
for it in range(t):
	(a, b) = map(int, input().split())
	a -= b
	if a < 0:
		a = -a
	z = [5, 2, 1]
	ans = 0
	for i in z:
		ans += a // i
		a %= i
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if abs(a - b) == 0:
		print(0)
	else:
		k = abs(a - b)
		a1 = k // 5
		k -= a1 * 5
		a2 = k // 2
		k -= a2 * 2
		print(a1 + a2 + k)


import itertools

def main():
	n = int(input())
	up_vals = [0, 1, 1, 2, 2]
	down_vals = [0, 1, 1, 2, 2]
	for i in range(n):
		(a, b) = [int(v) for v in input().split()]
		if a > b:
			diff = a - b
			v_5 = diff // 5
			d_5 = diff % 5
			d = v_5 + down_vals[d_5]
		else:
			diff = b - a
			v_5 = diff // 5
			d_5 = diff % 5
			d = v_5 + up_vals[d_5]
		print(d)
main()


n = int(input())
a_ans = []
for _ in range(n):
	a = list(map(int, input().split()))
	d = abs(a[0] - a[1])
	ans = 0
	ans += d // 5
	d %= 5
	ans += d // 2
	d %= 2
	ans += d
	a_ans.append(ans)
for e in a_ans:
	print(e)


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	if x > y:
		(x, y) = (y, x)
	a = (y - x) // 5
	x += a * 5
	b = (y - x) // 2
	x += b * 2
	c = y - x
	print(a + b + c)


import math
t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	c = 0
	if k > n:
		(n, k) = (k, n)
	if n - k >= 5:
		c += (n - k) // 5
		n -= 5 * math.floor((n - k) / 5)
	if n - k > 1 and n - k < 5:
		c += (n - k) // 2
		n -= 2 * math.floor((n - k) / 2)
	if n - k == 1:
		n -= 1
		c += 1
	print(c)


t = int(input())
for i in range(t):
	ins = list(map(int, input().split()))
	target = max(ins[0], ins[1]) - min(ins[0], ins[1])
	print(target // 5 + target % 5 // 2 + target % 5 % 2)


tests = int(input())
for _ in range(tests):
	(x, y) = list(map(int, input().split()))
	absolute1 = int(abs(x - y) / 5)
	absolute2 = int((abs(x - y) - absolute1 * 5) / 2)
	absolute3 = int(abs(x - y) - (absolute1 * 5 + absolute2 * 2))
	print(absolute1 + absolute2 + absolute3)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	s = abs(a - b)
	x = s // 5
	s %= 5
	x += s // 2
	s %= 2
	x += s
	print(x)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools
from collections import deque, defaultdict, OrderedDict
import collections

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		(a, b) = ria()
		(b, a) = (max(a, b), min(a, b))
		z = b - a
		k = z
		ans = 0
		if z >= 5:
			while z > 4:
				l = 5 ** int(math.log(z, 5))
				z -= l
				ans += l // 5
		if z >= 2:
			while z > 1:
				l = 2 ** int(math.log(z, 2))
				z -= l
				ans += l // 2
		if z == 1:
			ans += 1
		print(ans)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			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, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			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()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

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

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	if b > a:
		temp = b - a
	else:
		temp = a - b
	cnt = 0
	cnt += temp // 5
	temp %= 5
	cnt += temp // 2
	cnt += temp % 2
	print(cnt)
	t -= 1


n = int(input())
for t in range(n):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	d = a - b
	if d < 0:
		d *= -1
	c = 0
	c += d // 5
	d = d % 5
	c += d // 2
	d = d % 2
	c += d // 1
	d = d % 1
	print(c)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	print(d // 5 + (d % 5 + 1) // 2)


def calc(a, d, v):
	return (int(a + d / v), d % v)
test = int(input())
for test in range(test, 0, -1):
	(a, b) = input().split()
	dif = abs(int(a) - int(b))
	ans = int(0)
	(ans, dif) = calc(ans, dif, 5)
	(ans, dif) = calc(ans, dif, 2)
	(ans, dif) = calc(ans, dif, 1)
	print(ans)


t = int(input())
resAr = []
for z in range(t):
	(a, b) = [int(i) for i in input().split()]
	dist = abs(b - a)
	ct = 0
	rf = dist // 5
	dist -= rf * 5
	if dist < 0:
		rf += 1
		dist += 5
	rt = dist // 2
	if dist < 0:
		rt += 1
		dist += 2
	dist -= rt * 2
	ro = dist
	resAr.append(abs(rf) + abs(rt) + abs(ro))
for i in resAr:
	print(i)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	count = 0
	ans = 0
	if a >= b:
		(a, b) = (b, a)
	count = abs(b - a)
	if count >= 5:
		ans += count // 5
		count = count % 5
	if count >= 2:
		ans += count // 2
		count = count % 2
	if count >= 1:
		ans += count // 1
		count = count % 1
	print(ans)


T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	ans = d // 5
	d = d % 5
	if d in [1, 2]:
		ans += 1
	elif d in [3, 4]:
		ans += 2
	print(ans)


import time

def calcMinimumPresses(a, b):
	presses = 0
	if a == b:
		return 0
	else:
		diff = abs(a - b)
		presses = minusOperation(diff)
	return presses

def minusOperation(diff):
	presses = 0
	presses = presses + diff // 5
	if diff % 5 > 0:
		diff = diff - presses * 5
		div2 = diff // 2
		presses += div2
		diff = diff - div2 * 2
		if diff % 2 > 0:
			presses += 1
	return presses

def solve():
	cases = int(input())
	for x in range(cases):
		(a, b) = [int(y) for y in input().split()]
		print(calcMinimumPresses(a, b))
solve()


try:
	for _ in range(int(input())):
		s = 0
		(a, b) = map(int, input().split())
		c = abs(a - b)
		s = s + c // 5
		c = c - 5 * (c // 5)
		s = s + c // 2
		c = c - 2 * (c // 2)
		s = s + c // 1
		c = c - 1 * (c // 1)
		print(s)
except:
	pass


for _ in range(int(input())):
	(a, b) = [int(j) for j in input().split()]
	count = abs(int((b - a) / 5))
	if a > b:
		a -= count * 5
	else:
		a += count * 5
	while a != b:
		diff = a - b
		count += 1
		if abs(diff) == 3 or abs(diff) == 4:
			count += 1
			a -= diff
		elif abs(diff) <= 5:
			a -= diff
		elif diff < 0:
			a += 5
		else:
			a -= 5
	print(count)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	a = abs(a - b)
	c = a // 5
	a -= c * 5
	print(c + a // 2 + a % 2)


for x in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	count = 0
	while d > 0:
		if d >= 5:
			count = count + d // 5
			d = d % 5
		elif d >= 2:
			count = count + d // 2
			d = d % 2
		elif d == 1:
			d = d - 1
			count = count + 1
	if d == 0:
		print(count)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	cnt = 0
	res = abs(a - b)
	if res >= 5:
		cnt += int(res / 5)
		if res % 5 == 1 or res % 5 == 2:
			cnt += 1
		elif res % 5 == 3 or res % 5 == 4:
			cnt += 2
	elif res % 5 == 1 or res % 5 == 2:
		cnt += 1
	elif res % 5 == 3 or res % 5 == 4:
		cnt += 2
	print(cnt)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	s = 0
	s += c // 5
	c = c % 5
	s += c // 2
	c = c % 2
	s += c
	print(s)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		j = abs(a - b)
		if j == 1 or j == 2 or j == 5:
			print(1)
		elif j == 3 or j == 7 or j == 6:
			print(2)
		elif j % 5 == 0:
			print(j // 5)
		elif j % 5 == 2 or j % 5 == 1:
			print(j // 5 + 1)
		elif j % 5 == 3 or j % 5 == 4:
			print(j // 5 + 2)
		elif j % 3 == 0:
			print(j // 2)
		elif j % 3 == 1 or j % 3 == 2:
			print(j // 3 + 1)
		elif j % 2 == 0:
			print(j // 2)
		elif j % 2 == 1:
			print(j // 2 + 1)


ntc = int(input())
for _ in range(ntc):
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	mod5 = (a - b) % 5
	res = (a - b) // 5
	mod2 = mod5 % 2
	res += mod5 // 2
	res += mod2
	print(res)


def inp(dtype=str, strip=True):
	s = input()
	res = [dtype(p) for p in s.split()]
	res = res[0] if len(res) == 1 and strip else res
	return res

def problem1():
	t = inp(int)
	for _ in range(t):
		(a, b) = inp(int)
		delta = abs(b - a)
		res = delta // 5
		delta = delta % 5
		res += delta // 2
		delta = delta % 2
		res += delta
		print(res)

def problem2():
	pass

def problem3():
	pass

def problem4():
	pass

def problem5():
	pass
problem1()


n = int(input())
while n != 0:
	n -= 1
	tstr = input()
	tstr = tstr.split(' ')
	a = int(tstr[0])
	b = int(tstr[1])
	a = abs(b - a)
	b = 0
	if a / 5 > 0:
		b += a // 5
		a = a % 5
	if a / 2 > 0:
		b += a // 2
		a = a % 2
	b += a
	print(b)


n = int(input())

def check():
	my_list = list(map(int, input().split()))
	a = my_list[0]
	b = my_list[1]
	i = 0
	if a == b:
		print(0)
	elif a > b:
		d = (a - b) // 5
		if d >= 1:
			i += d
			a -= d * 5
			if a == b:
				print(i)
			else:
				d = (a - b) // 2
				if d >= 1:
					i += d
					a -= d * 2
					if a == b:
						print(i)
					else:
						i += a - b
						print(i)
				else:
					i += a - b
					print(i)
		else:
			d = (a - b) // 2
			if d >= 1:
				i += d
				a -= d * 2
				if a == b:
					print(i)
				else:
					i += a - b
					print(i)
			else:
				i = a - b
				print(i)
	else:
		d = (b - a) // 5
		if d >= 1:
			i += d
			a += d * 5
			if a == b:
				print(i)
			else:
				d = (b - a) // 2
				if d >= 1:
					i += d
					a += d * 2
					if a == b:
						print(i)
					else:
						i += b - a
						print(i)
				else:
					i += b - a
					print(i)
		else:
			d = (b - a) // 2
			if d >= 1:
				i += d
				a += d * 2
				if a == b:
					print(i)
				else:
					i += b - a
					print(i)
			else:
				i = b - a
				print(i)
for i in range(n):
	check()


for i in range(int(input())):
	(a, b) = map(int, input().strip().split(' '))
	if a < b:
		(a, b) = (b, a)
	m = (a - b) % 5
	if m == 1 or m == 2:
		ans = 1 + (a - b) // 5
	elif m == 3 or m == 4:
		ans = 2 + (a - b) // 5
	else:
		ans = (a - b) // 5
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	t = abs(a - b)
	sum = 0
	sum += t // 5
	t = t % 5
	if t in [1, 2]:
		sum += 1
	elif t in [3, 4]:
		sum += 2
	print(sum)


mod = 10 ** 9 + 7
import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def main():
	t = inin()
	for _ in range(t):
		(j, k) = cin()
		x = abs(j - k)
		ans = 0
		ans += x // 5
		x %= 5
		ans += x // 2
		x %= 2
		ans += x
		print(ans)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


def calc2(a, b):
	diff = a - b
	ans = 0
	for i in [5, 2, 1]:
		ans = ans + int(diff / i)
		diff = diff % i
		if diff == 0:
			return ans
		else:
			pass

def calc(a, b):
	if a == b:
		return 0
	elif a < b:
		return calc2(b, a)
	elif a > b:
		return calc2(a, b)
tests = int(input())
for i in range(tests):
	vols = input()
	volar = vols.split(' ')
	a = int(volar[0])
	b = int(volar[1])
	print(calc(a, b))


import sys

def rint():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().rstrip('\n')

def oint():
	return int(input())
t = oint()
for _ in range(t):
	(a, b) = rint()
	diff = b - a
	if diff < 0:
		diff = -1 * diff
	if diff % 5 == 0:
		print(diff // 5)
	elif diff % 5 == 4:
		print(diff // 5 + 2)
	elif diff % 5 == 3:
		print(diff // 5 + 2)
	elif diff % 5 == 2:
		print(diff // 5 + 1)
	elif diff % 5 == 1:
		print(diff // 5 + 1)


t = int(input())
for w in range(t):
	(a, b) = [int(i) for i in input().split()]
	ans = 0
	dif = max(a, b) - min(a, b)
	while dif > 0:
		if dif % 5 == 0:
			ans += dif // 5
			dif -= ans * 5
		if (dif - 1) % 5 == 0:
			ans += 1
			dif -= 1
		else:
			while dif % 5 != 0:
				dif -= 2
				ans += 1
				if (dif - 1) % 5 == 0:
					dif -= 1
					ans += 1
					break
	print(ans)


T = int(input())

def solve(a, b):
	if a == b:
		return 0
	x = [-5, -2, -1, 1, 2, 5]
	d = b - a
	n = 0
	if d in x:
		return 1
	else:
		if d < 0:
			d = abs(d)
		return d // 5 + d % 5 // 2 + d % 5 % 2
for _ in range(T):
	(a, b) = [int(i) for i in input().split()]
	print(solve(a, b))


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

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

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

def string_list():
	return list(input())

def solve():
	(a, b) = num_input()
	diff = abs(a - b)
	press = 0
	if diff == 0:
		print(0)
	elif diff == 1 or diff == 2 or diff == 5:
		print(1)
	elif diff < 5:
		print(2)
	else:
		press = diff // 5
		diff -= press * 5
		if diff >= 2:
			temp = diff // 2
			press += temp
			diff -= temp * 2
		if diff == 1:
			press += 1
		print(press)
t = int(input())
for _ in range(t):
	solve()


t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	if b > a:
		temp = b
		b = a
		a = temp
	a = a - b
	count = 0
	while a != 0:
		if a >= 5:
			t1 = a
			a = a % 5
			count += int(t1 / 5)
		if a >= 2:
			t2 = a
			a = a % 2
			count += int(t2 / 2)
		if a == 1:
			t3 = a
			a = a - 1
			count += int(t3)
	print(count)


a1 = []
n1 = int(input())
n = 0
for i in range(n1):
	(a, b) = map(int, input().split())
	n = int(abs(b - a) / 5)
	if abs(b - a) % 5 != 0:
		if abs(b - a) % 5 <= 2:
			n = n + 1
		else:
			n = n + 2
	a1.append(n)
for i in range(n1):
	print(a1[i])


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	print(abs(a - b) // 5 + abs(a - b) % 5 // 2 + abs(a - b) % 5 % 2 // 1)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	c = 0
	e = abs(x - y)
	while e != 0:
		if e >= 5:
			c += e // 5
			e %= 5
		elif e >= 2:
			c += e // 2
			e %= 2
		else:
			c += e // 1
			e %= 1
	print(c)


n = eval(input())
i = 0
c = 0
a = b = 0
while i < n:
	(x, y) = input().split()
	(x, y) = (eval(x), eval(y))
	if x < y:
		b = (y - x) % 5
		a = b // 2
		c = (y - x) // 5 + a + b % 2
		print(c)
	elif y < x:
		b = (x - y) % 5
		a = b // 2
		c = (x - y) // 5 + a + b % 2
		print(c)
	else:
		print('0')
	c = b = a = 0
	i += 1


t = int(input())
while t:
	(a, b) = map(int, input().split())
	t -= 1
	res = abs(a - b)
	count = 0
	while res:
		if res >= 5:
			if res % 5 is 0:
				count += res / 5
				res = 0
			else:
				count += res // 5
				res = res % 5
		elif res >= 2:
			if res % 2 is 0:
				count += res / 2
				res = 0
			else:
				count += res // 2
				res = res % 2
		else:
			count += res
			res = 0
	print(int(count))


import sys
input = lambda : sys.stdin.readline().strip()
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	c = 0
	s = diff
	c += s // 5
	s -= s // 5 * 5
	c += s // 2
	s -= s // 2 * 2
	c += s
	print(c)


for i in range(int(input())):
	(a, b) = (int(x) for x in input().split())
	x = abs(a - b)
	res = x // 5
	x = x % 5
	if x == 0:
		pass
	elif x == 1 or x == 2:
		res += 1
	else:
		res += 2
	print(res)


def main():
	t = int(input())
	for i in range(t):
		(a, b) = list(map(int, input().split(' ')))
		ans = 0
		if a == b:
			print(ans)
		elif a < b:
			d = b - a
			while d != 0:
				if d >= 5:
					ans = ans + int(d / 5)
					d = d % 5
				elif d >= 2:
					ans = ans + int(d / 2)
					d = d % 2
				elif d >= 1:
					ans = ans + int(d / 1)
					d = d % 1
			print(ans)
		else:
			d = a - b
			while d != 0:
				if d >= 5:
					ans = ans + int(d / 5)
					d = d % 5
				elif d >= 2:
					ans = ans + int(d / 2)
					d = d % 2
				elif d >= 1:
					ans = ans + int(d / 1)
					d = d % 1
			print(ans)
main()


T = input('')
T = int(T)
outs = []
for i in range(T):
	In = input('')
	In = In.split()
	a = int(In[0])
	b = int(In[1])
	trials = 0
	if a > b:
		if a - b >= 5:
			(const, rem) = divmod(a - b, 5)
			if rem == 4 or rem == 3:
				trials += const + 2
			elif rem != 0:
				trials += const + 1
			else:
				trials += const
		elif a - b >= 2 and a - b < 5:
			(const, rem) = divmod(a - b, 2)
			trials += const + rem
		elif a - b == 1:
			trials += 1
	elif b > a:
		if b - a >= 5:
			(const, rem) = divmod(b - a, 5)
			if rem == 4 or rem == 3:
				trials += const + 2
			elif rem != 0:
				trials += const + 1
			else:
				trials += const
		elif b - a >= 2 and b - a < 5:
			(const, rem) = divmod(b - a, 2)
			trials += const + rem
		elif b - a == 1:
			trials += 1
	outs.append(trials)
for i in range(T):
	print(outs[i])


import math
n = int(input())
for i in range(n):
	l = list(map(int, input().split()))
	(a, b) = (l[0], l[1])
	d = int(math.fabs(a - b))
	if d % 5 == 0:
		print(d // 5)
	elif d % 5 == 1:
		print(d // 5 + 1)
	elif d % 5 == 2:
		print(d // 5 + 1)
	elif d % 5 == 3:
		print(d // 5 + 2)
	elif d % 5 == 4:
		print(d // 5 + 2)


tcase = int(input())
for i in range(tcase):
	(a, b) = [int(x) for x in input().split(' ')]
	sum_ = abs(b - a)
	cnt = 0
	cnt = 2 * int(sum_ / 10)
	sum_ = sum_ % 10
	tmp_sum = 0
	for i in [5, 2, 1]:
		while True:
			if tmp_sum > sum_:
				tmp_sum = tmp_sum - i
				cnt -= 1
				break
			tmp_sum += i
			cnt += 1
	print(cnt)


n = int(input())
for i in range(0, n):
	p = input().rstrip().split(' ')
	a = int(p[0])
	b = int(p[1])
	if a == b:
		print(0)
	elif b > a or b < a:
		T = abs(b - a)
		G = 0
		while T >= 5:
			a = T // 5
			G += a
			T = T - a * 5
			break
		while T >= 2:
			a = T // 2
			G += a
			T -= a * 2
			break
		G += T
		print(G)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		aux = a
		a = b
		b = aux
	t5 = (b - a) // 5
	a += t5 * 5
	t2 = (b - a) // 2
	a += t2 * 2
	t1 = (b - a) // 1
	a += t1 * 1
	print(t1 + t2 + t5)


a = int(input())
for i in range(0, a):
	(a, b) = map(int, input().split())
	ans = abs(a - b) // 5
	pans = abs(a - b) % 5
	if pans == 1:
		ans = ans + 1
	if pans == 2:
		ans = ans + 1
	if pans == 3:
		ans = ans + 2
	if pans == 4:
		ans = ans + 2
	print(ans)


num = int(input())
volumes = [5, 2, 1]
for _ in range(num):
	a_b = list(map(int, input().split()))
	temp = max(a_b) - min(a_b)
	cont = 0
	while temp > 0:
		for vols in volumes:
			div = temp // vols
			if div > 0:
				temp = temp - vols * div
				cont += div
	print(cont)


for _ in range(int(input())):
	(a, b) = map(int, input().strip().split())
	d = abs(a - b)
	s = d // 5
	if d % 5 == 0:
		print(s)
	elif d % 5 == 4 or d % 5 == 3:
		print(s + 2)
	elif d % 5 == 1 or d % 5 == 2:
		print(s + 1)


for i in range(int(input())):
	(ini, fin) = map(int, input().split())
	diff = abs(ini - fin)
	cnt = diff // 5
	diff %= 5
	cnt += diff // 2
	cnt += diff % 2
	print(cnt)


for _ in range(int(input())):
	count = 0
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	jfdkfd = diff // 5
	count += jfdkfd
	diff -= jfdkfd * 5
	jfdkfd = diff // 2
	count += jfdkfd
	diff -= jfdkfd * 2
	jfdkfd = diff // 1
	count += jfdkfd
	diff -= jfdkfd * 1
	print(count)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	s = abs(a - b)
	lst = [5, 2, 1]
	i = 0
	cnt = 0
	while s != 0:
		cnt += s // lst[i]
		s = s % lst[i]
		i += 1
	print(cnt)


t = int(input())
count = 0
ans = []
while count < t:
	v = input()
	(a, b) = v.split()
	dif = abs(int(b) - int(a))
	time = 0
	num = dif // 5
	time += num
	dif -= num * 5
	num = dif // 2
	time += num
	dif -= num * 2
	num = dif // 1
	time += num
	ans.append(time)
	count += 1
for y in ans:
	print(y)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	fun = abs(b - a)
	count = 0
	if fun >= 5:
		rem = fun % 5
		if rem > 2:
			div = fun // 5 + 1
		else:
			div = fun // 5
		fun = abs(fun - 5 * div)
		count += div
	rem = fun % 2
	if rem == 0:
		count += fun // 2
	else:
		count = count + fun // 2 + 1
	print(count)


N = int(input())
a_bs = [list(map(int, input().split())) for _ in range(N)]

def count_move(a, b):
	count = 0
	dif = b - a
	if dif > 0:
		if dif >= 5:
			d = dif // 5
			count += d
			dif -= 5 * d
		if dif >= 2:
			d = dif // 2
			count += d
			dif -= 2 * d
		if dif >= 1:
			d = dif
			count += d
			dif -= d
	if dif < 0:
		if dif <= -5:
			d = abs(dif) // 5
			count += d
			dif += 5 * d
		if dif <= -2:
			d = abs(dif) // 2
			count += d
			dif += 2 * d
		if dif <= -1:
			count += abs(dif)
			dif += abs(dif)
	if dif == 0:
		return count
for (a, b) in a_bs:
	print(count_move(a, b))


import math

def kq(a, b):
	mydict = {0: 0, 1: 1, 2: 1, 3: 2, 4: 2}
	r = max(a, b) - min(a, b)
	return r // 5 + mydict[r % 5]
q = int(input())
for i in range(0, q):
	s = input()
	b = s.split(' ')
	x = int(b[0])
	y = int(b[1])
	print(kq(x, y))


c = int(input())
d = 0
while d != c:

	def lol():
		(ip1, ip2) = map(int, input().split())
		temp1 = abs(ip2 - ip1)
		temp2 = int(temp1 / 5)
		temp3 = temp1 % 5
		if temp3 == 0:
			print(temp2)
			return
		temp2 = temp2 + int(temp3 / 2)
		temp5 = temp3 % 2
		if temp5 == 0:
			print(temp2)
			return
		temp4 = temp2 + int(temp5 / 1)
		print(temp4)
	lol()
	d += 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		x = a - b
		x5 = x // 5
		x55 = x % 5
		x2 = x55 // 2
		x = x55 % 2
		print(x5 + x2 + x)
	elif b > a:
		x = b - a
		x5 = x // 5
		x55 = x % 5
		x2 = x55 // 2
		x = x55 % 2
		print(x5 + x2 + x)
	else:
		print(0)


T = int(input())
q = [''] * T
for i in range(T):
	ind = 0
	(a, b) = map(int, input().split())
	n = abs(a - b)
	ind += n // 5
	n = n % 5
	ind += n // 2
	n = n % 2
	ind += n // 1
	n = n % 1
	q[i] = ind
for i in range(T):
	print(q[i])


T = int(input())
for i in range(T):
	(a, b) = list(map(int, input().split(' ')))
	d = abs(a - b)
	print(int(d / 5) + int(d % 5 / 2) + d % 5 % 2)


t = int(input())
for q in range(t):
	(a, b) = map(int, input().split())
	r = abs(a - b)
	k = 0
	if r >= 5:
		k = r // 5
		r -= r // 5 * 5
	if r >= 2:
		k += r // 2
		r -= r // 2 * 2
	if r >= 1:
		k += r // 1
	print(k)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().strip().split(' '))
	s = 0
	if a > b:
		c = a - b
	else:
		c = b - a
	d = c // 5
	e = c % 5
	f = e // 2
	g = e % 2
	s = d + f + g
	print(s)


T = int(input())
L = []
for i in range(T):
	[a, b] = [int(x) for x in input().split()]
	d = abs(a - b)
	f = d // 5
	t = (d - 5 * f) // 2
	o = d - 5 * f - 2 * t
	print(f + t + o)


exec(int(input()) * 'a,b=map(int,input().split());c=abs(a-b);print(c//5-(c%5//-2));')


T = int(input())
for i in range(T):
	count = 0
	(a, b) = list(map(int, input().split()))
	if a > b:
		s = a - b
		if s >= 5:
			count += s // 5
			s = s % 5
		if s >= 2:
			count += s // 2
			s = s % 2
		if s >= 1:
			count += s
		print(count)
	if a < b:
		s = b - a
		if s >= 5:
			count += s // 5
			s = s % 5
		if s >= 2:
			count += s // 2
			s = s % 2
		if s >= 1:
			count += s
		print(count)
	if a == b:
		print(0)


t = int(input())
while t:
	t -= 1
	ans = 0
	(a, b) = map(int, input().split())
	c = abs(a - b)
	if c >= 5:
		ans += c // 5
		c = c % 5
	if c >= 2:
		ans += c // 2
		c = c % 2
	print(ans + c)


for t in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print('0')
	elif a < b:
		rem1 = (b - a) % 5
		cnt = 0
		cnt += (b - a) // 5
		rem2 = rem1 % 2
		cnt += rem1 // 2
		cnt += rem2
		print(cnt)
	else:
		rem1 = (a - b) % 5
		cnt = 0
		cnt += (a - b) // 5
		rem2 = rem1 % 2
		cnt += rem1 // 2
		cnt += rem2
		print(cnt)


from collections import Counter
from collections import defaultdict
import math
import bisect
t = int(input())
for _ in range(0, t):
	(a, b) = list(map(int, input().split()))
	d = abs(a - b)
	c = 0
	f = 1
	if d % 5 == 0:
		c = c + d // 5
		d = d - 5 * (d // 5)
		f = 1
	else:
		c = c + d // 5
		d = d - 5 * (d // 5)
	if d % 2 == 0 and f == 0:
		c = c + d // 2
		d = d - 2 * (d // 2)
		break
	else:
		c = c + d // 2
		d = d - 2 * (d // 2)
	c = c + d
	print(c)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(a - b) // 5
	if abs(a - b) % 5 == 1 or abs(a - b) % 5 == 2:
		c += 1
	elif abs(a - b) % 5 == 3 or abs(a - b) % 5 == 4:
		c += 2
	print(c)


def main():
	T = int(input())
	for t in range(0, T):
		l = input().split(' ')
		diff = abs(int(l[0]) - int(l[1]))
		count = int(diff / 5)
		if diff % 5 == 4:
			count += 2
		elif diff % 5 == 3:
			count += 2
		elif diff % 5 == 2:
			count += 1
		elif diff % 5 == 1:
			count += 1
		print(str(count))
main()


for i in range(int(input())):
	(a, b) = list(map(int, input().split(' ', 1)))
	diff = abs(a - b)
	ans = 0
	for j in [5, 2, 1]:
		ans += diff // j
		diff %= j
	print(ans)


for tt in range(int(input())):
	(a, b) = map(int, input().split())
	c = 0
	diff = abs(a - b)
	q = diff // 5
	diff = diff % 5
	c = c + q
	q = diff // 2
	diff = diff % 2
	c = c + q
	q = diff // 1
	diff = diff % 1
	c = c + q
	print(c)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	press = 0
	diff = abs(b - a)
	a1 = diff // 5
	a2 = a1 + 1
	diff1 = diff - 5 * a1
	diff2 = a2 * 5 - diff
	x1 = diff1 // 2
	x2 = diff2 // 2
	t1 = diff1 % 2
	t2 = diff2 % 2
	res1 = a1 + x1 + t1
	res2 = a2 + x2 + t2
	print(min(res1, res2))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().strip().split())
	x = abs(a - b)
	ans = x // 5
	x = x % 5
	ans += x // 2
	x = x % 2
	ans += x
	print(ans)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	x = abs(a - b)
	cnt = 0
	cnt += x // 5
	x = x % 5
	cnt += x // 2
	x = x % 2
	cnt += x // 1
	print(cnt)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = 0
	if a != b:
		if a < b:
			b -= a
			if b >= 5:
				c += b // 5
				b = b % 5
			if b == 3 or b == 4:
				c += 2
			elif b == 1 or b == 2:
				c += 1
		else:
			a -= b
			if a >= 5:
				c += a // 5
				a = a % 5
			if a == 3 or a == 4:
				c += 2
			elif a == 1 or a == 2:
				c += 1
	print(c)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(x, y) = (min(a, b), max(a, b))
	diff = y - x
	res = 0
	c = 0
	grab = 0
	while diff:
		if diff >= 5:
			res = diff // 5
			if res:
				c += res
			diff = diff - res * 5
		if diff >= 2:
			res = diff // 2
			if res:
				c += res
			diff = diff - res * 2
		if diff >= 1:
			res = diff // 1
			if res:
				c += res
			diff = diff - res * 1
	print(c)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	t = abs(a - b) // 5
	add = abs(a - b) % 5
	if add == 0:
		print(t)
		continue
	if add <= 2:
		print(t + 1)
		continue
	if add == 3:
		print(t + 2)
		continue
	if add == 4:
		print(t + 2)


from sys import stdin
t = int(stdin.readline())
while t:
	(a, b) = map(int, stdin.readline().split())
	d = abs(a - b)
	(x, y) = divmod(d, 5)
	(m, n) = divmod(y, 2)
	print(x + m + n)
	t -= 1


a = int(input())
for i in range(a):
	(x, y) = map(int, input().split(' '))
	if x == y:
		print('0')
	else:
		r = abs(x - y)
		count = 0
		count = count + r // 5
		t = r % 5
		count = count + t // 2 + t % 2
		print(count)


T = int(input())
for i in range(T):
	(a, b) = map(int, input().strip().split())
	x = abs(a - b)
	s = 0
	s += x // 5
	x = x % 5
	s += x // 2
	s += x % 2
	print(s)


def solve(l):
	d = [5, 2, 1]
	i = [5, 2, 1]
	current = l[0]
	target = l[1]
	remain = 0
	counter = 0
	if current > target:
		(current, target) = (target, current)
	if abs(target - current) >= 5:
		remain += abs(target - current) % 5
		counter += abs(target - current) // 5
		current += 5 * counter
	if current < target:
		j = 0
		while current < target:
			if current + i[j] <= target:
				current += i[j]
				counter += 1
				j = 0
			else:
				j += 1
	else:
		j = 0
		while current > target:
			if current - d[j] >= target:
				current -= d[j]
				counter += 1
				j = 0
			else:
				j += 1
	print(counter)

def main():
	for i in range(int(input())):
		solve([int(x) for x in input().split()])
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	a = abs(a - b)
	c = 0
	while a != 0:
		if a >= 5:
			c += a // 5
			a = a % 5
		elif a >= 2:
			a -= 2
			c += 1
		else:
			a -= 1
			c += 1
	print(c)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	diff = abs(a - b)
	x1 = diff // 5
	x2 = (diff - 5 * x1) // 2
	x3 = diff - 5 * x1 - 2 * x2
	print(x1 + x2 + x3)


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	ans = 0
	for i in [5, 2, 1]:
		ans += diff // i
		diff %= i
	print(ans)
	t -= 1


for i in range(int(input())):
	(a, b) = map(int, input().split())
	sum = 0
	x = abs(a - b)
	if x % 5 == 1 or x % 5 == 2:
		sum += x // 5 + 1
	elif x % 5 == 3 or x % 5 == 4:
		sum += x // 5 + 2
	elif x % 5 == 0:
		sum += x // 5
	print(sum)


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	(A, B) = map(int, input().split())
	Query.append((A, B))
for (A, B) in Query:
	delta = abs(B - A)
	ans = delta // 5
	am = delta % 5
	if am == 3 or am == 4:
		ans += 2
	elif am == 1 or am == 2:
		ans += 1
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = 0
	if a == b:
		print(0)
	elif a < b:
		while a != b:
			c += (b - a) // 5
			a += 5 * ((b - a) // 5)
			if a == b:
				print(c)
				break
			elif a < b:
				k = (b - a) // 2
				a += 2 * k
				c += k
				if a == b:
					print(c)
					break
				else:
					c += b - a
					print(c)
					break
			else:
				k = (a - b) // 5
				a -= k * 5
				c += k
				if a == b:
					print(c)
					break
				else:
					k = (a - b) // 2
					a -= k * 2
					c += k
					if a == b:
						print(c)
						break
					else:
						c += a - b
						print(c)
						break
	else:
		while a != b:
			k = (a - b) // 5
			a -= k * 5
			c += k
			if a == b:
				print(c)
				break
			elif a > b:
				k = (a - b) // 2
				a -= k * 2
				c += k
				if a == b:
					print(c)
					break
				elif a < b:
					k = (b - a) // 2
					a += 2 * k
					c += k
					if a == b:
						print(c)
						break
					else:
						c += b - a
						print(c)
						break
				else:
					c += a - b
					print(c)
					break
			else:
				k = (b - a) // 5
				a += k * 5
				c += k
				if a == b:
					print(c)
					break
				elif a > b:
					k = (a - b) // 5
					a -= k * 5
					c += k
					if a == b:
						print(c)
						break
					else:
						k = (a - b) // 2
						a -= k * 2
						c += k
						if a == b:
							print(c)
							break
						else:
							c += a - b
							print(c)
							break
				else:
					k = (b - a) // 2
					a += k * 2
					c += k
					if a == b:
						print(c)
						break
					else:
						k = b - a
						c += k
						print(c)
						break


import math
results = list()
n = int(input(''))
for i in range(n):
	(a, b) = map(int, input().split(' '))
	count_step = 0
	if a == b:
		count_step = 0
	elif a > b:
		z1 = a - b
		count_of_needed_5 = math.floor(z1 / 5)
		z1 = z1 - count_of_needed_5 * 5
		count_of_needed_2 = math.floor(z1 / 2)
		z1 = z1 - count_of_needed_2 * 2
		count_of_needed_1 = math.floor(z1 / 1)
		count_step = count_of_needed_5 + count_of_needed_2 + count_of_needed_1
	else:
		z1 = b - a
		count_of_needed_5 = math.floor(z1 / 5)
		z1 = z1 - count_of_needed_5 * 5
		count_of_needed_2 = math.floor(z1 / 2)
		z1 = z1 - count_of_needed_2 * 2
		count_of_needed_1 = math.floor(z1 / 1)
		count_step = count_of_needed_5 + count_of_needed_2 + count_of_needed_1
	results.append(count_step)
for result in results:
	print(result)


import sys
raw_data = sys.stdin.readlines()
testcases = raw_data.pop(0)

def moving(case):
	current_case = case.split()
	a = int(current_case[0])
	b = int(current_case[1])
	counter = abs(b - a) // 5
	a = b + abs(b - a) % 5
	while a != b:
		if a - b >= 5:
			a -= 5
		elif a - b >= 2:
			a -= 2
		else:
			a -= 1
		counter += 1
	print(counter)
for i in raw_data:
	moving(i)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	ans = 0
	if c % 5 == 0:
		ans += c // 5
	else:
		ans += c // 5
		c = c % 5
		if c % 2 == 0:
			ans += c // 2
		else:
			ans += c // 2 + c % 2
	print(ans)


t = int(input())
while t > 0:
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	c = 0
	x = 0
	rem = 0
	rem2 = 0
	rem3 = 0
	if a > b:
		x = a - b
	if b > a:
		x = b - a
	if x >= 5:
		c = c + x // 5
		rem = x % 5
		if rem >= 2:
			c = c + rem // 2
			rem2 = rem % 2
			c = c + rem2
		else:
			c = c + rem
	elif x >= 2:
		c = c + x // 2
		rem3 = x % 2
		c += rem3
	else:
		c = c + x
	print(c)
	t = t - 1


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	c = b - a
	r = 0
	r += c // 5
	p = c % 5
	if p == 1 or p == 2:
		r += 1
	elif p > 2:
		r += 2
	print(r)


t = int(input())
while t > 0:
	t -= 1
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	h = 0
	if a > b:
		k = a - b
		if k >= 5:
			p = k % 5
			h = k // 5
			if p == 0:
				h = h + 0
			elif p == 1:
				h = h + 1
			elif p == 2:
				h = h + 1
			elif p == 3:
				h = h + 2
			else:
				h = h + 2
		elif k < 5 and k >= 2:
			p = k % 2
			h = k // 2
			if p == 0:
				h = h + 0
			elif p == 1:
				h = h + 1
		else:
			h = 1
	elif b > a:
		k = b - a
		if k >= 5:
			p = k % 5
			h = k // 5
			if p == 0:
				h = h + 0
			elif p == 1:
				h = h + 1
			elif p == 2:
				h = h + 1
			elif p == 3:
				h = h + 2
			else:
				h = h + 2
		elif k >= 2 and k < 5:
			p = k % 2
			h = k // 2
			if p == 0:
				h = h + 0
			elif p == 1:
				h = h + 1
		else:
			h = 1
	else:
		h = 0
	print(h)


cases = int(input())
for i in range(cases):
	count = 0
	(a, b) = map(int, input().split())
	des = abs(b - a)
	res = des % 5
	count = des // 5
	if res == 1 or res == 2:
		count += 1
	if res == 3 or res == 4:
		count += 2
	print(count)


import math as mm
for tc in range(int(input())):
	(a, b) = map(int, input().split())
	x = mm.floor(abs(a - b) / 5)
	xx = abs(a - b) % 5
	y = mm.floor(xx / 2)
	yy = xx % 2
	print(x + y + yy)


t = int(input())
sol = []
for i in range(t):
	s = input()
	s = s.split()
	a = int(s[0])
	b = int(s[1])
	s = abs(a - b)
	if s == 0:
		sol.append(0)
		continue
	else:
		sol.append(s // 5 + s % 5 // 2 + s % 5 % 2)
for i in sol:
	print(i)


q = int(input())
for i in range(q):
	(a, b) = (int(i) for i in input().split())
	if a > b:
		(a, b) = (b, a)
	elif a == b:
		print(0)
		continue
	b -= a
	five = b // 5
	b -= five * 5
	two = b // 2
	b -= two * 2
	one = b
	print(five + two + one)


import sys
from collections import deque
ip = lambda : sys.stdin.readline().rstrip()
for _ in range(int(ip())):
	(a, b) = map(int, ip().split())
	if a == b:
		print(0)
		continue
	if a > b:
		(a, b) = (b, a)
	v = b - a
	ans = 0
	if v >= 5:
		rem = v % 5
		ans += rem // 2 + (1 if rem % 2 else 0)
		ans += v // 5
	else:
		ans += v // 2 + (1 if v % 2 else 0)
	print(ans)


def evaluate(pairs):
	global e
	result = []
	for i in pairs:
		diff = abs(i[0] - i[1])
		result.append(diff // 5 + e[diff % 5])
	for i in result:
		print(i)
data = int(input())
pairs = []
while data > 0:
	pairs.append(tuple(map(int, input().split())))
	data -= 1
e = [0, 1, 1, 2, 2]
evaluate(pairs)


a = int(input())
for i in range(a):
	(b, c) = map(int, input().split())
	g = abs(c - b)
	if 0 < g % 5 < 3:
		print(g // 5 + 1)
	elif g % 5 > 2:
		print(g // 5 + 2)
	else:
		print(g // 5)


q = int(input())
m = []
for i in range(q):
	m1 = list(map(int, input().split()))
	m.append(m1)
for i in range(q):
	a = m[i][0]
	b = m[i][1]
	x = abs(a - b)
	print(x // 5 + x % 5 // 2 + x % 5 % 2)


for i in range(int(input())):
	(t, e) = map(int, input().split())
	if t == e:
		print(0)
	else:
		n = e - t
		if n > 0:
			m = n % 5
			p = (n - m) // 5
			k = m % 2
			j = (m - k) // 2
			l = k % 1
			u = (k - l) // 1
			print(p + j + u)
		else:
			m = n % -5
			p = (n - m) // -5
			k = m % -2
			j = (m - k) // -2
			l = k % -1
			u = (k - l) // -1
			print(p + j + u)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	dif = abs(a - b)
	ans = dif // 5
	dif = dif % 5
	ans += dif // 2
	dif %= 2
	ans += dif
	print(ans)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = max(a, b)
	b = min(a, b)
	li = [1, 2, 5]
	y = 0
	if x == b:
		print(0)
	elif x - b in li:
		print(1)
	elif x - b > 5:
		y = math.floor((x - b) / 5)
		if (x - b) % 5 != 0:
			z = (x - b) % 5
			if z == 4 or z == 3:
				print(y + 2)
			else:
				print(y + 1)
		else:
			print(y)
	elif x - b > 2:
		print(2)
	else:
		print(1)


t = int(input().strip())
for i in range(t):
	(a, b) = map(int, input().strip().split())
	d = abs(a - b)
	if d == 0:
		print(0)
	elif d % 5 == 0:
		print(d // 5)
	elif d % 5 == 3 or d % 5 == 4:
		print(d // 5 + 2)
	else:
		print(d // 5 + 1)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	d = abs(b - a)
	x = d // 5
	if d % 5 == 0:
		print(x)
	elif d % 5 == 1 or d % 5 == 2:
		print(x + 1)
	elif d % 5 == 3 or d % 5 == 4:
		print(x + 2)


t = int(input())
B = []

def _244():
	if k % 5 == 0:
		B.append(k // 5)
	if k % 10 == 1 or k % 10 == 2:
		B.append(1 + k // 5)
	if k % 10 == 3 or k % 10 == 4:
		B.append(2 + k // 5)
	if k % 10 == 6 or k % 10 == 7:
		B.append(1 + k // 5)
	if k % 10 == 8 or k % 10 == 9:
		B.append(2 + k // 5)
for i in range(t):
	(a, b) = map(int, input().split())
	k = abs(a - b)
	_244()
for i in range(len(B)):
	print(B[i])


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	if diff:
		moves = diff // 5
		diff = diff % 5
		moves += diff // 2
		diff = diff % 2
		print(moves + diff)
	else:
		print(0)


for i in range(0, int(input())):
	(a, b) = list(map(int, input().split()))
	(a, b) = (min(a, b), max(a, b))
	c = 0
	while a != b:
		if b - a == 1 or b - a == 2 or b - a == -1 or (b - a == -2):
			c = c + 1
			b = a
		elif b - a == 3 or b - a == 4 or b - a == -3 or (b - a == -4):
			c = c + 2
			b = a
		else:
			r = (b - a) // 5
			a = a + (b - a) // 5 * 5
			c = c + r
	print(c)


import math
case = int(input())
for caseNum in range(0, case):
	(a, b) = [int(x) for x in input().split()]
	diff = abs(b - a)
	m_diff = diff % 5
	if m_diff == 0:
		addition = 0
	elif m_diff == 1 or m_diff == 2:
		addition = 1
	else:
		addition = 2
	print(math.floor(diff / 5) + addition)


import os
q = int(input())
for case in range(q):
	(a, b) = list(map(int, input().split(' ')))
	d = abs(b - a)
	a1 = int(d / 5)
	d -= a1 * 5
	a2 = int(d / 2)
	d -= a2 * 2
	print(a1 + a2 + d)


from math import floor, ceil
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	ans = 0
	ans += floor(diff / 5)
	diff %= 5
	ans += floor(diff / 2)
	diff %= 2
	ans += diff
	print(ans)


volume = [-5, -2, -1, 1, 2, 5]
for i in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	rem = diff % 5
	quo = diff // 5
	if rem == 0:
		print(quo)
	elif rem == 1 or rem == 2:
		print(quo + 1)
	else:
		print(quo + 2)


for u in range(int(input())):
	(x, y) = map(int, input().split())
	z = abs(x - y)
	c = 0
	c = c + z // 5
	z = z % 5
	c = c + z // 2
	z = z % 2
	c = c + z
	print(c)


for i in range(int(input())):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	diff = abs(x - y)
	ans = 0
	if diff >= 5:
		ans = diff // 5
		diff = diff - ans * 5
	if diff >= 2:
		x = diff // 2
		diff = diff - x * 2
		ans = ans + x
	if diff != 0:
		ans = ans + diff
	print(ans)


for i in range(int(input())):
	(a, b) = [int(num) for num in input().split()]
	c = 0
	c1 = 0
	r = 0
	r1 = 0
	if a == b:
		print(0)
	elif a > b:
		if a - b >= 5:
			c = (a - b) // 5
			r = (a - b) % 5
			if r >= 2:
				c1 = r // 2
				r1 = r % 2
				print(c + c1 + r1)
				continue
			else:
				print(c + r)
				continue
		elif a - b >= 2 and a - b < 5:
			c1 = (a - b) // 2
			r1 = (a - b) % 2
			print(c1 + r1)
			continue
		else:
			print(a - b)
			continue
	elif b - a >= 5:
		c = (b - a) // 5
		r = (b - a) % 5
		if r >= 2:
			c1 = r // 2
			r1 = r % 2
			print(c + c1 + r1)
			continue
		else:
			print(c + r)
			continue
	elif b - a >= 2 and b - a < 5:
		c1 = (b - a) // 2
		r1 = (b - a) % 2
		print(c1 + r1)
		continue
	else:
		print(b - a)
		continue


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [Scanner.string() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [Scanner.int() for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	(A, B) = Scanner.map_int()
	print(abs(B - A) // 5 + [0, 1, 1, 2, 2][abs(B - A) % 5])

def main():
	T = Scanner.int()
	for _ in range(T):
		solve()
main()


import sys
n = int(sys.stdin.readline())
for _ in range(n):
	(a, b) = [int(x) for x in input().strip().split()]
	if a == b:
		print(0)
	else:
		data = abs(b - a)
		counter_five = data // 5
		result = 0
		result += counter_five
		data -= counter_five * 5
		counter_two = data // 2
		result += counter_two
		data -= counter_two * 2
		result += data
		print(result)


T = int(input())
while T:
	T -= 1
	(a, b) = map(int, input().split())
	dist = abs(b - a)
	count = dist // 5
	dist = dist % 5
	count += dist // 2 + dist % 2
	print(count)


gi = lambda : list(map(int, input().split()))
for j in range(gi()[0]):
	(a, b) = gi()
	d = abs(a - b)
	print(d // 5 + d % 5 // 2 + d % 5 % 2)


n = int(input())
situations = []
while n > 0:
	sit = list(map(int, input().split()))
	situations.append(sit)
	n -= 1
list_values = [-5, -2, -1, 1, 2, 5]
solve = []
for s in situations:
	(a, b) = s
	if a == b:
		solve.append(0)
	else:
		check = abs(b - a)
		if check in list_values:
			solve.append(1)
		else:
			x = check // 5
			y = (check - x * 5) // 2
			z = check - x * 5 - y * 2
			sum1 = x + y + z
			solve.append(sum1)
for q in solve:
	print(q)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ch = abs(a - b)
	ans1 = ch // 5
	ch -= ans1 * 5
	ans2 = ch // 2
	ch -= ans2 * 2
	ans3 = ch
	print(ans1 + ans2 + ans3)


t = int(input())
for _ in range(t):
	(a, b) = [int(x) for x in input().split(' ')]
	val = abs(b - a)
	btn = 0
	btn += val // 5
	val %= 5
	btn += val // 2
	val %= 2
	btn += val
	print(btn)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	d = 0
	if a > b:
		c = a - b
	else:
		c = b - a
	if c % 5 >= 0:
		d = c // 5
		c = c - 5 * d
	if c % 2 >= 0 and c > 0:
		d += c // 2
		c -= 2 * (c // 2)
	if c % 1 == 0 and c > 0:
		d += c
	print(d)


for _ in range(int(input())):
	(current_vol, needed_vol) = map(int, input().split())
	delta = abs(current_vol - needed_vol)
	cnt = 0
	cnt += delta // 5
	delta %= 5
	while delta >= 2:
		cnt += 1
		delta -= 2
	while delta >= 1:
		cnt += 1
		delta -= 1
	print(cnt)


k = int(input())
ans = []
for i in range(k):
	(a, b) = map(int, input().split())
	t = abs(a - b)
	c = 0
	c += t // 5
	t %= 5
	c += t // 2
	t %= 2
	c += t
	ans.append(c)
print(*ans, sep='\n')


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	diff = max(a, b) - min(a, b)
	out = 0
	out1 = diff // 5
	diff -= out1 * 5
	out2 = diff // 2
	diff -= out2 * 2
	out = diff + out1 + out2
	print(out)


import os
import sys
from io import BytesIO, IOBase
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')
testcases = int(input())
for j in range(testcases):
	(a, b) = map(int, input().split())
	maxy = max(a, b)
	minny = min(a, b)
	moves = 0
	diff = maxy - minny
	moves += diff // 5
	diff -= diff // 5 * 5
	moves += diff // 2
	diff -= diff // 2 * 2
	moves += diff // 1 * 1
	diff -= diff // 1 * 1
	print(moves)


import collections
import functools
import heapq
n_tests = int(input())
for _ in range(n_tests):
	(a, b) = map(int, input().split())
	res = 0
	while a != b:
		if a > b:
			(a, b) = (b, a)
		if (b - a) // 5 > 0:
			temp = (b - a) // 5 * 5
			res += (b - a) // 5
			a += temp
		elif (b - a) // 2 > 0:
			temp = (b - a) // 2 * 2
			res += (b - a) // 2
			a += temp
		else:
			temp = b - a
			res += b - a
			a += temp
	print(res)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a, b) = sorted([a, b])
	b = b - a
	res = b // 5
	b = b % 5
	res += b // 2
	b = b % 2
	res += b
	print(res)


from collections import defaultdict as dc
import sys
import math
input = sys.stdin.readline
l = [0, 1, 1, 2, 2, 1]
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	p = abs(a - b)
	x = p // 5
	y = p % 5
	print(x + l[y])


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	(b, a) = (min(a, b), max(a, b))
	k5 = (a - b) // 5
	r = (a - b) % 5
	if r >= 3:
		print(k5 + 2)
	elif r >= 1:
		print(k5 + 1)
	else:
		print(k5)


n = int(input())
for i in range(n):
	(r, s) = map(int, input().split())
	t = abs(r - s)
	print(t // 5 + t % 5 // 2 + t % 5 % 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	clic = 0
	clic += abs(b - a) // 5 + abs(b - a) % 5 // 2 + abs(b - a) % 5 % 2
	print(clic)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	k = abs(b - a)
	result = k // 5
	k = k % 5
	if k > 0:
		if k <= 2:
			result += 1
		else:
			result += 2
	print(result)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a > b:
		ans = 0
		tem = a - b
		ans += tem // 5
		tem = tem % 5
		ans += tem // 2
		tem = tem % 2
		ans += tem
		print(ans)
	else:
		ans = 0
		tem = b - a
		ans += tem // 5
		tem = tem % 5
		ans += tem // 2
		tem = tem % 2
		ans += tem
		print(ans)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	ans = d // 5
	d %= 5
	if d > 0 and d < 3:
		ans += 1
	elif d > 0:
		ans += 2
	print(ans)


n = int(input())
i = 0
while i < n:
	(a, b) = [int(a) for a in input().split()]
	ans = 0
	if abs(a - b) >= 5:
		p = int(abs(a - b) / 5)
		if a > b:
			a -= p * 5
		else:
			a += p * 5
		ans += p
	if abs(a - b) > 2:
		ans += 2
	elif abs(a - b) > 0:
		ans += 1
	print(ans)
	i += 1


def main():
	T = int(input())
	for _ in range(0, T):
		(a, b) = map(int, input().split())
		x = abs(a - b)
		ans = x // 5 + x % 5 // 2 + x % 5 % 2
		print(ans)
	pass
main()


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	target = abs(a - b)
	res = 0
	res += target // 5
	target = target % 5
	res += target // 2
	target = target % 2
	res += target // 1
	target = target % 1
	print(res)


import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	k = abs(a - b)
	print(k // 5 + math.ceil(k % 5 / 2))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	arr = [1, 1, 2, 2]
	ext = abs(b - a) // 5
	diff = abs(b - a) % 5
	if diff == 0:
		print(0 + ext)
	else:
		print(arr[diff - 1] + ext)


t = int(input())
neg = [-5, -2, -1]
pos = [5, 2, 1]
for _ in range(t):
	(a, b) = map(int, input().split())
	count = 0
	diff = b - a
	if diff < 0:
		count += diff // -5
		diff = diff % -5
		count += diff // -2
		diff = diff % -2
		count += abs(diff)
	else:
		count += diff // 5
		diff = diff % 5
		count += diff // 2
		diff = diff % 2
		count += abs(diff)
	print(count)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	cnt = 0
	while 1:
		if a == b:
			print(cnt)
			break
		elif a > b:
			if abs(a - b) == 1:
				b = b + 1
				cnt += 1
			elif abs(a - b) == 2:
				b = b + 2
				cnt += 1
			elif abs(a - b) > 5:
				cnt = cnt + abs(a - b) // 5
				b = b + abs(a - b) - abs(a - b) % 5
			else:
				b = b + 5
				cnt += 1
		elif abs(a - b) == 1:
			a = a + 1
			cnt += 1
		elif abs(a - b) == 2:
			a = a + 2
			cnt += 1
		elif abs(a - b) > 5:
			cnt = cnt + abs(a - b) // 5
			a = a + abs(a - b) - abs(a - b) % 5
		else:
			a = a + 5
			cnt += 1


t = int(input())
while t > 0:
	(a, b) = [int(i) for i in input().split()]
	change = abs(b - a)
	count = 0
	if change % 5 == 0:
		count = change // 5
	else:
		count = change // 5
		change = change % 5
		if change % 2 == 0:
			count += change // 2
		else:
			count += change // 2
			change = change % 2
			if change % 1 == 0:
				count += change // 1
				change = change % 1
	print(count)
	t -= 1


for m in range(int(input())):
	ab = list(map(int, input().split()))
	presses = abs(ab[0] - ab[1]) // 5
	if abs(ab[0] - ab[1]) % 5 == 3 or abs(ab[0] - ab[1]) % 5 == 4:
		presses += 2
	elif abs(ab[0] - ab[1]) % 5 == 1 or abs(ab[0] - ab[1]) % 5 == 2:
		presses += 1
	print(presses)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	count = int()
	if a == b:
		print(0)
	else:
		c = abs(a - b)
		count = 1
		k = c // 5
		c %= 5
		k += c // 2
		c %= 2
		k += c
		print(k)


t = int(input())
while t > 0:
	t -= 1
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	p = a - b
	if p < 0:
		p = -p
	l = p // 5
	p = p - l * 5
	k = p // 2
	p = p - k * 2
	g = l + k + p
	print(g)


t = int(input())
for i in range(t):
	(a, b) = [int(i) for i in input().split()]
	if a == b:
		print(0)
	else:
		res = b - a
		if res > 0:
			add = res
		else:
			add = -1 * res
		m_1 = add // 5
		rem_1 = add - m_1 * 5
		m_2 = rem_1 // 2
		rem_2 = rem_1 - m_2 * 2
		m_3 = rem_2 // 1
		rem_3 = rem_2 - m_3
		print(m_1 + m_2 + m_3)


import sys, math
input = sys.stdin.readline

def inp():
	n = int(input())
	return n

def inlt():
	a = list(map(int, input().split()))
	return a

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	(a, b) = map(int, input().split())
	return (a, b)
t = 1
t = inp()
for tt in range(t):
	(a, b) = invr()
	q = abs(b - a)
	w = q // 5
	qw = w + q % 5 // 2 + q % 5 % 2
	print(qw)


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	d = b - a
	ans = 0
	if d >= 5:
		ans += d // 5
		d %= 5
	if d >= 2:
		ans += d // 2
		d %= 2
	if d >= 1:
		ans += d
	print(ans)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	res = c // 5
	c %= 5
	res += c // 2
	c %= 2
	res += c
	print(res)


t = int(input())
q = []
for i in range(t):
	steps = 0
	l = list(input().split())
	a = int(l[0])
	b = int(l[1])
	r = abs(a - b)
	steps += r // 5
	r = r % 5
	steps += r // 2
	r = r % 2
	steps += r // 1
	q.append(steps)
for i in q:
	print(i)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = int(pow(10, 9) + 7)
mod2 = 998244353

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

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(l()[0]):
	(a, b) = l()
	x = abs(a - b)
	ans = 0
	ans += x // 5
	x %= 5
	ans += x // 2
	x %= 2
	ans += x
	print(ans)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	x = abs(b - a)
	a = x // 5
	x -= a * 5
	b = x // 2
	x -= b * 2
	c = x // 1
	print(a + b + c)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	if a < b:
		k = (b - a) // 5
		l = (b - a) % 5
		if l == 0:
			print(k)
		elif l == 1 or l == 2:
			print(k + 1)
		else:
			print(k + 2)
	else:
		l = (a - b) // 5
		k = (a - b) % 5
		if k == 0:
			print(l)
		elif k == 1 or k == 2:
			print(l + 1)
		else:
			print(l + 2)


q = int(input())
for rew in range(q):
	(a, b) = map(int, input().split())
	wyn = 0
	wyn += abs(a - b) // 5
	if a == b:
		print(0)
	else:
		if a >= b:
			if (a - b) % 5 > 2:
				wyn += 1
			a -= wyn * 5
		else:
			if (b - a) % 5 > 2:
				wyn += 1
			a += wyn * 5
		if a == b:
			print(wyn)
		else:
			wyn += abs(a - b) // 2
			c = abs(a - b) // 2
			if a >= b:
				a -= c * 2
			else:
				a += c * 2
			if a == b:
				print(wyn)
			else:
				print(wyn + abs(a - b))


def inp():
	return map(int, input().split())
for i in range(int(input())):
	(a, b) = inp()
	(ma, mi) = (max(a, b), min(a, b))
	diff = ma - mi
	print(diff // 5 + diff % 5 // 2 + diff % 5 % 2)


n = int(input())
res = []
for i in range(n):
	res += [input().split()]
for i in range(n):
	(a, b) = (int(res[i][0]), int(res[i][1]))
	if a == b:
		print(0)
	else:
		x = abs(b - a)
		y = x % 5
		print(x // 5 - y // 2 + y)


t = int(input())
for ij in range(0, t):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	if c % 5 == 0:
		print(c // 5)
	elif c % 5 == 1 or c % 5 == 2:
		print(c // 5 + 1)
	elif c % 5 == 3 or c % 5 == 4:
		print(c // 5 + 2)


for p in range(int(input())):
	(a, b) = map(int, input().split(' '))
	if a == b:
		print(0)
		continue
	d = abs(a - b)
	c = 0
	while d > 0:
		if d >= 5:
			c += d // 5
			d = d % 5
		if d >= 2:
			c += d // 2
			d = d % 2
		if d >= 1:
			c += 1
			d = 0
	print(c)


for i in range(int(input())):
	g = o = 0
	(a, b) = map(int, input().split())
	g = abs(b - a)
	o = o + g // 5
	g = g - g // 5 * 5
	o = o + g // 2
	g = g - g // 2 * 2
	o = o + g // 1
	g = g - g // 1 * 1
	print(o)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	answer = 0
	while d > 0:
		for i in [5, 2, 1]:
			q = d // i
			answer += q
			d -= q * i
	print(answer)


t = int(input())
volumes = [list(map(int, input().split())) for _ in range(t)]
for i in range(t):
	ans = 0
	if volumes[i][0] > volumes[i][1]:
		dif = volumes[i][0] - volumes[i][1]
		if dif >= 5:
			ans += dif // 5
			dif = dif % 5
			if dif == 0:
				print(ans)
			elif dif > 2:
				ans += 2
				print(ans)
			else:
				ans += 1
				print(ans)
		elif dif > 2:
			ans += 2
			print(ans)
		elif dif == 0:
			print(ans)
		else:
			ans += 1
			print(ans)
	else:
		dif = volumes[i][1] - volumes[i][0]
		if dif >= 5:
			ans += dif // 5
			dif = dif % 5
			if dif == 0:
				print(ans)
			elif dif > 2:
				ans += 2
				print(ans)
			else:
				ans += 1
				print(ans)
		elif dif > 2:
			ans += 2
			print(ans)
		elif dif == 0:
			print(ans)
		else:
			ans += 1
			print(ans)


t = int(input())
for test in range(t):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	ans = d // 5
	x = d % 5
	ans = ans + x // 2
	y = x % 2
	ans = ans + y // 1
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in input().split(' ')]
	if a == b:
		print(0)
		continue
	difference = abs(a - b)
	first = difference // 5
	second = difference - first * 5
	print(first + second // 2 + second % 2)


for _ in '0' * int(input()):
	(a, b) = map(int, input().split())
	(m, c) = (max(a, b) - min(a, b), 0)
	for x in [5, 2, 1]:
		c += m // x
		m %= x
	print(c)


def find_min_presses(a, b):
	(a, b) = (min(a, b), max(a, b))
	press_5_times = (b - a) // 5
	new_diff = b - (a + 5 * press_5_times)
	if new_diff == 0:
		return press_5_times
	elif new_diff == 1 or new_diff == 2:
		return press_5_times + 1
	else:
		return press_5_times + 2

def read_input(flag=0):
	if flag:
		return int(input())
	return [int(i) for i in input().split()]
t = read_input(1)
for i in range(t):
	(a, b) = read_input()
	print(find_min_presses(a, b))


n = int(input())
output = []
for _ in range(n):
	(a, b) = map(int, input().split())
	ab_diff = abs(b - a)
	mod5 = ab_diff // 5
	rest = ab_diff - mod5 * 5
	rest_sum = rest // 2 + (rest - rest // 2 * 2)
	output.append(rest_sum + mod5)
for i in output:
	print(i)


m = int(input())
for i in range(0, m):
	(a, b) = list(map(int, input().split()))
	if a <= b:
		c = b - a
		if c == 0:
			print(0)
		elif c > 5:
			d = int(c % 5)
			e = int(c / 5)
			if d > 2:
				f = int(d / 2)
				g = int(d % 2)
				if g == 0:
					print(e + f)
				else:
					print(e + f + 1)
			elif d == 2:
				print(e + 1)
			elif d == 0:
				print(e)
			else:
				print(e + 1)
		elif c == 5:
			print(1)
		elif c > 2:
			d = int(c / 2)
			e = int(c % 2)
			if e == 0:
				print(d)
			else:
				print(e + 1)
		elif c == 2:
			print(1)
		else:
			print(1)
	if a > b:
		c = a - b
		if c == 0:
			print(0)
		elif c > 5:
			d = int(c % 5)
			e = int(c / 5)
			if d > 2:
				f = int(d / 2)
				g = int(d % 2)
				if g == 0:
					print(e + f)
				else:
					print(e + f + 1)
			elif d == 2:
				print(e + 1)
			elif d == 0:
				print(e)
			else:
				print(e + 1)
		elif c == 5:
			print(1)
		elif c > 2:
			d = int(c / 2)
			e = int(c % 2)
			if e == 0:
				print(d)
			else:
				print(e + 1)
		elif c == 2:
			print(1)
		else:
			print(1)


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	dif = abs(a - b)
	ans = dif // 5
	rem = dif % 5
	if rem == 0:
		print(ans)
	elif rem == 1 or rem == 2:
		print(ans + 1)
	else:
		print(ans + 2)


import sys
import math
import itertools
import collections

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

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

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ''.join(map(str, arr))

def revn(n):
	return str(n)[::-1]

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber
t = ii()
for _ in range(t):
	(a, b) = mi()
	d = abs(b - a)
	ans = 0
	ans += d // 5
	d %= 5
	ans += d // 2
	d %= 2
	ans += d
	print(ans)


for z in range(int(input())):
	ls = list(map(int, input().split()))
	a = max(ls)
	b = min(ls)
	array = []
	count = 0
	if a == b:
		print(count)
		continue
	count += (a - b) // 5
	a -= (a - b) // 5 * 5
	if a == b:
		print(count)
		continue
	if a - 1 == b:
		count += 1
		print(count)
		continue
	count += (a - b) // 2
	a -= (a - b) // 2 * 2
	if a == b:
		print(count)
		continue
	else:
		count += 1
		print(count)
		continue


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	move = 0
	diff = abs(a - b)
	move = move + math.floor(diff / 5)
	diff = diff % 5
	move = move + math.floor(diff / 2)
	diff = diff % 2
	move = move + diff
	print(move)


t = int(input())
while t:
	i = input().split(' ')
	a = int(i[0])
	b = int(i[1])
	c = abs(a - b)
	ans = c // 5
	c = c % 5
	ans = ans + c // 2
	c = c % 2
	ans += c
	print(ans)
	t = t - 1


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	c = b - a
	r = 0
	r += c // 5
	c -= c // 5 * 5
	r += c // 2
	c -= c // 2 * 2
	r += c
	print(r)


for _ in range(int(input())):
	(a, b) = [*map(int, input().split())]
	if a > b:
		ans = a - b
	else:
		ans = b - a
	count = ans // 5
	s1 = (ans - 5 * count) // 2
	s = ans - 5 * count - 2 * s1
	print(count + s1 + s)


t = int(input())
a = []
b = []
for i in range(t):
	(c, d) = map(int, input().split())
	a.append(c)
	b.append(d)
	x = abs(a[i] - b[i]) // 5
	y = 0
	y = abs(a[i] - b[i]) % 5
	if y == 4 or y == 3:
		x += 2
	if y == 2 or y == 1:
		x += 1
	print(x)


for i in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	no = abs(a - b)
	f = no // 5
	no %= 5
	t = no // 2
	no %= 2
	print(f + t + no)


from collections import defaultdict

def solution(a, b):
	if a == b:
		return 0
	(x, y) = (min(a, b), max(a, b))
	steps = 0
	diff = y - x
	volumes = [5, 2, 1]
	counter = [0, 0, 0]
	for (i, j) in zip(volumes, counter):
		if diff >= i:
			j = diff // i
			diff = diff - j * i
			steps += j
	return steps
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print(solution(a, b))


for i in range(int(input())):
	kol = 0
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	kol += (b - a) // 5
	a += (b - a) // 5 * 5
	kol += (b - a) // 2
	a += (b - a) // 2 * 2
	kol += b - a
	print(kol)


t = int(input())
for i in range(0, t):
	st = input()
	(c, g) = st.split()
	c = int(c)
	g = int(g)
	diff = abs(c - g)
	ans = int(diff / 5)
	x = diff % 5
	if x == 1 or x == 2:
		ans = ans + 1
	elif x == 3 or x == 4:
		ans = ans + 2
	print(ans)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	ans = (a - b) // 5
	a = (a - b) % 5
	ans += a // 2
	a = a % 2
	ans += a // 1
	print(ans)


t = int(input(''))
for i in range(t):
	c = input('')
	d = c.split(' ')
	g = int(d[0])
	h = int(d[1])
	a = abs(g - h)
	x = a // 5
	y = a % 5 // 2
	z = a % 5 % 2
	print(x + y + z)


n = int(input())
for i in range(n):
	(h, t) = list(map(int, input().split()))
	m = abs(t - h)
	s = 0
	s += m // 5
	s += m % 5 // 2
	s += m % 5 % 2 // 1
	print(s)


t = int(input())
col = 0
for i in range(t):
	(a, b) = map(int, input().split())
	razn = abs(a - b)
	col = razn // 5
	x = razn % 5
	if x == 4 or x == 3:
		col += 2
	if x == 2 or x == 1:
		col += 1
	print(col)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	(k, d) = divmod(d, 5)
	print(k + sum(divmod(d, 2)))


t = int(input())
for _i in range(t):
	(a, b) = list(map(int, input().split()))
	ans = abs(a - b)
	a1 = ans // 5
	ans = ans % 5
	a2 = ans // 2
	ans = ans % 2
	print(a1 + a2 + ans)


t = int(input())
res = [0] * t
for i in range(t):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	one = c // 5
	two = c % 5 // 2
	thr = c % 5 % 2
	res[i] = one + two + thr
for i in range(len(res)):
	print(res[i])


from math import *
from collections import *
import sys
sys.setrecursionlimit(10 ** 9)
d = [0, 1, 1, 2, 2]
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	ans = abs(a - b) // 5 + d[abs(a - b) % 5]
	print(ans)


for step in range(int(input())):
	(a, b) = map(int, input().split())
	(num, n) = (0, abs(a - b))
	for i in [5, 2, 1]:
		num += n // i
		n %= i
	print(num)


for looool in range(int(input())):
	(N, M) = map(int, input().split())
	if N > M:
		(N, M) = (M, N)
	OTVET = 0
	OTVET += abs(M - N) // 5
	M -= 5 * (abs(M - N) // 5)
	OTVET += abs(M - N) // 2
	M -= 2 * (abs(M - N) // 2)
	print(OTVET + abs(M - N))


def main():
	global visited, adj, sets
	(a, b) = get_list()
	diff = abs(b - a)
	res = diff // 5
	diff = diff % 5
	res += (diff + 1) // 2
	print(res)
import sys
out = []
get_int = lambda : int(input())
get_list = lambda : list(map(int, input().split()))
[main() for _ in range(int(input()))]
print(*out, sep='\n')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	need = abs(a - b)
	c = 0
	while need > 0:
		if need // 5 > 0:
			c += need // 5
			need %= 5
		if need // 2 > 0:
			c += need // 2
			need %= 2
		c += need
		need = 0
	print(c)


from sys import stdin
n = int(stdin.readline().strip())
for i in range(n):
	(a, b) = map(int, stdin.readline().strip().split())
	x = abs(a - b)
	ans = 0
	ans += x // 5
	x = x - x // 5 * 5
	ans += x // 2
	x = x - x // 2 * 2
	ans += x // 1
	x = x - x // 1 * 1
	print(ans)


for i in range(int(input())):
	(a, b) = sorted(list(map(int, input().split())))
	x = abs(a - b)
	print(x // 5 + x % 5 // 2 + x % 5 % 2)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = I()
	rr = []
	for _ in range(t):
		(a, b) = LI()
		c = abs(a - b)
		r = c // 5 + (c % 5 + 1) // 2
		rr.append(r)
	return JA(rr, '\n')
print(main())


from sys import stdin, stdout
from collections import Counter
import math

def rsingle_int():
	return int(stdin.readline().rstrip())

def rmult_int():
	return [int(x) for x in stdin.readline().rstrip().split()]

def rmult_str():
	return stdin.readline().rstrip().split()

def r_str():
	return stdin.readline().rstrip()

def rsingle_char():
	return stdin.read(1)

def sortFirst(val):
	return val[0]

def paint(pic, x, y):
	pass

def main():
	t = rsingle_int()
	for _ in range(t):
		(a, b) = rmult_int()
		dist = abs(a - b)
		steps = dist // 5
		dist = dist % 5
		steps += dist // 2
		dist = dist % 2
		steps += dist
		print(steps)
main()


t = int(input())
h = [5, 2, 1]
u = [-5, -2, -1]
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a > b:
		a1 = a - b
		k = a1 // 5
		if k > 0:
			a1 = a1 - 5 * k
		y = a1 // 2
		if y > 0:
			a1 = a1 - y * 2
		print(a1 + k + y)
	else:
		a1 = b - a
		k = a1 // 5
		if k > 0:
			a1 = a1 - 5 * k
		y = a1 // 2
		if y > 0:
			a1 = a1 - y * 2
		print(a1 + k + y)


test = int(input())
while test != 0:
	test -= 1
	(no1, no2) = map(int, input().split())
	ans = abs(no1 - no2)
	final = ans // 5 + ans % 5 // 2 + ans % 5 % 2
	print(int(final))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print('0')
	else:
		dif = abs(a - b)
		a1 = dif // 5
		dif = dif - 5 * a1
		a2 = dif // 2
		dif = dif - 2 * a2
		a3 = dif // 1
		dif = dif - 1 * a3
		print(a1 + a2 + a3)


def num_to_ans(num):
	numbers = {0: 0, 1: 1, 2: 1, 3: 2, 4: 2, 5: 1, 6: 2, 7: 2, 8: 3, 9: 3}
	return numbers.get(num, None)

def num_to_ans2(num):
	numbers = {0: 0, 1: 1, 2: 1, 3: 2, 4: 2, 5: 1, 6: 2, 7: 2, 8: 3, 9: 3}
	return numbers.get(num, None)
name = input('')
for a in range(int(name)):
	(a, b) = map(int, input().split())
	dif = a - b
	if a - b > 0:
		ab_dif = a - b
		five_num = int(ab_dif / 10)
		five_num = five_num * 2
		ans = num_to_ans(ab_dif % 10)
		ans = ans + five_num
	else:
		ab_dif = b - a
		five_num = int(ab_dif / 10)
		five_num = five_num * 2
		ans = num_to_ans2(ab_dif % 10)
		ans = ans + five_num
	print(ans)


for i in [0] * int(input()):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	print(d // 5 + d % 5 // 2 + d % 5 % 2)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		s = 0
		(c, d) = (max(a, b), min(a, b))
		s = (c - d) // 5
		m = (c - d) % 5
		if m == 4 or m == 3:
			print(s + 2)
		elif m == 2 or m == 1:
			print(s + 1)
		else:
			print(s)


import sys
input = sys.stdin.readline
n = int(input())
for i in range(n):
	count = 0
	(a, b) = map(int, input().split(' '))
	diff = abs(a - b)
	while diff != 0:
		if diff >= 5:
			count += diff // 5
			diff = diff - diff // 5 * 5
		elif diff == 4:
			count += 2
			diff = 0
		elif diff == 3:
			count += 2
			diff = 0
		elif diff == 2:
			count += 1
			diff = 0
		elif diff == 1:
			count += 1
			diff = 0
	print(count)


T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	n = abs(b - a)
	total = 0
	total += n // 5
	n -= 5 * (n // 5)
	total += n // 2
	n -= 2 * (n // 2)
	total += n
	print(total)


import sys
import collections
from collections import Counter
import itertools
import math
import timeit
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

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

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
d = [0, 1, 1, 2, 2]
t = ii()
for _ in range(t):
	(a, b) = mi()
	t = abs(a - b)
	print(t // 5 + d[t % 5])


rr = lambda : input().strip()
rri = lambda : int(rr())
rrm = lambda : map(int, rr().split())

def solve(a, b):
	x = abs(a - b)
	if x % 5:
		if x % 5 == 2 or x % 5 == 1:
			return x // 5 + 1
		else:
			return x // 5 + 2
	else:
		return x // 5
T = rri()
for tc in range(T):
	(a, b) = rrm()
	ans = solve(a, b)
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	d = max(a, b) - min(a, b)
	res = d // 5
	d = d % 5
	res = res + d // 2
	d = d % 2
	res = res + d
	print(res)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(b - a)
	h = 0
	if c >= 5:
		h = h + c // 5
		c = c % 5
	if c >= 2:
		h = h + c // 2
		c = c % 2
	if c >= 1:
		h = h + c // 1
	print(h)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	k = abs(a - b)
	x = k // 5
	k -= 5 * x
	y = k // 2
	k -= 2 * y
	print(x + y + k)


n = int(input())
for count in range(n):
	(current, target) = map(int, input().split())
	if current > target:
		temp = target
		target = current
		current = temp
	attempts = 0
	for factor in [5, 2, 1]:
		attempts += (target - current) // factor
		current += (target - current) // factor * factor
	print(attempts)


for x in range(int(input())):
	(a1, b1) = input().split()
	a = int(a1)
	b = int(b1)
	count = 0
	count += abs(a - b) // 5
	if a >= b:
		a = a - count * 5
	else:
		a = a + count * 5
	check = abs(a - b)
	if check == 4 or check == 3:
		print(count + 2)
	elif check == 2 or check == 1:
		print(count + 1)
	else:
		print(count)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	s = 0
	if d // 5 != 0:
		s += d // 5
		d %= 5
	if d // 2 != 0:
		s += d // 2
		d %= 2
	if d != 0:
		s += d
	print(s)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	s = 0
	s += x // 5
	x %= 5
	s += x // 2
	x %= 2
	s += x
	print(s)


t = int(input())
ar = []
for i in range(t):
	s = input()
	ar0 = s.split(' ')
	ar1 = [int(ar0[0]), int(ar0[1])]
	ar.append(ar1)
for i in range(t):
	a = ar[i][0]
	b = ar[i][1]
	c = abs(b - a) // 5 + abs(b - a) % 5 // 2 + abs(b - a) % 5 % 2
	print(c)


T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	c = 0
	c += d // 5
	d -= d // 5 * 5
	c += d // 2
	d -= d // 2 * 2
	c += d
	print(c)


for _ in range(int(input())):
	(a, b) = sorted(map(int, input().split()))
	p = b - a
	ans = p // 5 + p % 5 // 2 + p % 5 % 2
	print(ans)


n = int(input())
for i in range(n):
	a = input().split()
	x = int(a[0])
	y = int(a[1])
	z = abs(x - y)
	u = z // 5
	v = z - 5 * u
	if v == 0:
		print(u)
	elif v == 1:
		print(u + 1)
	elif v == 2:
		print(u + 1)
	elif v == 3:
		print(u + 2)
	elif v == 4:
		print(u + 2)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	s = 0
	while x > 0:
		if x >= 5:
			r = x // 5
			x = x - r * 5
		elif x < 5 and x >= 2:
			r = x // 2
			x = x - r * 2
		else:
			r = x
			x = x - r
		s = s + r
	print(s)


from sys import stdin, stdout
input = stdin.readline
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	ans = 0
	while a != b:
		if a < b:
			if a + 5 <= b:
				diff = (b - a) // 5
				a += 5 * diff
				ans += diff
			elif a + 2 <= b:
				a += 2
				ans += 1
			else:
				a += 1
				ans += 1
		elif a - 5 >= b:
			diff = (a - b) // 5
			a -= 5 * diff
			ans += diff
		elif a - 2 >= b:
			a -= 2
			ans += 1
		else:
			a -= 1
			ans += 1
	print(ans)


def function(a, b):
	global outputs
	if a > b:
		function(b, a)
	elif a == b:
		outputs.append(0)
	else:
		push = 0
		dif = b - a
		if dif % 5 == 0:
			push = dif // 5
		elif dif % 5 == 3 or dif % 5 == 4:
			push = dif // 5
			push += 2
		elif dif % 5 == 2 or dif % 5 == 1:
			push = dif // 5
			push += 1
		outputs.append(push)
t = int(input())
outputs = []
for _ in range(t):
	(a, b) = map(int, input().split())
	function(a, b)
for i in outputs:
	print(i)


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	s = abs(a - b) // 5 + abs(a - b) % 5 // 2 + abs(a - b) % 5 % 2
	print(s)


n = int(input())
lst = []
for i in range(n):
	c = []
	(a, b) = map(int, input().split())
	c.append(a)
	c.append(b)
	lst.append(c)
for lts in lst:
	count = 0
	dif = lts[0] - lts[1]
	dif = abs(dif)
	if dif >= 5:
		count += dif // 5
		dif = dif - 5 * (dif // 5)
	if dif >= 2:
		count += dif // 2
		dif = dif - 2 * (dif // 2)
	if dif == 1:
		count += 1
		dif = dif - 1
	print(count)


q = int(input())
for _ in range(q):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	x = abs(a - b)
	res = x // 5
	v = x % 5
	if v == 0:
		pass
	elif v in [1, 2]:
		res += 1
	else:
		res += 2
	print(res)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	r = (b - a) % 5
	rr = r % 2
	print((b - a) // 5 + r // 2 + rr)


def solve():
	(a, b) = [int(x) for x in input().split()]
	diff = abs(b - a)
	count = 0
	for button in [5, 2, 1]:
		count += int(diff / button)
		diff = diff % button
	return count
t = int(input())
for i in range(t):
	print(solve())


t = map(int, open(0).read().split()[1:])
for (a, b) in zip(t, t):
	x = abs(b - a)
	print(x // 5 + sum(divmod(x % 5, 2)))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		a = b - a
	else:
		a = a - b
	value_5 = a % 5
	value_2 = value_5 % 2
	value = a // 5 + value_5 // 2 + value_2
	print(value)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		ans = 0
		ans += (a - b) // 5
		a -= ans * 5
		remaining = a - b
		if remaining == 1 or remaining == 2:
			ans += 1
			print(ans)
			continue
		elif remaining == 3 or remaining == 4:
			ans += 2
			print(ans)
			continue
		else:
			print(ans)
			continue
	elif a < b:
		ans = 0
		ans += (b - a) // 5
		a += ans * 5
		remaining = b - a
		if remaining == 1 or remaining == 2:
			ans += 1
			print(ans)
			continue
		elif remaining == 3 or remaining == 4:
			ans += 2
			print(ans)
			continue
		else:
			print(ans)
			continue
	elif a == b:
		print(0)
		continue


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	d = abs(n - m)
	res = d // 5
	d = d % 5
	res = res + d // 2
	d = d % 2
	res = res + d
	print(res)


def main():
	t = int(input())
	while t > 0:
		(a, b) = map(int, input().split())
		k = abs(a - b)
		cnt = 0
		while k != 0:
			if k >= 5:
				cnt += k // 5
				k = k % 5
			elif k >= 2:
				cnt += k // 2
				k = k % 2
			elif k == 1:
				cnt = cnt + 1
				k = 0
		print(cnt)
		t -= 1
main()


import sys
import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	res = x // 5
	x %= 5
	res += x // 2
	x %= 2
	print(res + x)


import io, sys, atexit, os
import math as ma
from decimal import Decimal as dec
from itertools import permutations
from itertools import combinations

def li():
	return list(map(int, sys.stdin.readline().split()))

def num():
	return map(int, sys.stdin.readline().split())

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	gg = find_gcd(x, y)
	return x * y // gg
mm = 1000000007

def solve():
	t = nu()
	for tt in range(t):
		(a, b) = num()
		if a <= b:
			dd = b - a
			pq = dd // 5
			yp = dd % 5
			yo = yp // 2
			yu = yp % 2
			print(pq + yu + yo)
		else:
			(a, b) = (b, a)
			dd = b - a
			pq = dd // 5
			yp = dd % 5
			yo = yp // 2
			yu = yp % 2
			print(pq + yu + yo)

def __starting_point():
	solve()
__starting_point()


import sys

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans

def SieveOfEratosthenes(n):
	cnt = 0
	prime = [True for i in range(n + 1)]
	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 p in range(2, n + 1):
		if prime[p]:
			cnt += 1
	return cnt

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
mod = int(1000000000.0) + 7

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

def iinp():
	return int(input())

def nninp():
	return map(int, sys.stdin.readline().strip().split())

def llinp():
	return list(map(int, sys.stdin.readline().strip().split()))

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
import math
for __ in range(iinp()):
	(a, b) = nninp()
	if a < b:
		(a, b) = (b, a)
	ans = 0
	ans += (a - b) // 5
	a = a - 5 * ((a - b) // 5)
	ans += (a - b) // 2
	a = a - 2 * ((a - b) // 2)
	ans += (a - b) // 1
	a = a - 1 * ((a - b) // 1)
	p(ans)


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in [0] * T:
		(A, B) = map(int, input().split())
		(ans, m) = divmod(abs(A - B), 5)
		if m > 2:
			ans += 2
		elif m > 0:
			ans += 1
		print(ans)
main()


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	ans = 0
	c = [5, 2, 1]
	d = abs(a - b)
	for i in range(3):
		if d >= c[i]:
			ans += d // c[i]
			tmp = d // c[i]
			d -= tmp * c[i]
	print(ans)


A = []
x = int(input())
for i in range(x):
	(a, b) = map(int, input().split())
	a -= b
	a = abs(a)
	z = a // 5
	a -= 5 * (a // 5)
	if a > 0:
		z += 1
	if a > 2:
		z += 1
	A.append(z)
for t in A:
	print(t)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	diff = abs(n - m)
	ans = 0
	ans += diff // 5
	diff = diff - 5 * (diff // 5)
	ans += diff // 2
	diff = diff - 2 * (diff // 2)
	ans += diff // 1
	diff = diff - 1 * (diff // 1)
	print(ans)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	a = -min(a, b) + max(a, b)
	ans = 0
	ans = a // 5
	a %= 5
	ans += a // 2
	a %= 2
	ans += a
	print(ans)


for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	if a == b:
		print(0)
		continue
	num = abs(b - a)
	ans = num // 5
	num %= 5
	ans += num // 2
	num %= 2
	ans += num
	print(ans)


change = [5, 2, 1]
for t in range(int(input())):
	(a, b) = map(int, input().split())
	dif = abs(a - b)
	mvs = 0
	for n in change:
		mvs += dif // n
		dif %= n
	print(mvs)


t = int(input())
for items in range(t):
	(a, b) = map(int, input().split())
	n = abs(a - b)
	count = 0
	while n != 0:
		if n >= 5:
			count += n // 5
			n = n % 5
		if n >= 2:
			count += n // 2
			n = n % 2
		if n == 1:
			count += 1
			n = 0
	print(count)


t = int(input())
for _ in range(t):
	ab = list(map(int, input().split()))
	a = ab[0]
	b = ab[1]
	diff = {}
	diff[0] = 0
	diff[1] = 1
	diff[2] = 1
	diff[3] = 2
	diff[4] = 2
	diff[5] = 1
	gap = abs(a - b)
	ret = int(gap / 5)
	ret += diff[gap % 5]
	print(ret)


from sys import stdin, stdout
T = int(stdin.readline())
while T != 0:
	(a, b) = map(int, stdin.readline().split())
	c = 0
	if a > b:
		d = a - b
	else:
		d = b - a
	c += d // 5
	d = d % 5
	c += d // 2
	d = d % 2
	c += d // 1
	d = d % 1
	stdout.write(str(c))
	stdout.write('\n')
	T -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	ans = 0
	while d:
		if d >= 5:
			ans += d // 5
			d -= 5 * (d // 5)
		elif d >= 2:
			ans += d // 2
			d -= 2 * (d // 2)
		elif d == 1:
			ans += 1
			d -= 1
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = abs(b - a)
	res = 0
	if x >= 5:
		res += x // 5
	if x % 5 > 2:
		res += 2
	elif x % 5 != 0:
		res += 1
	print(res)


t = int(input())
while t:
	ctr = 0
	(a, b) = list(map(int, input().split()))
	p = abs(a - b)
	while p != 0:
		if p >= 5:
			ctr = ctr + p // 5
			p = p % 5
		elif p >= 2:
			ctr = ctr + p // 2
			p = p % 2
		elif p == 1:
			ctr = ctr + 1
			p = 0
	t = t - 1
	print(ctr)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	p = b - a
	if p < 0:
		p = -p
	if p == 0:
		c = 0
		print(c)
	else:
		c = 0
		if p >= 5:
			c += p // 5
			p = p % 5
		if p >= 2:
			c += p // 2
			p = p % 2
		if p != 0:
			p = p - 1
			c += 1
		print(c)


from sys import stdin
read = stdin.readline

def main():
	cases = int(read())
	for case in range(cases):
		(a, b) = map(int, read().strip().split())
		tar = abs(a - b)
		(ans, nums) = (0, [5, 2, 1])
		for num in nums:
			ans += tar // num
			tar = tar % num
		print(ans)
main()


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	c = 0
	if a > b or a < b:
		ecar = abs(a - b)
		c += ecar // 5
		ecar = ecar % 5
		c += ecar // 2
		ecar = ecar % 2
		c += ecar
		print(c)
	else:
		print(0)


n = int(input())
for i in range(n):
	presses_count = 0
	(x, y) = list(map(int, input().split()))
	a = min(x, y)
	b = max(x, y)
	dif = b - a
	if dif % 5 >= 0 and dif >= 5:
		change_by_five = (dif - dif % 5) // 5
		dif = dif - change_by_five * 5
		presses_count += change_by_five
	if dif % 2 >= 0 and dif >= 2:
		change_by_two = (dif - dif % 2) // 2
		dif = dif - change_by_two * 2
		presses_count += change_by_two
	presses_count += dif
	dif = 0
	print(presses_count)


t = int(input())
for nt in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	count = 0
	count += (b - a) // 5
	count += (b - a) % 5 // 2
	count += (b - a) % 5 % 2
	print(count)


n = int(input())
for i in range(0, n):
	q = list(map(int, input().split()))
	a = q[0] - q[1]
	if a < 0:
		a = a * -1
	l = 0
	if a // 5 >= 1:
		l += a // 5
		a = a % 5
	if a // 2 >= 1:
		l += a // 2
		a = a % 2
	if a // 1 >= 1:
		l += a // 1
	print(l)


def solve():
	inp = input().split()
	a = int(inp[0])
	b = int(inp[1])
	a = abs(a - b)
	ret = a // 5
	a %= 5
	ret += a // 2
	a %= 2
	ret += a
	print(ret)
t = int(input())
while t > 0:
	solve()
	t -= 1


TestCase = int(input())
while TestCase > 0:
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	count = diff // 5
	diff %= 5
	count += diff // 2
	diff %= 2
	count += diff
	print(count)
	TestCase -= 1


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	p = abs(b - a)
	ans = 0
	ans += p // 5
	p %= 5
	ans += p // 2
	p %= 2
	ans += p
	print(ans)


T = int(input())
m = [0, 1, 1, 2, 2]
for _ in range(T):
	(a, b) = [int(x) for x in input().split()]
	if a == b:
		print(0)
		continue
	d = abs(b - a)
	r = d % 5
	print(d // 5 + m[r])


k = int(input())
for i in range(k):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	dfrnc = abs(a - b)
	v = 0
	if dfrnc == 0:
		print(0)
	else:
		press5counts = dfrnc // 5
		press2counts = dfrnc % 5 // 2
		press1counts = dfrnc % 5 % 2
		print(press5counts + press2counts + press1counts)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	m = 0
	d = abs(a - b)
	m += d // 5
	d = d % 5
	m += d // 2
	d = d % 2
	m += d // 1
	d = d % 1
	print(m)


n = int(input())
for i in range(n):
	ans = 0
	(a, b) = [int(tmp) for tmp in input().split()]
	k = abs(b - a)
	ans = 0
	ans += k // 5
	k = k % 5
	if k % 2 == 0:
		ans += k // 2
	elif k % 2 == 1:
		ans = ans + k // 2 + 1
	print(ans)


for i in range(int(input())):
	arr = list(input().split())
	a = int(arr[0])
	b = int(arr[1])
	count = 0
	difference = abs(a - b)
	while difference:
		if difference >= 5:
			mult = difference // 5
			count += mult
			difference -= mult * 5
		if difference == 1:
			count += 1
			difference -= 1
		if difference == 2:
			count += 1
			difference -= 2
		if difference == 3:
			count += 2
			difference -= 3
		if difference == 4:
			count += 2
			difference -= 4
	print(count)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	x = min(a, b)
	y = max(a, b)
	c = 0
	if x == y:
		print(0)
	else:
		c += (y - x) // 5
		rem = (y - x) % 5
		c += rem // 2
		rem = rem % 2
		c += rem
		print(c)


try:
	import pytest

	@pytest.mark.parametrize('items, result', [((4, 0), 2), ((5, 14), 3), ((3, 9), 2)])
	def test(items, result):
		assert solve(*items) == result
except Exception:
	pass

def solve(a, b) -> int:
	diff = abs(a - b)
	operations = 0
	for k in (5, 2, 1):
		incr = diff // k
		operations += incr
		diff -= incr * k
	return operations

def main():
	for _ in range(int(input())):
		print(solve(*map(int, input().split())))
main()


for _ in range(int(input())):
	c = 0
	(a, b) = [int(x) for x in input().split(' ')]
	if a < b:
		(a, b) = (b, a)
	z = a - b
	f = z // 5
	a = a - f * 5
	c = c + f
	if a != b:
		z1 = a - b
		f1 = z1 // 2
		a = a - f1 * 2
		c = c + f1
		if a != b:
			z2 = a - b
			f2 = z2
			a = a - f2
			c = c + f2
	print(c)


def run_testcase():
	[a, b] = [int(x) for x in input().split()]
	diff = abs(a - b)
	press5 = diff // 5
	diff -= press5 * 5
	press2 = diff // 2
	diff -= press2 * 2
	press1 = diff
	return press5 + press2 + press1
testcase_count = int(input())
for i in range(testcase_count):
	print(str(run_testcase()))


t = int(input())
for i in range(t):
	a = input()
	a = a.split()
	mod = abs(int(a[0]) - int(a[1]))
	ans = 0
	i = 0
	b = [5, 2, 1]
	while mod != 0:
		ans += mod // b[i]
		mod = mod % b[i]
		i += 1
	print(ans)


def getInput(fromFile=False):
	if fromFile:
		f = open('input', 'r')
		return lambda : f.readline()[:-1]
	return input

def main(fromFile=False):
	inp = getInput(fromFile)
	result = []
	for _ in range(int(inp())):
		count = 0
		(a, b) = map(int, inp().split(' '))
		if b != a:
			if a > b:
				(a, b) = (b, a)
			count += int((b - a) / 5)
			b -= count * 5
			if b - a in [3, 4]:
				count += 2
			elif b - a in [1, 2]:
				count += 1
		result.append(count)
	return result
for i in main(fromFile=False):
	print(i)


n = int(input())
t = [5, 2, 1]
wyn = 0
for i in range(0, n, +1):
	(a, b) = map(int, input().split())
	if a == b:
		print('0')
		continue
	d = abs(a - b)
	wyn = 0
	for x in t:
		if d >= x:
			if d == 9 and a >= 1:
				wyn += 3
				break
			wyn += d // x
			d = d % x
	print(wyn)


for t in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	k = abs(a - b)
	res = k // 5
	k %= 5
	res += {0: 0, 1: 1, 2: 1, 3: 2, 4: 2}[k]
	print(res)


for i in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	a = abs(a - b)
	ans = 0
	if a % 5 == 0:
		print(a // 5)
	elif a % 5 == 1:
		print(a // 5 + 1)
	elif a % 5 == 2:
		print(a // 5 + 1)
	elif a % 5 == 3 or a % 5 == 4:
		print(a // 5 + 2)


n = int(input())
for i in range(n):
	(r, s) = map(int, input().split())
	t = abs(r - s)
	p = t // 5
	y = t % 5
	o = y // 2
	u = y % 2
	v = u // 1
	x = u % 1
	print(p + v + x + o)


from math import ceil, sqrt, floor
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	if not diff % 5:
		print(diff // 5)
	else:
		print(diff // 5 + 1 + int(diff % 5 > 2))


t = int(input())
steps = [5, 2, 1]
for i in range(1, t + 1):
	(n, m) = [int(s) for s in input().split(' ')]
	ans = 0
	diff = abs(m - n)
	for step in steps:
		ans += diff // step
		diff %= step
	print(ans)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	d = abs(b - a)
	ans = 0
	ans += d // 5
	d = d % 5
	ans += d // 2
	d %= 2
	ans += d // 1
	d %= 1
	print(ans)


def program():
	(a, b) = input().split()
	d = abs(int(a) - int(b))
	sum = 0
	if d // 5 > 0:
		sum = sum + d // 5
		d = d % 5
	if d // 2 > 0:
		sum = sum + d // 2
		d = d % 2
	sum = sum + d
	print(sum)
t = int(input())
for i in range(t):
	program()


def calc(a: int, b: int):
	count: int = 0
	temp: int = abs(a - b)
	vote: bool = True
	while vote:
		if temp >= 5:
			(q, temp) = divmod(temp, 5)
			count += q
		elif temp >= 2:
			(q, temp) = divmod(temp, 2)
			count += q
		else:
			count += temp
			return count

def main():
	n: int = int(input())
	for _ in range(n):
		(a, b) = map(int, input().split())
		print(calc(a, b))
main()


import math
t = int(input())
for __ in range(t):
	(a, b) = map(int, input().split())
	d = abs(b - a)
	print(d // 5 + math.ceil(d % 5 / 2))


t = int(input())
for i in range(t):
	n_m = input().split()
	n = int(n_m[0])
	m = int(n_m[1])
	val = abs(n - m)
	ans = 0
	ans += val // 5
	val = val % 5
	ans += val // 2
	val = val % 2
	ans += val
	print(ans)


import sys

def minPath(a, b):
	actions = 0
	if a > b:
		actions += int((a - b) / 5)
		a -= 5 * int((a - b) / 5)
	else:
		actions += int((b - a) / 5)
		a += 5 * int((b - a) / 5)
	if a == b:
		return actions
	if abs(a - b) == 1 or abs(a - b) == 2:
		return actions + 1
	return actions + 2
num = int(sys.stdin.readline())
for i in range(num):
	ints = sys.stdin.readline().split(' ')
	current = int(ints[0])
	desired = int(ints[1])
	print(minPath(current, desired))


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	l = []
	for i in range(2, n + 1):
		if prime[i]:
			l.append(i)
	return l

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, ll, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		if ll[mid] == val:
			return ll[mid]
		elif ll[mid] < val:
			ans = ll[mid]
			return binary(mid + 1, r, ll, val, ans)
		else:
			return binary(l, mid - 1, ll, val, ans)

def check(n):
	v = 1
	while n != 0:
		if n % 10 == 0 or n % 10 == 1:
			n = n // 10
		else:
			v = 0
			break
	return v
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split(' '))
	if a == b:
		print(0)
	else:
		val = abs(a - b)
		c = 0
		a5 = val // 5
		val -= a5 * 5
		c += a5
		a2 = val // 2
		val -= a2 * 2
		c += a2
		a1 = val // 1
		val -= a1 * 1
		c += a1
		print(c)


n = int(input())
for i in range(n):
	(a, b) = list(map(int, input().split()))
	s = abs(b - a)
	count = 0
	while s != 0:
		if s >= 5:
			count += s // 5
			s = s % 5
		elif s >= 2 and s < 5:
			count += s // 2
			s = s % 2
		elif s == 1:
			count += 1
			s = s % 1
	print(count)


from sys import stdin, stdout
for i in stdin:
	t = int(i)
	break
for i in range(t):
	for i in stdin:
		(a, b) = map(int, i.strip().split())
		break
	x = 0
	(a, b) = (min(a, b), max(a, b))
	x += (b - a) // 5
	a += 5 * x
	x += (b - a) // 2 + (b - a) % 2
	stdout.write(str(x) + '\n')


T = int(input())
for t in range(T):
	(a, b) = list(map(int, input().split()))
	(maxi, mini) = (max([a, b]), min([a, b]))
	diff = maxi - mini
	q = diff // 5
	r = diff % 5
	if r == 0:
		ans = q
	elif r < 3:
		ans = q + 1
	else:
		ans = q + 2
	print(ans)


n = int(input())
arr = []
for i in range(n):
	input_arr = input().split()
	arr.append(input_arr)
for i in range(len(arr)):
	for j in range(len(arr[i])):
		arr[i][j] = int(arr[i][j])
for i in range(len(arr)):
	count = 0
	now_vol = arr[i][0]
	want_vol = arr[i][1]
	volume = abs(now_vol - want_vol)
	if volume >= 5:
		count += volume // 5
		volume = volume % 5
	if volume >= 2:
		count += volume // 2
		volume = volume % 2
	if volume == 1:
		count += 1
	print(count)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	c = 0
	while x > 0:
		if x % 5 == 0 or x > 5:
			c = c + x // 5
			x = x % 5
		elif x % 2 == 0 or x > 2:
			c = c + x // 2
			x = x % 2
		else:
			x = x - 1
			c = c + 1
	print(c)


def f(a, b):
	if a < b:
		bt = [5, 2, 1]
		p = 0
		total = 0
		while a != b:
			if a + bt[p] > b:
				p += 1
			else:
				diff = b - a
				a += diff // bt[p] * bt[p]
				total += diff // bt[p]
		return total
	elif a > b:
		bt = [5, 2, 1]
		p = 0
		total = 0
		while a != b:
			if b + bt[p] > a:
				p += 1
			else:
				diff = a - b
				b += diff // bt[p] * bt[p]
				total += diff // bt[p]
		return total
	else:
		return 0
t = int(input())
for __ in range(t):
	(a, b) = [int(x) for x in input().split()]
	print(f(a, b))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		pp = abs(b - a)
		num = pp % 5
		if num == 0:
			print(pp // 5)
		elif num == 1 or num == 2:
			print(pp // 5 + 1)
		elif num == 3 or num == 4:
			print(pp // 5 + 2)


def main(a, b):
	index = abs(a - b)
	sum = 0
	while index >= 5:
		sum = sum + int(index / 5)
		index = index % 5
	if index != 0:
		sum = sum + int(index / 2) + index % 2
	return sum
t = int(input())
for t_itr in range(t):
	ab = list(map(int, input().rstrip().split()))
	a = ab[0]
	b = ab[1]
	res = main(a, b)
	print(res)


def answer(a, b):
	count = 0
	c = abs(a - b)
	if c == 0:
		return count
	buttons = [5, 2, 1]
	for btn in buttons:
		count += c // btn
		c = c % btn
	return count
testCount = int(input())
for _ in range(testCount):
	(a, b) = map(int, input().split())
	print(answer(a, b))


for _ in range(int(input())):
	(a, b) = list((int(i) for i in input().split()))
	vol = abs(b - a)
	c = 0
	print(vol // 5 + vol % 5 // 2 + vol % 5 % 2)


def count_steps(start, target):
	if start == target:
		return 0
	else:
		dif = abs(b - a)
		if dif // 5 > 0:
			five_count = dif // 5
			two_count = 0
			def_left = dif % 5
			if def_left > 0:
				if def_left // 2 > 0:
					two_count = def_left // 2
					def_left = def_left % 2
			return five_count + two_count + def_left
		elif dif // 2 > 0:
			two_count = dif // 2
			def_left = dif % 2
			return two_count + def_left
			pass
		else:
			return dif
t = int(input())
for m_i in range(0, t):
	(a, b) = [int(input_value) for input_value in input().split(' ')]
	print(count_steps(a, b))


def outpos(num):
	out = 0
	if num == 0:
		return 0
	elif num == 1:
		return out + 1
	elif num >= 5:
		out = num // 5
		res = num % 5
		return out + outpos(res)
	elif num >= 2:
		out = num // 2
		res = num % 2
		outpos(res)
		return out + outpos(res)
list = []
t = int(input())
for i in range(0, t):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	if a == b:
		print(0)
	elif a > b:
		out = outpos(a - b)
		print(out)
	elif b > a:
		out = outpos(b - a)
		print(out)


import sys

def alele():
	return list(map(int, sys.stdin.readline().strip().split()))

def ilele():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(A, B) = ilele()
	dif = abs(A - B)
	count = 0
	a = dif // 5
	b = (dif - a * 5) // 2
	c = dif - (a * 5 + b * 2)
	print(a + b + c)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	s = abs(b - a)
	c = 0
	while s != 0:
		if s >= 5:
			c = s // 5
			s = s % 5
		elif s == 4 or s == 3:
			c += 2
			s = 0
		elif s == 2 or s == 1:
			c += 1
			s = 0
	print(c)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	k = 0
	k += (b - a) // 5
	a += k * 5
	k += (b - a) // 2
	a += (b - a) // 2 * 2
	if b - a != 0:
		k += 1
	print(k)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	diff = 0
	if a > b:
		diff = a - b
	else:
		diff = b - a
	ans = diff // 5
	diff -= ans * 5
	if diff == 0:
		ans += 0
	elif diff == 1 or diff == 2:
		ans += 1
	else:
		ans += 2
	print(ans)


a = int(input())
for i in range(a):
	(x, y) = map(int, input().split())
	steps = 0
	if x == y:
		print(0)
		continue
	elif x > y:
		t = x - y
		if t >= 5:
			steps = steps + t // 5
			t = t % 5
		if t == 4:
			steps = steps + 2
		if t == 3:
			steps = steps + 2
		if t == 2 or t == 1:
			steps = steps + 1
		print(steps)
	else:
		t = y - x
		if t >= 5:
			steps = steps + t // 5
			t = t % 5
		if t == 4:
			steps = steps + 2
		if t == 3:
			steps = steps + 2
		if t == 2 or t == 1:
			steps = steps + 1
		print(steps)


def main():
	for kase in range(int(input())):
		(a, b) = map(int, input().split())
		a = abs(b - a)
		ans = a // 5
		a = a % 5
		if a == 4:
			ans += 2
		if a == 3:
			ans += 2
		if a == 2:
			ans += 1
		if a == 1:
			ans += 1
		print(ans)
	return 0
main()


def no_changes(a, b):
	diff = abs(a - b)
	return diff // 5 + diff % 5 // 2 + diff % 5 % 2 // 1
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(no_changes(a, b))


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	diff = abs(b - a)
	ans = 0
	if diff >= 5:
		ans += diff // 5
		diff -= ans * 5
	if diff < 5 and diff >= 2:
		if diff == 4 or diff == 2:
			ans += diff // 2
		elif diff == 3:
			ans += diff // 2
			diff -= 2
	if diff == 1:
		ans += 1
	print(ans)


def change_volume(a, b):
	if a == b:
		return 0
	sum = 0
	diff = abs(a - b)
	sum += diff // 5
	diff %= 5
	sum += diff // 2
	diff %= 2
	sum += diff
	return sum
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().strip().split())
	print(change_volume(a, b))


x = eval(input())
for i in range(x):
	s = 0
	y = input().split(' ')
	a = int(y[0])
	b = int(y[1])
	c = abs(a - b)
	s = c // 5 + c % 5 // 2 + c % 5 % 2
	print(s)


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	l = abs(x - y)
	if l % 5 == 0:
		h = l / 5
	else:
		m = l - 5 * (l // 5)
		if m % 2 == 0:
			h = l // 5 + m / 2
		else:
			h = l // 5 + m // 2 + 1
	print(int(h))


def getAns(li):
	diff = li[1] - li[0]
	if diff < 0:
		diff *= -1
	if diff % 5 == 0:
		return diff // 5
	return (diff + 2) // 5 + 1
n = int(input())
for i in range(n):
	print(getAns([int(x) for x in input().split(' ')]))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	m = abs(a - b)
	k = m // 5
	p = m - k * 5
	if p == 0:
		print(k)
	elif p == 1 or p == 2:
		print(k + 1)
	else:
		print(k + 2)


query = int(input())
for _ in range(query):
	(a, b) = map(int, input().split())
	c = 0
	d = abs(a - b)
	if d == 8:
		print(3)
	else:
		c += d // 5
		d = d % 5
		c += d // 2
		d = d % 2
		c += d // 1
		print(c)


t = int(input())
for i in range(t):
	q = input().split()
	a = int(q[0])
	b = int(q[1])
	sum = 0
	if a != b:
		m = abs(a - b)
		if m >= 5:
			x = m % 5
			y = m // 5
			sum += y
			if x >= 2:
				y = x // 2
				x = x % 2
				sum += y
				if x > 0:
					sum += x
			else:
				sum += x
		elif m >= 2:
			x = m % 2
			y = m // 2
			sum += y
			if x > 0:
				sum += x
		else:
			sum += m
		print(sum)
	else:
		print('0')


for _ in range(int(input())):
	l = [5, 2, 1]
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		count = 0
		x = abs(a - b)
		i = 0
		count = 0
		while i < 3:
			while i < 3 and x % l[i] != x:
				count += x // l[i]
				x = x % l[i]
			i += 1
		print(count)


t = int(input())
for k in range(t):
	c = input().split()
	diff = abs(int(c[0]) - int(c[1]))
	i = diff // 5 + diff % 5 // 2 + diff % 5 % 2
	print(i)


def do():
	T = int(input())
	(a, b, c) = (1, 2, 5)
	for _ in range(T):
		(a, b) = map(int, input().split())
		c = min(a, b)
		d = max(a, b)
		diff = d - c
		if diff % 5 == 0:
			print(diff // 5)
			continue
		count = 0
		if diff / 5 >= 1:
			count += diff // 5
			diff %= 5
		if diff / 2 >= 1:
			count += diff // 2
			diff %= 2
		count += diff
		print(count)
do()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	n = x // 5
	r = x % 5
	m = r // 2
	rr = r % 2
	print(n + m + rr)


n = int(input())
while n > 0:
	n -= 1
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	if abs(a - b) == 0:
		print(0)
	else:
		dif = abs(a - b)
		cnt = 0
		cnt += dif // 5
		dif = dif % 5
		cnt += dif // 2
		dif = dif % 2
		cnt += dif
		print(cnt)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split(' '))
	diff = abs(a - b)
	ans = diff // 5
	diff %= 5
	ans += diff // 2
	diff %= 2
	ans += diff
	print(ans)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	s = 0
	d = abs(b - a)
	x = d // 5
	d = d % 5
	y = d // 2
	d = d % 2
	z = d // 1
	print(z + y + x)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	k = abs(a - b)
	step = 0
	m = k // 5
	k -= 5 * m
	step += m
	m = k // 2
	k -= 2 * m
	step += m
	step += k
	print(step)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = a - b if a >= b else b - a
	print(c // 5 + c % 5 // 2 + c % 5 % 2)


def vol(a, b):
	if a == b:
		return 0
	if a > b:
		(a, b) = (b, a)
	fac = b - a
	answer = 0
	five_mod = fac % 5
	answer += fac // 5
	two_mod = five_mod % 2
	answer += five_mod // 2
	if two_mod:
		answer += 1
	return answer
t = int(input())
for i in range(t):
	inp = input().split()
	a = int(inp[0])
	b = int(inp[1])
	print(vol(a, b))


for _ in range(int(input())):
	(a, b) = sorted([int(_) for _ in input().split()])
	c = 0
	c += (b - a) // 5
	a += (b - a) // 5 * 5
	c += (b - a) // 2
	a += (b - a) // 2 * 2
	print(c + b - a)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	tmp = abs(b - a)
	val = 0
	val += tmp // 5
	tmp = tmp % 5
	val += tmp // 2
	tmp = tmp % 2
	val += tmp
	print(val)


for _ in range(int(input())):
	arr = [int(i) for i in input().split()]
	difference = abs(arr[0] - arr[1])
	button_press = 0
	another = [5, 2, 1]
	j = 0
	while difference != 0:
		button_press += difference // another[j]
		difference = difference % another[j]
		j += 1
	print(button_press)


t = int(input())
for y in range(t):
	(a, b) = map(int, input().split())
	f = abs(b - a) // 5
	w = abs(b - a) % 5
	if w == 4 or w == 3:
		f = f + 2
	if w == 2 or w == 1:
		f = f + 1
	print(f)


def volume(a, b):
	n = abs(b - a)
	d = n // 5
	n = n % 5
	d += n // 2
	n = n % 2
	d += n
	return d
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print(volume(a, b))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	count = 0
	if a == b:
		print(count)
	else:
		c = abs(a - b)
		m = c // 5
		n = c % 5 // 2
		j = c % 5 % 2
		print(m + n + j)


for i in range(int(input())):
	(a, b) = (int(x) for x in input().split())
	ans = abs(a - b) // 5 + abs(a - b) % 5 // 2 + abs(a - b) % 5 % 2
	print(ans)


import sys

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

def mint():
	return int(minp())

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

def solve():
	r = 1e+30
	(a, b) = mints()
	for i in range((b - a) // 5 - 3, (b - a) // 5 + 4):
		for j in range(-3, 4):
			for k in range(-2, 3):
				c = max(i * 5, 0) + max(j * 2, 0) + max(k * 1, 0)
				d = min(i * 5, 0) + min(j * 2, 0) + min(k * 1, 0)
				if a + c + d == b:
					r = min(r, abs(i) + abs(j) + abs(k))
	print(r)
for i in range(mint()):
	solve()


a = int(input())
b = list()
q = 0
for i in range(a):
	b.append(list(map(int, input().split())))
	if b[i][0] > b[i][1]:
		c = b[i][0] - b[i][1]
	else:
		c = b[i][1] - b[i][0]
	q += c // 5
	qw = (c - c // 5 * 5) // 2
	q += qw
	qwe = c - c // 5 * 5 - qw * 2
	q += qwe
	print(q)
	q = 0


s = int(input())
res = 0
for i in range(s):
	vol = list(map(int, input().split()))
	a = vol[0]
	b = vol[1]
	if a > b:
		m = a - b
	else:
		m = b - a
	res = m // 5
	m = m % 5
	res = res + m // 2
	m = m % 2
	if m == 1:
		res = res + 1
		m = m - 1
	print(res)


n = int(input())

def getAns(a, b):
	diff = abs(a - b)
	step = 0
	while diff != 0:
		if diff // 5 > 0:
			vl = diff // 5
			i = 5
		elif diff // 2 > 0:
			vl = diff // 2
			i = 2
		else:
			vl = diff
			i = 1
		diff -= vl * i
		step += vl
	return step
for x in range(n):
	(a, b) = [int(k) for k in input().split()]
	print(getAns(a, b))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	count = 0
	temp = abs(a - b)
	while temp > 0:
		if int(temp / 5) > 0:
			count += int(temp / 5)
			temp = temp - 5 * int(temp / 5)
			if temp == 0:
				break
			continue
		elif int(temp / 2) > 0:
			count += int(temp / 2)
			temp = temp - 2 * int(temp / 2)
			if temp == 0:
				break
		else:
			temp = 0
			count += 1
			break
	print(count)


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	c = 0
	if a == b:
		print(0)
	else:
		n = abs(a - b)
		while n >= 5:
			c = c + n // 5
			n = n % 5
		while n >= 2:
			c = c + n // 2
			n = n % 2
		while n >= 1:
			c = c + n // 1
			n = n % 1
		print(c)
	t = t - 1


for i in range(int(input())):
	(a, b) = map(int, input().split())
	x = 0
	k = abs(a - b)
	x += k // 5
	k %= 5
	x += (k + 1) // 2
	print(x)


t = int(input())
for t1 in range(t):
	(a, b) = map(int, input().split())
	w = abs(b - a)
	if w % 5 == 0:
		print(w // 5)
	else:
		p = w % 5
		if p == 1 or p == 2:
			print(w // 5 + 1)
		elif p == 3 or p == 4:
			print(w // 5 + 2)


import math
test = int(input())
for t in range(0, test):
	(a, b) = map(int, input().split())
	t = abs(a - b)
	ans = t // 5
	t = t % 5
	ans = ans + t // 2
	t = t % 2
	print(ans + t)


t = int(input())
for x in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		f5 = (a - b) // 5
		fr5 = (a - b) % 5
		if fr5 == 0:
			print(f5)
		elif fr5 == 1:
			print(f5 + 1)
		elif fr5 == 2:
			print(f5 + 1)
		elif fr5 == 3:
			print(f5 + 2)
		else:
			print(f5 + 2)
		continue
	elif b > a:
		f5 = (b - a) // 5
		fr5 = (b - a) % 5
		if fr5 == 0:
			print(f5)
		elif fr5 == 1:
			print(f5 + 1)
		elif fr5 == 2:
			print(f5 + 1)
		elif fr5 == 3:
			print(f5 + 2)
		else:
			print(f5 + 2)
		continue
	else:
		print('0')


testcases = int(input())
for z in range(testcases):
	(a, b) = [int(x) for x in input().split()]
	dif = abs(b - a)
	if dif == 0:
		print(0)
	else:
		nofpress5 = dif // 5
		nofpress2 = (dif - nofpress5 * 5) // 2
		nofpress1 = (dif - nofpress5 * 5 - nofpress2 * 2) // 1
		print(nofpress1 + nofpress2 + nofpress5)


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		k = abs(a - b)
		count = 0
		m = k // 5
		k = k - 5 * m
		count += m
		m = k // 2
		k = k - 2 * m
		count += m + k
		print(count)
	t = t - 1


def main():
	t = int(input())
	for i in range(t):
		(a, b) = list(map(int, input().split()))
		moves = 0
		diff = abs(a - b)
		x = diff // 5
		moves += x
		diff -= 5 * x
		x = diff // 2
		moves += x
		diff -= 2 * x
		x = diff
		moves += x
		print(moves)
main()


import sys
import collections
import heapq
import math
input = sys.stdin.readline

def rints():
	return map(int, input().strip().split())

def rstr():
	return input().strip()

def rint():
	return int(input().strip())

def rintas():
	return [int(i) for i in input().strip().split()]

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
t = rint()
for _ in range(t):
	(a, b) = rints()
	if a == b:
		print(0)
	else:
		ans = 0
		d = abs(a - b)
		if d >= 5:
			ans += d // 5
			d = d % 5
		if d >= 2:
			ans += d // 2
			d = d % 2
		if d == 1:
			ans += 1
		print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	count = 0
	diff = abs(a - b)
	re = diff % 5
	count += diff // 5
	re1 = re % 2
	count += re // 2
	count += re1
	print(count)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = 0
	if abs(a - b) >= 5:
		cnt = abs(a - b) // 5
		ans += cnt
		a += cnt * 5 * (1 if a < b else -1)
	if abs(a - b) >= 3:
		ans += 2
	elif abs(a - b) >= 1:
		ans += 1
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	cnt = 0
	cnt = diff // 5
	if diff >= 5:
		cnt = diff // 5
		diff = diff % 5
	if diff >= 2:
		cnt += diff // 2
		diff = diff % 2
	if diff >= 1:
		cnt += diff // 1
	print(cnt)


T = int(input())
for t in range(T):
	(a, b) = [int(x) for x in input().split()]
	x = abs(a - b)
	y = x // 5
	r = x % 5
	if r == 1 or r == 2:
		y = y + 1
	if r == 3 or r == 4:
		y = y + 2
	print(y)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	k = abs(a - b)
	count = 0
	while k != 0:
		if k >= 5:
			j = k % 5
			k = k // 5
			count = count + k
			k = j
		elif k >= 2:
			j = k % 2
			k = k // 2
			count = count + k
			k = j
		else:
			count = count + k
			k = 0
	print(count)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	move_count = 0
	count = 0
	while not a == b:
		x = b - a
		if abs(int(x / 5)) > 0:
			count = int(x / 5)
			b = b - count * 5
			move_count = move_count + abs(count)
			count = 0
		elif abs(int(x / 2)) > 0:
			count = int(x / 2)
			b = b - count * 2
			move_count = move_count + abs(count)
			count = 0
		elif abs(int(x / 1)) > 0:
			count = count + int(x / 1)
			b = b - count * 1
			move_count = move_count + abs(count)
			count = 0
	print(move_count)


t = int(input())
total = []
for i in range(t):
	z = input()
	(a, b) = z.split()
	a = int(a)
	b = int(b)
	v = abs(a - b)
	ans = 0
	for i in [5, 2, 1]:
		q = int(v / i)
		ans += q
		v = v % i
	total.append(ans)
for i in total:
	print(i)


t = int(input())
i = 0
while i < t:
	(a, b) = map(int, input().split())
	c = abs(a - b)
	count = 0
	q1 = c // 5
	count = count + q1
	r1 = c % 5
	q2 = r1 // 2
	count = count + q2
	r2 = r1 % 2
	q3 = r2 // 1
	count = count + q3
	print(count)
	i = i + 1


import math
n = int(input())
for i in range(n):
	y = input().split(' ')
	a = int(y[0])
	b = int(y[1])
	c = int(math.fabs(a - b))
	sum = 0
	while c > 0:
		if c // 5 > 0:
			sum += c // 5
			c = c % 5
		elif c // 2 > 0:
			sum += c // 2
			c = c % 2
		else:
			sum += c
			c = 0
	print(sum)


q = int(input())
for _ in range(q):
	(w, e) = map(int, input().split())
	w = abs(w - e)
	e = w // 5
	w %= 5
	e += w // 2
	w %= 2
	print(w + e)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_strList_from_str = lambda : list(sys.stdin.readline().strip())
get_int = lambda : int(sys.stdin.readline().strip())
pt = lambda x: sys.stdout.write(str(x))
n = get_int()
for _ in range(n):
	(a, b) = get_list()
	d = abs(a - b)
	lst = [5, 2, 1]
	press = 0
	for i in lst:
		press += d // i
		d = d % i
	print(press)


lt = [0, 1, 1, 2, 2]
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	count = abs(b - a) // 5
	left = abs(b - a) % 5
	count += lt[left]
	print(count)


for __ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	if b < a:
		(a, b) = (b, a)
	ans = 0
	ans += (b - a) // 5
	a = b - (b - a) % 5
	ans += (b - a) // 2
	a = b - (b - a) % 2
	ans += (b - a) // 1
	print(ans)


T = int(input())
while T:
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	elif a < b:
		ans = (b - a) // 5
		a += (b - a) // 5 * 5
		if b - a == 4:
			ans += 2
		elif b - a == 3:
			ans += 2
		elif b - a == 0:
			ans += 0
		else:
			ans += 1
		print(ans)
	else:
		ans = (a - b) // 5
		a -= (a - b) // 5 * 5
		if a - b == 4:
			ans += 2
		elif a - b == 3:
			ans += 2
		elif a - b == 0:
			ans += 0
		else:
			ans += 1
		print(ans)
	T -= 1


n = int(input())
for i in range(n):
	(ai, bi) = map(int, input().split())
	a = abs(bi - ai) % 5
	b = abs(bi - ai) // 5
	if abs(bi - ai) % 5 == 0:
		print(b)
	elif a == 1:
		print(b + 1)
	elif a == 2:
		print(b + 1)
	elif a == 3:
		print(b + 2)
	else:
		print(b + 2)


j = int(input())
k = [1, 2, 5]
for i in range(j):
	a = list(map(int, input().split()))
	if a[0] == a[1]:
		print(0)
		continue
	g = abs(a[0] - a[1])
	f = g // 5
	g -= f * 5
	if g == 0:
		print(f)
		continue
	if g == 1 or g == 2:
		f += 1
	elif g == 3:
		f += 2
	else:
		f += 2
	print(f)


def answer():
	n = int(input())
	while n:
		a = [int(x) for x in input().split()]
		start = a[0]
		end = a[1]
		if start == end:
			print(0)
		else:
			if end < start:
				temp = start
				start = end
				end = temp
			if (end - start) % 5 == 0:
				print(int((end - start) / 5))
			elif (end - start) % 5 == 1 or (end - start) % 5 == 2:
				print(int((end - start) / 5) + 1)
			elif (end - start) % 5 == 3 or (end - start) % 5 == 4:
				print(int((end - start) / 5) + 2)
		n -= 1
answer()


n = int(input())
for i in range(n):
	s = input()
	f = int(s.split(' ')[0])
	t = int(s.split(' ')[1])
	diff = abs(f - t)
	res = diff // 5
	diff = diff % 5
	res += diff // 2
	diff = diff % 2
	res += diff
	print(res)


from collections import defaultdict
from math import log2, floor
from pprint import pprint
mod = pow(10, 9) + 7

def left(a, b):
	if abs(a - b) == 0:
		return 0
	if abs(a - b) == 1 or abs(a - b) == 2:
		return 1
	if abs(a - b) == 3 or abs(a - b) == 4:
		return 2

def fun(a, b):
	res = 0
	if a < b:
		res += abs(a - b) // 5
		a = a + res * 5
		res += left(a, b)
	if a > b:
		res += abs(a - b) // 5
		a = a - res * 5
		res += left(a, b)
	print(res)
for i in range(int(input())):
	(a, b) = map(int, input().split())
	fun(a, b)


from sys import stdin, stdout
import math
from bisect import bisect_left, bisect_right
input = lambda : stdin.readline().strip()
print = lambda s: stdout.write(s)
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	(cnt1, a) = (abs(a - b) // 5, abs(a - b) % 5)
	(cnt2, a) = (a // 2, a % 2)
	cnt = cnt1 + cnt2
	cnt += a
	print(str(cnt) + '\n')


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	(a, b) = (l[0], l[1])
	if b > a:
		diff = b - a
		five_steps = diff // 5
		diff -= five_steps * 5
		if diff == 0:
			print(five_steps)
			continue
		two_steps = diff // 2
		diff -= two_steps * 2
		if diff == 0:
			print(five_steps + two_steps)
			continue
		one_steps = diff // 1
		diff -= one_steps * 1
		if diff == 0:
			print(five_steps + one_steps + two_steps)
			continue
	else:
		diff = a - b
		five_steps = diff // 5
		diff -= five_steps * 5
		if diff == 0:
			print(five_steps)
			continue
		two_steps = diff // 2
		diff -= two_steps * 2
		if diff == 0:
			print(five_steps + two_steps)
			continue
		one_steps = diff // 1
		diff -= one_steps * 1
		if diff == 0:
			print(five_steps + one_steps + two_steps)
			continue


x = int(input())
for i in range(x):
	(x, y) = map(int, input().split())
	c = abs(x - y)
	a = c // 5
	b = (c - a * 5) // 2
	d = (c - a * 5) % 2
	print(a + b + d)


n = int(input())
for i in range(n):
	count = 0
	(a, b) = map(int, input().split())
	x = abs(a - b)
	if x >= 5:
		count = count + x // 5
		x = x % 5
	if x >= 2:
		count = count + x // 2
		x = x % 2
	count = count + x
	print(count)


t = int(input())
for _ in range(0, t):
	(a, b) = list(map(int, input().split()))
	diff = abs(a - b)
	q = diff % 5
	count = diff // 5 + q // 2 + q % 2
	print(count)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	r = b - a
	print(r // 5 + r % 5 // 2 + r % 5 % 2)


upit = int(input())
plus = [5, 2, 1]
while upit:
	c = 0
	pokusaji = 0
	i = 0
	(a, b) = map(int, input().split())
	c = abs(a - b)
	pokusaji += c // 5
	c = c % 5
	if c == 0:
		print(pokusaji)
	else:
		pokusaji += c // 2
		c = c % 2
		if c == 0:
			print(pokusaji)
		else:
			pokusaji += c
			print(pokusaji)
	upit -= 1


n = input()
for i in range(0, int(n)):
	(a, b) = input().split()
	real = abs(int(b) - int(a))
	result = int(real / 5)
	rem = real % 5
	result += int(rem / 2)
	rem = rem % 2
	result += rem
	print(result)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	ans = 0
	df = b - a
	ans += df // 5
	five = df % 5
	ans += five // 2
	two = five % 2
	if two == 1:
		ans += 1
	print(ans)


n = int(input())
a = [[int(i) for i in input().split()] for i in range(n)]
for i in a:
	cnt = 0
	if abs(i[0] - i[1]) >= 5:
		x = abs(i[0] - i[1]) // 5
		cnt += x
		if i[0] > i[1]:
			i[1] += x * 5
		else:
			i[0] += x * 5
	if 0 < abs(i[0] - i[1]) <= 2:
		cnt += 1
	elif abs(i[0] - i[1]) >= 3:
		cnt += 2
	print(cnt)


t = int(input())
while t > 0:
	c = 0
	(a, b) = map(int, input().split())
	li = [5, 2, 1]
	if a > b:
		k = a - b
		for i in range(0, 3):
			c = c + k // li[i]
			k = k % li[i]
			if k == 0:
				break
	else:
		k = b - a
		for i in range(0, 3):
			c = c + k // li[i]
			k = k % li[i]
			if k == 0:
				break
	print(c)
	t = t - 1


t = int(input())
while t:
	(a, b) = map(int, input().split())
	ans = abs(a - b)
	ans1 = ans // 5
	ans2 = (ans - ans1 * 5) // 2
	ans3 = (ans - ans1 * 5 - ans2 * 2) // 1
	Ans = ans1 + ans2 + ans3
	print(Ans)
	t = t - 1


import math
from decimal import Decimal
import heapq
from collections import deque

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def fact(a, b):
	c = []
	ans = 0
	f = int(math.sqrt(a))
	for i in range(1, f + 1):
		if a % i == 0:
			c.append(i)
	l = len(c)
	for i in range(l):
		c.append(a // c[i])
	for i in range(len(c)):
		if c[i] <= b:
			ans += 1
	if a / f == f and b >= f:
		return ans - 1
	return ans
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		d = abs(a - b)
		k1 = d // 5
		d -= k1 * 5
		k2 = d // 2
		d -= k2 * 2
		print(d + k1 + k2)


q = int(input())
for _ in range(q):
	(a, b) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	by5 = (a - b) // 5
	by2 = (a - b - by5 * 5) // 2
	print(by5 + by2 + (a - b - by5 * 5) % 2)


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		k = 0
		t = abs(a - b)
		k += t // 5
		k += (t - k * 5) // 2 + t - (k * 5 + (t - k * 5) // 2 * 2)
		print(k)


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	cnt = 0
	dif = abs(a - b)
	if dif >= 5:
		(c, res) = divmod(dif, 5)
		dif = res
		cnt += c
	if dif >= 2:
		(c, res) = divmod(dif, 2)
		dif = res
		cnt += c
	cnt += dif
	print(cnt)


ii = lambda : int(input())
kk = lambda : map(int, input().split())
ll = lambda : list(kk())
d = [0, 1, 1, 2, 2]
for _ in range(ii()):
	(a, b) = kk()
	print(abs(a - b) // 5 + d[abs(a - b) % 5])


g = ''
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	f = x // 5 + x % 5 // 2 + x % 5 % 2
	g += str(f) + '\n'
print(g)


t = int(input())
while t:
	t += -1
	(a, b) = [int(x) for x in input().split()]
	if a > b:
		(a, b) = (b, a)
	d = b - a
	r = d % 5
	ans = 0
	if r == 0:
		ans = d // 5
	elif r == 1:
		ans = d // 5 + 1
	elif r == 2:
		ans = d // 5 + 1
	elif r == 3:
		ans = d // 5 + 2
	elif r == 4:
		ans = d // 5 + 2
	print(ans)


VOLUME_VALUES = (5, 2, 1)

def foo(val_a: int, val_b: int):
	result: int = 0
	diff: int = abs(val_a - val_b)
	if diff == 0:
		return result
	for v in VOLUME_VALUES:
		_value = diff / v
		if _value == 1.0:
			return result + 1
		elif _value > 1.0:
			result += int(_value)
			diff -= v * int(_value)
	return result
n = input()
for i in range(int(n)):
	value = input()
	(a, b) = value.split(' ')
	print(foo(int(a), int(b)))


steps = [5, 2, 1]
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	cnt = 0
	diff = abs(b - a)
	for i in range(3):
		if diff > 0 and diff >= steps[i]:
			q = diff // steps[i]
			v = q * steps[i]
			diff -= v
			cnt += q
	print(cnt)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n < k:
		(n, k) = (k, n)
	d = n - k
	ans = d // 5
	r = d % 5
	if r == 0:
		print(ans)
	elif r == 1 or r == 2:
		print(ans + 1)
	else:
		print(ans + 2)


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	d = abs(a - b)
	count = 0
	e = d // 5
	c = d % 5
	count = count + e
	if c == 0:
		print(e)
	elif c == 1 or c == 2:
		print(e + 1)
	elif c == 3 or c == 4:
		print(e + 2)
	t = t - 1


T = int(input())
for _ in range(T):
	(a, b) = list(map(int, input().split()))
	button = 0
	dif = abs(a - b)
	button += dif // 5
	dif %= 5
	button += dif // 2
	dif %= 2
	button += dif
	print(button)


import math
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = abs(n - m)
	b = a // 5
	c = a % 5 // 2
	d = a % 5 % 2
	print(b + c + d)


def solve(a, b):
	diff = abs(a - b)
	count = 0
	count += diff // 5
	diff %= 5
	count += diff // 2
	diff %= 2
	count += diff
	return count
T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	print(solve(a, b))


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	ans = 0
	ans += d // 5
	d -= ans * 5
	ans += d // 2
	d -= d // 2 * 2
	ans += d
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	k = abs(a - b)
	ans = k // 5
	a1 = k // 5 * 5
	ans += (k - k // 5 * 5) // 2
	a1 += (k - k // 5 * 5) // 2 * 2
	print(ans + k - a1)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		diff = b - a
		cnt = 0
		while diff > 0:
			if diff >= 5:
				r = diff // 5
				diff = diff - r * 5
				cnt = cnt + r
			elif diff >= 2 and diff < 5:
				r = diff // 2
				diff = diff - r * 2
				cnt = cnt + r
			else:
				r = diff
				cnt += diff
				diff = 0
		print(cnt)
	else:
		diff = a - b
		cnt = 0
		while diff > 0:
			if diff >= 5:
				r = diff // 5
				diff = diff - r * 5
				cnt = cnt + r
			elif diff >= 2 and diff < 5:
				r = diff // 2
				diff = diff - r * 2
				cnt = cnt + r
			else:
				r = diff
				cnt += diff
				diff = 0
		print(cnt)


import math
t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	val = abs(y - x)
	if val == 0:
		print('0')
	else:
		count1 = 0
		count2 = 0
		count5 = 0
		count5 = val // 5
		val = val % 5
		count2 = val // 2
		val = val % 2
		count1 = val
		print(count5 + count2 + count1)


T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	p = 0
	p += d // 5
	d = d % 5
	p += d // 2
	d = d % 2
	p += d
	print(p)


n = int(input())
for i in range(n):
	count = 0
	(a, b) = map(int, input().split(' '))
	c = abs(a - b)
	temp = int(c / 5)
	count += temp
	c -= temp * 5
	temp = int(c / 2)
	count += temp
	c -= temp * 2
	temp = int(c / 1)
	count += temp
	c -= temp * 1
	print(abs(count))


d = {0: 0, 1: 1, 2: 1, 3: 2, 4: 2, 5: 1, 6: 2, 7: 2, 8: 3, 9: 3, 10: 2}
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	t = 0
	if x > 10:
		t = x // 5 - 1
		x -= 5 * t
	print(t + d[x])


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	cnt = 0
	times = abs(b - a)
	if b > a:
		cnt += (b - a) // 5
		times = times % 5
		cnt += times // 2
		times = times % 2
		cnt += times // 1
		times %= 1
		print(cnt)
	elif b == a:
		print(0)
	else:
		(a, b) = (b, a)
		cnt += (b - a) // 5
		times = times % 5
		cnt += times // 2
		times = times % 2
		cnt += times // 1
		times %= 1
		print(cnt)


t = int(input())

def solution(a, b):
	count = 0
	if a == b:
		return 0
	if a < b:
		d = b - a
		count += d // 5
		d %= 5
		count += d // 2
		d %= 2
		count += d
	else:
		d = a - b
		count += d // 5
		d %= 5
		count += d // 2
		d %= 2
		count += d
	return count
for _ in range(t):
	(a, b) = map(int, input().split())
	print(solution(a, b))


def change(a, b):
	dic = {0: 0, 1: 1, -1: 1, 2: 1, -2: 1, 3: 2, -3: 2, 4: 2, -4: 2}
	if a < b:
		c = b - a
		k = c // 5
		k += dic[c % 5]
	else:
		c = a - b
		k = c // 5
		k += dic[c % 5]
	return k
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print(change(a, b))


t = int(input())
otv = []
for i in range(t):
	dob = 0
	(a, b) = map(int, input().split())
	ost = abs(a - b)
	xx = abs(a - b) // 5
	dob += xx
	ost = ost % 5
	xx = ost // 2
	dob += xx
	ost = ost % 2
	dob += ost
	otv.append(dob)
for el in otv:
	print(el)


def main():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		a = abs(a - b)
		print(a // 5 + (a % 5 + 1) // 2)
main()


t = int(input())
for x in range(t):
	aandb = input()
	(a, b) = aandb.split()
	a = int(a)
	b = int(b)
	dif = b - a
	changes = 0
	while dif != 0:
		if dif >= 20 or dif <= -20:
			if dif % 5 == 0:
				changes += abs(int(dif / 5))
				break
			elif (dif + 2) % 5 == 0:
				dif += 2
				changes += abs(int(dif / 5)) + 1
				break
			elif (dif - 2) % 5 == 0:
				dif -= 2
				changes += abs(int(dif / 5)) + 1
				break
			elif (dif + 1) % 5 == 0:
				dif += 1
				changes += abs(int(dif / 5)) + 1
				break
			else:
				dif -= 1
				changes += abs(int(dif / 5)) + 1
				break
		elif dif > 0:
			if dif >= 4:
				a += 5
				dif -= 5
			elif dif >= 2:
				a += 2
				dif -= 2
			else:
				a += 1
				dif -= 1
		elif dif <= -4 and a >= 5:
			a -= 5
			dif += 5
		elif dif <= -2:
			a -= 2
			dif += 2
		else:
			a -= 1
			dif += 1
		changes += 1
	print(changes)


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
INF = 10 ** 20
I = lambda : list(map(int, input().split()))
from collections import defaultdict as dd
from math import gcd
(t,) = I()
while t:
	t -= 1
	(a, b) = I()
	(b, a) = (max(a, b), min(a, b))
	d = b - a
	ans = d // 5
	d %= 5
	ans += d // 2 + d % 2
	print(ans)


import math
n = int(input())
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	c = b - a
	count = 0
	if a < b:
		while c > 0:
			if c >= 5:
				count = count + c // 5
				c = c - 5 * (c // 5)
			elif c < 5 and c >= 2:
				count = count + c // 2
				c = c - 2 * (c // 2)
			else:
				count = count + c // 1
				c = c - 1 * (c // 1)
		print(count)
	elif a > b:
		while c < 0:
			if abs(c) >= 5:
				count = count + abs(c) // 5
				c = c + 5 * (abs(c) // 5)
			elif abs(c) < 5 and abs(c) >= 2:
				count = count + abs(c) // 2
				c = c + 2 * (abs(c) // 2)
			else:
				count = count + abs(c) // 1
				c = c + 1 * (abs(c) // 1)
		print(count)
	else:
		print(0)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	if d == 0:
		print(0)
		continue
	ans = d // 5
	x = d % 5
	if x == 0:
		print(ans)
	elif x == 1:
		print(ans + 1)
	elif x == 2:
		print(ans + 1)
	elif x == 3:
		print(ans + 2)
	else:
		print(ans + 2)


from math import *
from cmath import *
from itertools import *
from decimal import *
from fractions import *
from sys import *
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	x = abs(m - n)
	print(x // 5 + x % 5 // 2 + x % 5 % 2)


t = int(input())
while t > 0:
	w = input().split()
	a = int(w[0])
	b = int(w[1])
	m = abs(a - b)
	if a == b:
		print('0')
	else:
		q = int(m / 5)
		r = m % 5
		if r == 0:
			print(q)
		elif r >= 3:
			q += 2
			print(q)
		else:
			q += 1
			print(q)
	t -= 1


def before(x):
	if x < 5:
		if x == 4:
			return 2
		elif x == 2:
			return 1
		elif x == 3:
			return 2
		elif x == 1:
			return 1
		elif x == 0:
			return 0
	elif x == 5:
		return 1
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	if x <= 5:
		ans = before(x)
		print(ans)
	else:
		ans = x % 5
		ans1 = x // 5
		ans2 = before(ans)
		print(ans1 + ans2)


movesm = [-5, -2, -1]
movesp = [1, 2, 5]
count = 0
T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		dif = abs(b - a)
		c5 = dif // 5
		dif %= 5
		c2 = dif // 2
		dif %= 2
		c1 = dif // 1
		count = c5 + c2 + c1
		print(count)


n = int(input())
for i in range(n):
	(a, b) = (int(s) for s in input().split())
	ab = abs(a - b)
	out = 0
	if ab // 5 != 0:
		out += ab // 5
	ab -= ab // 5 * 5
	if ab // 2 != 0:
		out += ab // 2
	ab -= ab // 2 * 2
	if ab != 0:
		out += ab
	print(out)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	print((b - a) // 5 + ((b - a) % 5 + 1) // 2)


t = int(input())
for t in range(0, t):
	(a, b) = [int(x) for x in input().split()]
	dif = abs(a - b)
	x = dif // 5
	r = dif % 5
	y = r // 2
	r = r % 2
	print(x + y + r)


n = int(input())
l = [-5, -2, -1, 1, 2, 5]
for i in range(n):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	count = 0
	c = abs(a - b)
	if c >= 5:
		count += c // 5
		c %= 5
	if c >= 2:
		count += c // 2
		c = c % 2
	count += c
	print(count)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	x = max(a, b)
	y = min(a, b)
	n1 = (x - y) // 5
	d = (x - y) % 5
	n2 = d // 2
	n3 = d % 2
	print(n1 + n2 + n3)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	print(abs(x - y) // 5 + (abs(x - y) % 5 + 1) // 2)


t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	diff = abs(a - b)
	fives = diff // 5
	noFives = diff % 5
	twos = noFives // 2
	one = noFives % 2
	print(fives + twos + one)


t = int(input())
for ti in range(t):
	try:
		(a, b) = input().split()
		a = int(a)
		b = int(b)
		if a < b:
			k = b - a
			ans = int(k / 5) + int(k % 5 / 2) + int(k % 5 % 2)
			print(ans)
		elif b < a:
			k = a - b
			ans = int(k / 5) + int(k % 5 / 2) + int(k % 5 % 2)
			print(ans)
		else:
			print('0')
	except:
		pass


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	incr = abs(b - a)
	count = 0
	if incr >= 5:
		num5 = incr // 5
		count += num5
		incr -= 5 * num5
	if incr >= 2:
		num2 = incr // 2
		count += num2
		incr -= 2 * num2
	if incr >= 1:
		count += 1
	print(count)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	su = 0
	for i in [5, 2, 1]:
		if diff == 0:
			break
		else:
			su += diff // i
			diff %= i
	print(su)


c = int(input())
for k in range(c):
	(a, b) = list(map(int, input().split()))
	d = abs(a - b)
	print(d // 5 + d % 5 // 2 + d % 5 % 2)


for i in [0] * int(input()):
	ct = 0
	(a, b) = map(int, input().split())
	c = abs(a - b)
	ct += c // 5
	ct += (c - c // 5 * 5) // 2
	ct += (c - c // 5 * 5 - (c - c // 5 * 5) // 2 * 2) // 1
	print(ct)


def main():
	t = int(input())
	for _ in range(t):
		(a, b) = list(map(int, input().split()))
		n = 0
		n += abs(a - b) // 5
		n += abs(a - b) % 5 // 2
		n += abs(a - b) % 5 % 2
		print(n)
main()


n = int(input())

def min_press(a, b):
	if a == b:
		return 0
	elif a > b:
		count = (a - b) // 5 + (a - b) % 5 // 2 + (a - b) % 5 % 2
	else:
		count = (b - a) // 5 + (b - a) % 5 // 2 + (b - a) % 5 % 2
	return count
for test in range(n):
	(a, b) = map(int, input().strip().split())
	print(min_press(a, b))


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	a = abs(n - m)
	c = 0
	if a >= 5:
		c = c + a // 5
		a = a % 5
	if a >= 2:
		c = c + a // 2
		a = a % 2
	if a >= 1:
		c = c + a // 1
		a = a % 1
	print(c)


from collections import defaultdict, deque
from itertools import permutations
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
int_input = lambda : int(stdin.readline())
string_input = lambda : stdin.readline()
multi_int_input = lambda : map(int, stdin.readline().split())
multi_input = lambda : stdin.readline().split()
list_input = lambda : list(map(int, stdin.readline().split()))
string_list_input = lambda : list(string_input())
MOD = pow(10, 9) + 7
test = int_input()
for _ in range(test):
	(a, b) = multi_int_input()
	diff = abs(a - b)
	count = 0
	count += diff // 5
	diff = diff % 5
	count += diff // 2
	diff = diff % 2
	if diff == 1:
		count += 1
	print(count)


for t in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	ans = 0
	x = c % 5
	ans += c // 5
	y = x % 2
	ans += x // 2
	ans += y
	print(ans)


n = int(input())
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if a == b:
		print(0)
	else:
		d = abs(b - a)
		if d == 1:
			print(1)
		elif d < 5:
			print(d % 2 + d // 2)
		else:
			q = int(round(d / 5))
			if b < a and a - q * 5 < 0:
				q -= 1
			d = abs(d - q * 5)
			print(d % 2 + d // 2 + q)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	for i in range(1):
		w = abs(a - b)
		five = w // 5
		w = w % 5
		two = w // 2
		w = w % 2
		one = w
		print(one + two + five)


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	k = abs(a - b)
	cnt = 0
	while k != 0:
		if k / 5 >= 1:
			cnt += int(k / 5)
			k = k % 5
		elif k / 2 >= 1:
			cnt += int(k / 2)
			k = k % 2
		elif k / 1 >= 1:
			cnt += int(k / 1)
			k = k % 1
	print(cnt)


q = int(input())
for i in range(q):
	(a, b) = map(int, input().split())
	if a > b:
		rem = a - b
		count = 0
		while rem > 0:
			if rem >= 5:
				count = count + int(rem / 5)
				rem = rem - int(rem / 5) * 5
			elif rem >= 2 and rem < 5:
				count = count + int(rem / 2)
				rem = rem - int(rem / 2) * 2
			elif rem > 0 and rem < 2:
				count = count + 1
				rem = rem - 1
	elif b > a:
		rem = b - a
		count = 0
		while rem > 0:
			if rem >= 5:
				count = count + int(rem / 5)
				rem = rem - int(rem / 5) * 5
			elif rem >= 2 and rem < 5:
				count = count + int(rem / 2)
				rem = rem - int(rem / 2) * 2
			elif rem > 0 and rem < 2:
				rem = rem - 1
				count = count + 1
	else:
		count = 0
	print(count)


import math
from collections import Counter
from itertools import permutations, combinations
import fractions

def solve():
	(a, b) = [int(s) for s in input().split(' ')]
	diff = abs(a - b)
	ans = diff // 5
	rem = diff % 5
	if rem == 0:
		ans += 0
	elif rem >= 3:
		ans += 2
	else:
		ans += 1
	print(ans)
t = int(input())
for _ in range(t):
	solve()


for i in range(int(input())):
	(n, d) = map(int, input().split())
	diff = abs(n - d)
	five = diff // 5
	diff2 = diff % 5
	two = diff2 // 2
	one = diff2 % 2
	print(one + two + five)


q = int(input())
j = 0
inp = []
u = []
while j < q:
	k = input().split(' ')
	inp.append(k)
	j += 1
l = len(inp)
res = []
i = 0
d1 = 0
r1 = 0
d2 = 0
r2 = 0
tf = 0
while i < l:
	p = inp[i]
	a = int(p[0])
	b = int(p[1])
	df = abs(a - b)
	if df > 5:
		d1 = int(df / 5)
		r1 = df % 5
		if r1 >= 2:
			d2 = int(r1 / 2)
			r2 = r1 % 2
		elif df % 5 == 0:
			d2 = 0
			r2 = 0
		else:
			d2 = 0
			r2 = 1
		tf = d1 + d2 + r2
	elif df == 4 or df == 3:
		tf = 2
	elif df == 2 or df == 1 or df == 5:
		tf = 1
	elif df == 0:
		tf = 0
	res.append(tf)
	i += 1
g = 0
while g < l:
	print(res[g])
	g += 1


for _ in range(int(input())):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	di = a - b
	if di < 0:
		di = -di
	ans = 0
	if di >= 5:
		ans += di // 5
		di = di % 5
	if di >= 2:
		ans += di // 2
		di = di % 2
	if di >= 1:
		ans += di // 1
		di = di % 1
	print(ans)


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	c = abs(a - b)
	r = c % 5
	sum = c // 5
	if c == 0:
		sum = 0
	elif r == 1 or r == 2:
		sum = sum + 1
	elif r != 0:
		sum = sum + 2
	print(sum)


n = int(input())
a = []
(d, s) = (0, 0)
for i in range(n):
	(x, y) = map(int, input().split())
	a.append(x)
	a.append(y)
	a.sort()
	d = a[1] - a[0]
	if x == y:
		print(s)
	elif x != y:
		if d > 0 and d // 5 >= 1:
			s = s + d // 5
			d = d - d // 5 * 5
		if d > 0 and d // 2 >= 1:
			s = s + d // 2
			d = d - d // 2 * 2
		if d > 0 and d // 1 >= 1:
			s = s + d // 1
			d = d - d // 1 * 1
		print(s)
	(d, s) = (0, 0)
	a.clear()


import sys, math
MOD = 10 ** 9 + 7
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	(ans, d) = (d // 5, d % 5)
	(ans, d) = (ans + d // 2, d % 2)
	ans += d
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	sum = abs(a - b)
	res = sum // 5 + sum % 5 // 2 + sum % 5 % 2
	print(res)


for j in range(int(input())):
	(s, o) = list(map(int, input().split()))
	l = abs(s - o)
	k = l // 5
	m = l % 5
	n = m % 2
	w = m // 2
	print(k + n + w)


def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())
mod = 1000000000.0
t = ii()
while t:
	t -= 1
	(a, b) = mi()
	x = abs(b - a)
	c = x // 5
	x = x % 5
	c += x // 2
	x %= 2
	c += x
	print(c)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = abs(a - b)
	n = ans // 5
	m = (ans - 5 * n) // 2
	if ans - 5 * n - 2 * m != 0:
		print(n + m + 1)
	else:
		print(n + m)


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	auX = min(x, y)
	auY = max(x, y)
	auY = auY - auX
	auX = 0
	acu = 0
	ans = auY
	if ans >= 5:
		acu = ans // 5
		ans = ans - ans // 5 * 5
	if ans >= 2:
		acu += ans // 2
		ans = ans - ans // 2 * 2
	if ans > 0:
		acu += ans
	print(acu)


case = int(input())
for i in range(case):
	(a, b) = (int(v) for v in input().split())
	d = abs(a - b)
	print(d // 5 + d % 5 // 2 + d % 5 % 2)


vol = [1, 2, 5]
for i in range(int(input())):
	(a, b) = map(int, input().split())
	resvol = abs(a - b)
	result = 0
	for i in vol[::-1]:
		result += resvol // i
		resvol %= i
		if resvol == 0:
			continue
	print(result)


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	k = abs(a - b) // 5
	k1 = abs(a - b) % 5
	if k1 == 1 or k1 == 2:
		k += 1
	elif k1 == 3 or k1 == 4:
		k += 2
	print(k)
	t -= 1


test_cases = int(input())

def presses(vol):
	presses = vol // 5
	vol = vol % 5
	presses += vol // 2
	vol = vol % 2
	return presses + vol
for i in range(test_cases):
	(current_vol, desired_vol) = map(int, input().split())
	change_in_volume = abs(current_vol - desired_vol)
	print(presses(change_in_volume))


from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
mod = 10 ** 9 + 7
eps = 10 ** (-7)

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def inpl_str():
	return list(sys.stdin.readline().split())
T = inp()
for _ in range(T):
	(a, b) = inpl()
	d = abs(a - b)
	if d % 5 == 0:
		print(d // 5)
	elif d % 5 == 1 or d % 5 == 2:
		print(d // 5 + 1)
	else:
		print(d // 5 + 2)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	diff = abs(n - m)
	total = 0
	rem = 0
	if diff % 5 == 0:
		print(diff // 5)
	else:
		total += diff // 5
		rem = diff % 5
		total += rem // 2
		rem = rem % 2
		total += rem
		print(total)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		d = abs(a - b)
		num = d
		c = 0
		while d > 0:
			if d >= 5:
				num = d // 5
				d = d % 5
				c += num
			if d < 5 and d >= 2:
				num = d // 2
				d = d % 2
				c += num
			else:
				num = d // 1
				d = d % 1
				c += num
		print(c)


T = int(input().strip())

def sol(a, b):
	a_b = a - b
	ans1 = a_b // 5
	result1 = a_b % 5
	if result1 != 0:
		ans1 += result1 // 2
		result1 = result1 % 2
		if result1 != 0:
			ans1 += 1
	return ans1
for _ in range(T):
	(a, b) = map(int, input().strip().split())
	if a > b:
		print(sol(a, b))
	elif b > a:
		print(sol(b, a))
	else:
		print(0)


t = int(input())
while t:
	t -= 1
	(a, b) = tuple(map(int, input().split()))
	if b < a:
		(b, a) = (a, b)
	diff = b - a
	ans = 0
	ans += diff // 5
	diff = diff % 5
	ans += diff // 2
	diff = diff % 2
	ans += diff
	print(ans)


x = int(input())
a = []
for i in range(x):
	a.append([int(j) for j in input().split()])
for i in a:
	minn = 0
	dif = abs(i[0] - i[1])
	minn += dif // 5
	temp = dif % 5
	minn += temp // 2
	temp = temp % 2
	minn += temp // 1
	print(minn)


T = int(input())
for t in range(T):
	(a, b) = map(int, input().split())
	delta = abs(a - b)
	res = delta // 5
	baka = delta % 5
	if baka in (1, 2):
		res += 1
	if baka in (3, 4):
		res += 2
	print(res)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	(total, d) = divmod(d, 5)
	while d >= 2:
		total += 1
		d -= 2
	while d >= 1:
		total += 1
		d -= 1
	print(total)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	dif = abs(a - b)
	cnt = dif // 5
	dif %= 5
	if dif == 1:
		print(cnt + 1)
	else:
		cnt += dif // 2
		dif %= 2
		cnt += dif
		print(cnt)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	delta = abs(a - b)
	ans = delta // 5
	delta %= 5
	if 3 > delta > 0:
		ans += 1
	elif delta > 2:
		ans += 2
	print(ans)


T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	if abs(b - a) % 5 == 0:
		print(abs(b - a) // 5)
	elif abs(b - a) % 5 == 1:
		print(abs(b - a) // 5 + 1)
	elif abs(b - a) % 5 == 2:
		print(abs(b - a) // 5 + 1)
	elif abs(b - a) % 5 == 3:
		print(abs(b - a) // 5 + 2)
	elif abs(b - a) % 5 == 4:
		print(abs(b - a) // 5 + 2)


def min_presses(a, b):
	if a == b:
		return 0
	current_dist = abs(a - b)
	if b < 3 and a < b:
		s1 = current_dist // 5
		s2 = (current_dist - 5 * s1) // 2
		return s1 + s2 + (current_dist - s1 * 5 - s2 * 2)
	else:
		r = current_dist % 5
		if r == 1 or r == 2:
			return current_dist // 5 + 1
		elif r == 3 or r == 4:
			return current_dist // 5 + 2
		else:
			return current_dist // 5
q = int(input())
for i in range(q):
	(a, b) = map(int, input().split())
	print(min_presses(a, b))


for k in range(int(input())):
	(a, b) = map(int, input().split())
	diferenca = abs(a - b)
	contador = 0
	if diferenca >= 5:
		aux = diferenca // 5
		contador += aux
		diferenca -= 5 * aux
	if diferenca >= 2:
		aux = diferenca // 2
		contador += aux
		diferenca -= 2 * aux
	if diferenca >= 1:
		contador += diferenca
		diferenca = 0
	print(contador)


t = int(input())
ans = []
for i in range(t):
	(a, b) = [int(i) for i in input().split()]
	n = max(a, b) - min(a, b)
	s = 0
	s += n // 5
	n = n % 5
	s += n // 2
	n = n % 2
	s += n
	ans.append(s)
[print(i) for i in ans]


from sys import stdin, stdout
d = {0: 0, 1: 1, 2: 1, 3: 2, 4: 2, 5: 1}

def calculate(diff):
	first = diff // 5
	diff = diff - first * 5
	second = diff // 2
	diff = diff - second * 2
	if diff == 1:
		first += 1
	return first + second
test_cases = int(stdin.readline())
for i in range(test_cases):
	line = stdin.readline()[:-1].split(' ')
	first = int(line[0])
	second = int(line[1])
	stdout.write(str(calculate(abs(first - second))) + '\n')


for i in range(int(input())):
	(x, y) = [int(i) for i in input().split()]
	z = 0
	z += abs(x - y) // 5
	a = abs(x - y) % 5
	if a == 1 or a == 2:
		z += 1
	elif a == 4 or a == 3:
		z += 2
	print(z)


for nt in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	print((b - a) // 5 + (b - a) % 5 // 2 + (b - a) % 5 % 2)


t = int(input())
while t > 0:
	(a, b) = [int(ele) for ele in input().split()]
	count = 0
	if a == b:
		print(0)
	else:
		diff = abs(a - b)
		count = diff // 5
		diff %= 5
		count += diff // 2
		diff %= 2
		count += diff
		print(count)
	t -= 1


t = int(input())
i = 0
e = [0] * t
for i in range(t):
	(a, b) = list(map(int, input().split()))
	k = abs(a - b)
	f = k // 5
	w = k % 5
	if w == 4 or w == 3:
		f = f + 2
	elif w == 2 or w == 1:
		f += 1
	else:
		f = f + 0
	e[i] = f
i = 0
for i in range(t):
	print(e[i])


t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().strip().split())
	count = 0
	if a == b:
		print(count)
	else:
		count += abs(a - b) // 5
		a = a - 5 * count if a > b else a + count * 5
		d = abs(a - b)
		if d == 4 or d == 3:
			count += 2
		elif d != 0:
			count += 1
		print(count)


def changingvolume(n):
	for _ in range(n):
		(a, b) = map(int, input().split())
		k = abs(b - a) // 5
		r = abs(b - a) % 5
		k1 = r // 2
		r1 = r % 2
		print(k + k1 + r1)

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


n = int(input())
l = []
for i in range(n):
	m = list(map(int, input().split()))
	l.append(m)
for i in l:
	dif = abs(i[0] - i[1])
	f = dif // 5
	s = (dif - f * 5) // 2
	o = (dif - f * 5 - s * 2) // 1
	print(s + f + o)


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	m = abs(a - b)
	t = m // 5
	m = m % 5
	t += m // 2
	m = m % 2
	t += m
	print(t)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	fives = diff // 5
	diff %= 5
	twos = diff // 2
	diff %= 2
	ones = diff
	print(fives + twos + ones)


t = int(input())
while t:
	(a, b) = map(int, input().split(' '))
	switch = int(abs(a - b))
	sum = switch // 5 + (switch - switch // 5 * 5) // 2 + (switch - switch // 5 * 5 - (switch - switch // 5 * 5) // 2 * 2)
	print(sum)
	t -= 1


for i in ' ' * int(input()):
	(a, b) = map(int, input().split())
	k = abs(b - a)
	c = 0
	c += k // 5
	k %= 5
	if k > 3:
		c += 1
		k = 5 - k
	c += k // 2
	k %= 2
	c += k
	print(c)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	k = abs(a - b)
	ans = k // 5
	k %= 5
	ans += k // 2
	k %= 2
	ans += k
	print(ans)


r = input
for _ in [0] * int(r()):
	(a, b) = map(int, r().split())
	c = abs(b - a)
	d = c // 5
	c %= 5
	d += c // 2
	c %= 2
	d += c
	print(d)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	total = 0
	total += d // 5
	d %= 5
	total += d // 2
	d %= 2
	total += d
	print(total)


numb = int(input())
lis = []
for i in range(0, numb):
	x = str(input())
	don = x.split(' ')
	for i in range(0, len(don)):
		don[i] = int(don[i])
	lis.append(don)

def mul(I5):
	numbut = 0
	if I5 // 5 != 0:
		numbut = I5 // 5
		I5 -= I5 // 5 * 5
	if I5 // 2 != 0:
		numbut += I5 // 2
		I5 -= I5 // 2 * 2
	numbut += I5
	return numbut

def testN(L):
	deff = L[1] - L[0]
	ans = 0
	if deff == 0:
		print(0)
	elif deff > 0:
		print(mul(deff))
	else:
		print(mul(-deff))
for ji in range(numb):
	testN(lis[ji])


import math
for q in range(int(input())):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	ans = abs(a - b)
	if a == b:
		print(0)
	else:
		print(ans // 5 + ans % 5 // 2 + ans % 5 % 2)


from sys import stdin
t = int(stdin.readline().rstrip())
while t > 0:
	(a, b) = map(int, stdin.readline().split())
	c = 0
	k = 0
	if a == b:
		k = 0
	elif a > b:
		k = a - b
	else:
		k = b - a
	if k >= 5:
		c += k // 5
		k = k % 5
	if k >= 2:
		c += k // 2
		k = k % 2
	if k >= 1:
		c += k
		k = 0
	print(c)
	t -= 1


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		k = b - a
		x = k // 5
		k = k - x * 5
		y = k // 2
		k = k - y * 2
		print(x + y + k)
	elif a > b:
		k = a - b
		x = k // 5
		k = k - x * 5
		y = k // 2
		k = k - y * 2
		print(x + y + k)
	else:
		print(0)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	c = max(a, b) - min(a, b)
	n = c // 5
	c = c % 5
	n += c // 2
	c = c % 2
	n += c
	print(n)


T = int(input())
if 1 <= T <= 1000:
	for i in range(T):
		(a, b) = input().split()
		a = int(a)
		b = int(b)
		x = a - b
		y = b - a
		if a > b:
			p = x // 5
			if p >= 1:
				q = x - 5 * p
				r = q // 2
				if r >= 1:
					s = q - 2 * r
					if s == 1 or s == 0:
						z = p + r + s
						print(z)
				elif r == 0:
					if q == 0 or q == 1:
						z = p + q
						print(z)
			elif p == 0:
				u = x // 2
				if u >= 1:
					s = x - 2 * u
					if s == 0 or s == 1:
						z = u + s
						print(z)
				elif u == 0:
					print(x)
		elif a == b:
			print(0)
		elif a < b:
			p = y // 5
			if p >= 1:
				q = y - 5 * p
				r = q // 2
				if r >= 1:
					s = q - 2 * r
					if s == 1 or s == 0:
						z = p + r + s
						print(z)
				elif r == 0:
					if q == 0 or q == 1:
						z = p + q
						print(z)
			elif p == 0:
				u = y // 2
				if u >= 1:
					s = y - 2 * u
					if s == 0 or s == 1:
						z = u + s
						print(z)
				elif u == 0:
					print(y)


t = int(input())
sum = 0
n = 0
while t:
	t = t - 1
	(a, b) = map(int, input().split())
	sum = abs(a - b)
	if sum == 2:
		print('1')
	elif sum == 1:
		print('1')
	elif sum % 5 == 0:
		print(sum // 5)
	elif sum % 5 != 0:
		n = sum % 5
		if n == 2 or n == 1:
			print(sum // 5 + 1)
		else:
			print(sum // 5 + 2)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	(a, b) = sep()
	(a, b) = (min(a, b), max(b, a))
	if a == b:
		print(0)
		return
	cnt = (b - a) // 5
	rem = (b - a) % 5
	if rem >= 3:
		cnt += 2
	elif rem != 0:
		cnt += 1
	print(cnt)
testcase(int(inp()))


t = int(input())
for q in range(t):
	entrada = input().split(' ')
	a = int(entrada[0])
	b = int(entrada[1])
	cont = 0
	if a == b:
		print(cont)
	else:
		maximo = max(a, b)
		minimo = min(a, b)
		while maximo != minimo:
			if maximo - minimo >= 5:
				dif = (maximo - minimo) // 5
				minimo += dif * 5
				cont += dif
			elif maximo - minimo >= 2:
				dif = (maximo - minimo) // 2
				minimo += dif * 2
				cont += dif
			elif maximo - minimo >= 1:
				dif = (maximo - minimo) // 1
				minimo += dif * 1
				cont += dif
		print(cont)


def sol():
	T = int(input())
	for i in range(T):
		(a, b) = map(int, input().split())
		res = a - b
		rr = 0
		if res < 0:
			res *= -1
		rr += res // 5
		res = res % 5
		rr += res // 2
		res = res % 2
		rr += res
		print(rr)
sol()


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = int(input())
for tt in range(t):
	(a, b) = map(int, sys.stdin.readline().split(' '))
	ans = 0
	if a > b:
		temp = b
		b = a
		a = temp
	diff = b - a
	ans += diff // 5
	diff %= 5
	ans += diff // 2
	diff %= 2
	ans += diff
	print(ans)
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


def volume(x, y):
	diff = abs(x - y)
	return diff // 5 + diff % 5 // 2 + diff % 5 % 2
for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	print(volume(a, b))


q = int(input())
for i in range(q):
	(a, b) = map(int, input().split(' '))
	if a == b:
		print(0)
	elif a != b:
		diff = abs(a - b)
		n = 0
		if diff >= 5:
			x = diff // 5
			n += x
			diff = diff % 5
		if diff >= 2 and diff < 5:
			x = diff // 2
			n += x
			diff = diff % 2
		if diff < 2:
			n += diff
			diff = 0
		print(n)


for t in range(int(input())):
	(a, b) = map(int, input().split())
	l = [5, 2, 1]
	c = 0
	r = abs(a - b)
	for i in l:
		c += r // i
		r %= i
	print(c)


def presses(no, diff):
	if diff == 0:
		return no
	elif diff >= 5:
		a = (diff - diff % 5) / 5
		return presses(no + int(a), abs(diff - int(a) * 5))
	elif diff >= 2:
		return presses(no + 1, abs(diff - 2))
	else:
		return presses(no + 1, abs(diff - 1))
for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	num = presses(0, abs(b - a))
	print(num)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	delta = abs(a - b)
	if delta == 5 or delta == 2 or delta == 1:
		print(1)
	elif delta == 0:
		print(0)
	else:
		ans = delta // 5
		if a < b:
			a += delta // 5 * 5
		else:
			a -= delta // 5 * 5
		delta = delta % 5
		if delta == 1 or delta == 2:
			ans += 1
		elif delta == 0:
			ans += 0
		else:
			ans += 2
		print(ans)


def I():
	return map(int, input().split())
for _ in range(int(input())):
	(a, b) = sorted(I())
	print((b - a) // 5 + (b - a - (b - a) // 5 * 5) // 2 + (b - a - (b - a) // 5 * 5) % 2)


q = int(input())
for t in range(q):
	(a, b) = map(int, input().split())
	dif = b - a
	res = 0
	if dif > 0:
		res += dif // 5
		if dif % 5 == 0:
			print(res)
		elif dif % 5 == 1:
			print(res + 1)
		elif dif % 5 == 2:
			print(res + 1)
		elif dif % 5 == 3:
			print(res + 2)
		elif dif % 5 == 4:
			print(res + 2)
	elif dif < 0:
		dif = abs(dif)
		res += dif // 5
		if dif % 5 == 0:
			print(res)
		elif dif % 5 == 1:
			print(res + 1)
		elif dif % 5 == 2:
			print(res + 1)
		elif dif % 5 == 3:
			print(res + 2)
		elif dif % 5 == 4:
			print(res + 2)
	else:
		print(0)


t = int(input())
while t:
	cou = 0
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	a = a - b
	cou += a // 5
	a = a - a // 5 * 5
	cou += a // 2
	a = a - a // 2 * 2
	cou += a
	print(cou)
	t -= 1


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	ans = (b - a) // 5
	a += 5 * ans
	k = (b - a) // 2
	ans += k
	a += 2 * k
	ans += b - a
	print(ans)


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	ans = []
	for _ in range(n):
		(a, b) = LI()
		cnt = 0
		if a < b:
			while True:
				x = b - a
				if b - a >= 5:
					_cnt = x // 5
					cnt += _cnt
					a += _cnt * 5
				elif b - a >= 2:
					a += 2
					cnt += 1
				elif b - a >= 1:
					a += 1
					cnt += 1
				else:
					ans.append(cnt)
					break
		else:
			_a = a
			_b = b
			b = _a
			a = _b
			x = b - a
			while True:
				if b - a >= 5:
					_cnt = x // 5
					cnt += _cnt
					a += _cnt * 5
				elif b - a >= 2:
					a += 2
					cnt += 1
				elif b - a >= 1:
					a += 1
					cnt += 1
				else:
					ans.append(cnt)
					break
	for x in ans:
		print(x)
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = abs(b - a)
	ans = x // 5
	x %= 5
	if x == 3 or x == 4:
		print(ans + 2)
	elif x == 1 or x == 2:
		print(ans + 1)
	else:
		print(ans)


for _ in range(int(input())):
	s = list(map(int, input().split()))
	t = 0
	k = abs(s[1] - s[0])
	a = k / 5
	b = k % 5
	if a == 0:
		if b == 0:
			print(int(t))
			continue
		elif 3 > b > 0:
			t += 1
		elif 5 > b >= 3:
			t += 2
	else:
		t += a
		if b == 0:
			print(int(t))
			continue
		elif 3 > b > 0:
			t += 1
		elif 5 > b >= 3:
			t += 2
	print(int(t))


n = int(input())
for k in range(n):
	a = [int(i) for i in input().split()]
	d = abs(a[0] - a[1])
	kol = d // 5
	rs = d % 5
	if rs == 0:
		rz = kol
	if rs == 1 or rs == 2:
		rz = kol + 1
	if rs == 3 or rs == 4:
		rz = kol + 2
	if d == 0:
		rz = 0
	print(rz)


rr = lambda : input().strip()
rri = lambda : int(rr())
rrm = lambda : [int(x) for x in rr().split()]

def sol(a, b):
	if a == b:
		return 0
	res = 0
	x = abs(a - b)
	res += x // 5
	if x % 5 == 0:
		return res
	x %= 5
	res += x // 2
	if x % 2 == 0:
		return res
	return res + 1
T = rri()
for _ in range(T):
	(a, b) = rrm()
	ans = sol(a, b)
	print(ans)


def change(a, b):
	if a == b:
		return 0
	diff = abs(b - a)
	c = diff // 5
	diff = diff - c * 5
	d = diff // 2
	diff = diff - d * 2
	if diff == 0:
		return d + c
	else:
		return d + c + 1
t = int(input())
L = []
for i in range(t):
	a = input()
	(a, b) = a.split()
	L.append(change(int(a), int(b)))
for a in L:
	print(a)


t = int(input())
for I in range(t):
	(a, b) = [int(i) for i in input().split()]
	diff = abs(a - b)
	ans = 0
	ans += diff // 5
	diff %= 5
	ans += diff // 2
	diff %= 2
	ans += diff
	print(ans)


t = int(input())
dp = [0, 1, 1, 2, 2, 1, 2, 2, 3, 3, 2]
for i in range(t):
	(a, b) = map(int, input().split())
	res = abs(a - b) // 10 * 2 + dp[abs(a - b) % 10]
	print(res)


for x in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	d = [5, 2, 1]
	s = 0
	for y in range(3):
		e = c % d[y]
		s += c // d[y]
		c = e
		if c == 0:
			break
	print(s)


import sys

class AChangingVolume:

	def solve(self):
		for _ in range(int(input())):
			(a, b) = [int(_) for _ in input().split()]
			d = abs(a - b)
			print(d // 5 + d % 5 // 2 + d % 5 % 2)
solver = AChangingVolume()
input = sys.stdin.readline
solver.solve()


x = int(input())
for i in range(x):
	(a, b) = map(int, input().split())
	if a <= b:
		r = (b - a) % 5
		k = (b - a) // 5
		if r == 1 or r == 2:
			print(k + 1)
		elif r == 0:
			print(k)
		else:
			print(k + 2)
	else:
		k = (a - b) // 5
		r = (a - b) % 5
		if r == 1 or r == 2:
			print(k + 1)
		elif r == 0:
			print(k)
		elif r == 3:
			print(k + 2)
		else:
			print(k + 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	z = abs(a - b)
	ans = j = z // 5
	k = (z - ans * 5) // 2
	ans += k
	k = z - j * 5 - k * 2
	ans = ans + k
	print(ans)


import sys, math

def input():
	return sys.stdin.readline()[:-1]

def main():
	q = int(input())
	for _ in range(q):
		(a, b) = map(int, input().split())
		d = abs(b - a)
		print(d // 5 + d % 5 // 2 + d % 5 % 2)
main()


t = int(input())
for i in range(t):
	temp = [int(x) for x in input().split()]
	a = temp[0]
	b = temp[1]
	if abs(a - b) % 5 == 0:
		print(abs(a - b) // 5)
	elif a < b:
		print((b - 3 - a) // 5 + 2)
	elif a > b:
		print((a - (b + 3)) // 5 + 2)
	else:
		print(0)


t = int(input())
for i in range(0, t):
	(a, b) = [int(x) for x in input().split()]
	h = a - b
	f = 0
	if h < 0:
		h = h * -1
	f = f + h // 5
	h = h % 5
	f = f + h // 2
	h = h % 2
	f = f + h
	print(f)


t = int(input())
while t > 0:
	t = t - 1
	(a, b) = map(int, input().split())
	d = abs(a - b)
	count = 0
	while d > 0:
		temp = d % 5
		count += d // 5
		d = temp
		temp = d % 2
		count += d // 2
		d = temp
		temp = d % 1
		count += d // 1
		d = temp
	print(count)


for u in range(int(input())):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	ans = d // 5
	d = d % 5
	ans += d // 2
	d = d % 2
	ans += d
	print(ans)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	d = abs(a - b)
	r = d % 5 // 2 + d % 5 % 2
	ans = d // 5 + r
	print(ans)


def main():
	ans = []
	t = int(input())
	for _ in range(t):
		(a, b) = tuple(map(int, input().split()))
		if a == b:
			cnt = 0
		else:
			cnt = 0
			diff = abs(b - a)
			cnt += diff // 5
			diff -= 5 * (diff // 5)
			cnt += diff // 2
			diff -= 2 * (diff // 2)
			cnt += diff // 1
			diff -= 1 * (diff // 1)
		ans.append(cnt)
	for a in ans:
		print(a)
main()


def result(c):
	count = 0
	if c >= 5:
		count = count + c // 5
		c = c - c // 5 * 5
	if c >= 2:
		count = count + c // 2
		c = c - c // 2 * 2
	if c == 1:
		count = count + c
		c = c - c
	print(count)

def calculate(a, b):
	if a == b:
		print('0')
	elif a > b:
		result(a - b)
	else:
		result(b - a)
test = int(input())
while test:
	(a, b) = map(int, input().split(' '))
	calculate(a, b)
	test -= 1


T = int(input())
for i in range(T):
	(a, b) = [int(s) for s in input().split()]
	diff = abs(b - a)
	x = diff
	if diff % 5 == 4:
		print((diff + 1) // 5 + 1)
	else:
		(diff5, b) = divmod(diff, 5)
		diff -= diff5 * 5
		(diff2, d) = divmod(diff, 2)
		diff -= diff2 * 2
		diff1 = diff
		print(diff5 + diff2 + diff1)


t = int(input())
while t > 0:
	cnt = 0
	ans = 0
	(a, b) = map(int, input().split())
	d = abs(b - a)
	if d % 5 == 0:
		ans = d // 5
	else:
		cnt += d // 5
		d = d % 5
		if d % 2 == 0:
			ans = cnt + d // 2
		else:
			cnt += d // 2
			d = d % 2
			cnt += d
			ans = cnt
	print(ans)
	t -= 1


for k in range(int(input())):
	(a, b) = map(int, input().split())
	n = abs(a - b)
	print(n // 5 + n % 5 // 2 + n % 5 % 2)


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
lili = lambda : list(map(int, sys.stdin.readlines()))
li = lambda : list(map(int, input().split()))
I = lambda : int(input())
S = lambda : input()
t = I()
for i in range(0, t):
	(a, b) = li()
	d = abs(a - b)
	if d % 5 == 0:
		print(d // 5)
	elif d % 5 == 1:
		print(d // 5 + 1)
	elif d % 5 == 2:
		print(d // 5 + 1)
	elif d % 5 == 3 or d % 5 == 4:
		print(d // 5 + 2)


def main():
	(a, b) = map(int, input().split())
	if a == b:
		return 0
	if a > b:
		(a, b) = (b, a)
	rez = 0
	rez += (b - a) // 5
	a += 5 * rez
	if a == b:
		return rez
	if a == b - 1:
		return rez + 1
	if a == b - 2:
		return rez + 1
	if a == b - 3:
		return rez + 2
	if a == b - 4:
		return rez + 2
t = int(input())
for i in range(t):
	print(main())


for _ in [0] * int(input()):
	(n, m) = map(int, input().split())
	d = abs(n - m)
	print(d // 5 + d % 5 // 2 + d % 5 % 2)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	n = abs(a - b)
	sum = 0
	if n >= 5:
		sum += n // 5
		n = n % 5
	if n >= 2:
		sum += n // 2
		n %= 2
	if n >= 1:
		sum += n
	print(sum)


t = int(input())
for k in range(t):
	(a, b) = [int(i) for i in input().split()]
	res = 0
	d = abs(a - b)
	res += d // 5
	d %= 5
	res += d // 2
	d %= 2
	res += d
	print(res)


q = int(input())
for _ in range(q):
	(a, b) = [int(i) for i in input().split()]
	k = 0
	r = abs(a - b)
	if r >= 5:
		k += r // 5
		r %= 5
	if r >= 2:
		k += r // 2
		r %= 2
	if r >= 1:
		k += r
	print(k)


def main():
	(b, c) = list(map(int, input().split()))
	t = b - c
	t = abs(t)
	k = 0
	k += t // 5
	t = t % 5
	k += t // 2
	t = t % 2
	k += t // 1
	print(k)
a = int(input())
for i in range(a):
	main()


q = int(input())
for i in range(q):
	lst = list(map(int, input().split()))
	m = abs(lst[0] - lst[1])
	print(m // 5 + m % 5 // 2 + m % 5 % 2)


t = int(input())
for test in range(t):
	[a, b] = list(map(int, input().split()))
	d = abs(a - b)
	print(d // 5 + d % 5 // 2 + d % 5 % 2)


for _ in range(int(input())):
	ab = [int(x) for x in input().split()]
	a = ab[0]
	b = ab[1]
	ans = 0
	while a != b:
		ans += 1
		if a < b:
			if abs(b - a) >= 5:
				times = abs(b - a) // 5
				a += times * 5
				ans += times - 1
			elif abs(b - a) < 5 and abs(b - a) >= 2:
				a += 2
			elif abs(b - a) < 2 and abs(b - a) >= 1:
				a += 1
		elif a > b:
			if abs(b - a) >= 5:
				times = abs(b - a) // 5
				a -= times * 5
				ans += times - 1
			elif abs(b - a) < 5 and abs(b - a) >= 2:
				a -= 2
			elif abs(b - a) < 2 and abs(b - a) >= 1:
				a -= 1
	print(ans)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	n = abs(a - b)
	L = [5, 2, 1]
	buttons = []
	for i in range(3):
		buttons.append(n // L[i])
		n -= L[i] * buttons[i]
	print(sum(buttons))


import sys
input = sys.stdin.readline
import heapq
import copy
import math
import decimal

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def insr2():
	s = input()
	return s[:len(s) - 1]

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

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	mod = 998244353
	limit = 10 ** 18
	ans = 0
	for test in range(tests):
		[a, b] = inlt()
		ans = abs(b - a)
		if ans % 5 == 1 or ans % 5 == 2:
			ans = ans // 5 + 1
		elif ans % 5 == 0:
			ans = ans // 5
		else:
			ans = ans // 5 + 2
		print(ans)
main()


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	c = abs(a - b)
	mi = 0
	mi += c // 5
	c = c % 5
	mi += c // 2
	c = c % 2
	mi += c
	print(mi)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(ans, ans2, ans3, ans4) = (0, 0, 0, 0)
	ans = abs(a - b)
	ans2 = ans // 5
	ans3 = ans % 5
	ans4 += ans3 // 2
	print(ans4 + ans2 + ans3 % 2)


n = int(input())
c = [0] * n
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if a > b:
		c[i] = (a - b) // 5 + (a - b) % 5 // 2 + (a - b) % 5 % 2
	else:
		c[i] = (b - a) // 5 + (b - a) % 5 // 2 + (b - a) % 5 % 2
for i in range(n):
	print(c[i])


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	moves = 0
	if a == b:
		moves = 0
	else:
		net = [-5, -2, -1]
		net = abs(a - b)
		if net >= 5:
			o = net // 5
			moves += o
			net -= 5 * o
		if net >= 2:
			o = net // 2
			moves += o
			net -= 2 * o
		if net >= 1:
			o = net // 1
			moves += o
			net -= 1 * o
	print(moves)
	t -= 1


t = int(input())
l = [0, 1, 1, 2, 2]
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	d = a - b if a > b else b - a
	print(d // 5 + l[d % 5])


import math

def bob(a, b):
	if a == b:
		return '0'
	else:
		diff = abs(a - b)
		near = round(diff / 5)
		diff2 = math.ceil(abs(diff - near * 5) / 2)
		return int(near + diff2)
t = int(input())
for _ in range(t):
	dummy = list(map(int, input().split()))
	print(bob(dummy[0], dummy[1]))


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	res = abs(a - b)
	num1 = res // 5
	num2 = res % 5 // 2
	num3 = res % 5 % 2
	print(num1 + num2 + num3)


t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	if a < b:
		temp = a
		a = b
		b = temp
	ans = 0
	if (a - b) % 5 != 0:
		p = (a - b) % 5
		if p == 2 or p == 1:
			ans += 1
		elif p == 3 or p == 4:
			ans += 2
		print(ans + int((a - b) / 5))
	else:
		print(int((a - b) / 5))


tests = int(input())
while tests:
	tests -= 1
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	x = abs(a - b)
	d = x // 5
	rem = x % 5
	if rem == 4:
		d += 2
	elif rem == 3:
		d += 2
	elif rem == 2:
		d += 1
	elif rem == 1:
		d += 1
	print(d)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	(a, b) = value()
	dif = abs(a - b)
	if dif <= 5:
		if dif == 3 or dif == 4:
			print(2)
		elif dif == 0:
			print(0)
		else:
			print(1)
	else:
		ans = dif // 5
		if a < b:
			a += ans * 5
		else:
			a -= ans * 5
		dif = abs(a - b)
		if dif == 3 or dif == 4:
			print(ans + 2)
		elif dif == 0:
			print(ans)
		else:
			print(ans + 1)


t = int(input())
for i in range(t):
	(a, b) = [int(i) for i in input().split()]
	if a == b:
		print(0)
	else:
		res = b - a
		if res > 0:
			add = res
		else:
			add = -1 * res
		m_5 = add // 5
		add = add - 5 * m_5
		m_2 = add // 2
		add = add - 2 * m_2
		m_1 = add // 1
		print(m_5 + m_2 + m_1)


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : list(input())
t = ii()
for _ in range(t):
	(a, b) = ml()
	if a > b:
		(a, b) = (b, a)
	c = b - a
	d = c // 5
	e = c % 5 // 2
	print(d + e + c % 5 % 2)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split(' '))
	k = abs(b - a)
	s = 0
	if k == 0:
		print(0)
	elif k >= 5:
		if k % 5 == 0:
			print(int(k / 5))
		else:
			s = s + int(k / 5)
			k = k - int(k / 5) * 5
			if k >= 2:
				if k % 2 == 0:
					s = s + int(k / 2)
					print(s)
				else:
					s = s + int(k / 2)
					print(s + 1)
			else:
				print(s + 1)
	elif k >= 2:
		if k % 2 == 0:
			s = s + int(k / 2)
			print(s)
		else:
			s = s + int(k / 2)
			print(s + 1)
	else:
		print(s + 1)


n = int(input())
for nn in range(n):
	val = [int(x) for x in input().split(' ')]
	(a, b) = (val[0], val[1])
	difference = abs(b - a)
	clicks = difference // 5
	remaining = difference % 5
	if remaining % 2 == 0:
		clicks += remaining // 2
	if remaining == 3:
		clicks += 2
	if remaining == 1:
		clicks += 1
	print(clicks)


for y in range(int(input())):
	(a, b) = map(int, input().split())
	t = abs(a - b)
	cnt = 0
	cnt += t // 5
	t = t % 5
	cnt += t // 2
	t = t % 2
	cnt += t
	print(cnt)


t = int(input())
l = []
s = 0
while t:
	(a, b) = map(int, input().split())
	d = abs(a - b)
	s = s + d // 5
	d = d % 5
	s = s + d // 2
	d = d % 2
	s = s + d
	l.append(s)
	s = 0
	t = t - 1
for i in l:
	print(i)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = 0
	if a == b:
		print(0)
	elif b > a:
		diff = b - a
		ans += diff // 5
		r = diff % 5
		if r > 0:
			ans += r // 2
			r = r % 2
			if r > 0:
				ans += 1
		print(ans)
	else:
		(b, a) = (max(a, b), min(a, b))
		diff = b - a
		ans += diff // 5
		r = diff % 5
		if r > 0:
			ans += r // 2
			r = r % 2
			if r > 0:
				ans += 1
		print(ans)


for _ in ' ' * int(input()):
	import math
	(a, b) = sorted(map(int, input().split()))
	c = b - a
	d = (b - a) // 5
	c = c - d * 5
	c = math.ceil(c / 2)
	print(c + d)


Amount = [5, 2, 1]
for i in range(int(input())):
	X = sorted(list(map(int, input().split())))
	(X, Sum) = (X[1] - X[0], 0)
	for j in Amount:
		Sum += X // j
		X %= j
	print(Sum)


for i in range(int(input())):
	cnt = 0
	(a, b) = sorted(map(int, input().split()))
	b -= a
	for i in (5, 2, 1):
		cnt += b // i
		b = b % i
	print(cnt)


from sys import stdin, stdout
LI = lambda : list(map(int, input().split()))
MAP = lambda : map(int, input().split())
IN = lambda : int(input())
S = lambda : input()
import math
from collections import Counter

def solve():
	(a, b) = sorted(MAP())
	c = 0
	while True:
		if b - a >= 5:
			x = (b - a) // 5
			c += x
			a += 5 * x
		if b - a == 4:
			c += 2
		elif b - a == 0:
			break
		elif b - a == 3:
			c += 2
		else:
			c += 1
		break
	print(c)
for i in range(IN()):
	solve()


T = int(input())
for i in range(T):
	arr = list(map(int, input().split()))
	a = arr[0]
	b = arr[1]
	if a == b:
		print('0')
	elif b > a:
		diff = b - a
		step5 = diff % 5
		if step5 == 0:
			print(diff // 5)
		elif step5 == 1 or step5 == 2:
			print(diff // 5 + 1)
		else:
			print(diff // 5 + 2)
	else:
		diff = a - b
		step5 = diff % 5
		if step5 == 0:
			print(diff // 5)
		elif step5 == 1 or step5 == 2:
			print(diff // 5 + 1)
		else:
			print(diff // 5 + 2)


import sys

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 list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

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

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

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7
ans = []
for _ in range(INT()):
	(a, b) = MAP()
	cnt = 0
	dist = abs(a - b)
	cnt += dist // 5
	dist %= 5
	cnt += dist // 2
	dist %= 2
	cnt += dist
	ans.append(str(cnt))
print('\n'.join(ans))


t = int(input())
for case in range(t):
	(a, b) = [int(s) for s in input().split(' ')]
	x = abs(a - b)
	p = x // 5
	x = x % 5
	p += x // 2
	x = x % 2
	p += x
	print(p)


import sys
from math import sqrt, floor, factorial
from collections import deque, Counter
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

def c_p(n):
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return True
	return False

def solve():
	for _ in range(int(inp())):
		(a, b) = read()
		diff = abs(a - b)
		arr = [5, 2, 1]
		s = 0
		for i in arr:
			s += diff // i
			diff = diff % i
		print(s)
solve()


t = int(input())
for j in range(t):
	(a, b) = list(map(int, input().split()))
	ans = 0
	S = abs(b - a)
	ans += S // 5
	S -= ans * 5
	if S >= 3:
		ans += 1
		S -= 5
		S = abs(S)
	if S == 3:
		ans += 2
	elif S == 2:
		ans += 1
	elif S == 1:
		ans += 1
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	ans = abs(a - b)
	kol = 0
	ar = ans - 5 * (ans // 5)
	kol += ans // 5
	br = ar - 2 * (ar // 2)
	kol += ar // 2
	kol += br
	print(kol)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	count = 0
	count += d // 5
	d = d % 5
	count += d // 2
	count += d % 2
	print(count)


for _ in range(int(input())):
	(a, b) = [int(__) for __ in input().split()]
	shit = abs(a - b)
	ans = 0
	if shit != 0:
		ans += shit // 5
		shit %= 5
	if shit != 0:
		ans += shit // 2
		shit %= 2
	if shit != 0:
		ans += shit
	print(ans)


def solve(a, b):
	diff = abs(a - b)
	used = 0
	if diff >= 5:
		used += diff // 5
		diff = diff % 5
	if diff in (1, 2):
		used += 1
	elif diff in (3, 4):
		used += 2
	return used
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(solve(a, b))


from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
	return int(input())

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

def solve():
	(a, b) = rl()
	r = abs(a - b) % 5
	if r == 0:
		print(abs(a - b) // 5)
		return
	a = abs(a - b)
	if a % 5 == 0:
		print(a // 5)
	elif a % 5 in [1, 2]:
		print(a // 5 + 1)
	else:
		print(a // 5 + 2)
mode = 'T'
if mode == 'T':
	t = ri()
	for i in range(t):
		solve()
else:
	solve()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	c = a - b
	d = c // 5
	c -= d * 5
	i = c // 2
	c -= 2 * i
	d += i
	d += c
	print(d)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	dif = abs(b - a)
	total = dif // 5
	dif %= 5
	total += dif // 2 + dif % 2
	print(total)


k = int(input())
for i in range(k):
	(a, b) = list(map(int, input().split(' ')))
	result = 0
	if a == b:
		print(0)
		continue
	elif a > b:
		ost = a - b
		if ost // 5 > 0:
			result += ost // 5
			ost = ost % 5
		if ost // 2 > 0:
			result += ost // 2
			ost = ost % 2
		result += ost
	elif a < b:
		ost = b - a
		if ost // 5 > 0:
			result += ost // 5
			ost = ost % 5
		if ost // 2 > 0:
			result += ost // 2
			ost = ost % 2
		result += ost
	print(result)


def dif(d):
	result = 0
	if d >= 5:
		result += d // 5
		d = d - d // 5 * 5
	if d >= 2:
		result += d // 2
		d = d - d // 2 * 2
	if d >= 1:
		result += d
	print(result)
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	d = b - a
	if b == a:
		print(0)
	elif a < b:
		dif(d)
	else:
		dif(-1 * d)


for i in range(int(input())):
	s = 0
	(m, n) = map(int, input().split())
	if m > n:
		(m, n) = (n, m)
	t = n - m
	s += t // 5
	t -= t // 5 * 5
	s += t // 2
	t -= t // 2 * 2
	s += t
	print(s)


t = int(input())
for q in range(t):
	(a, b) = map(int, input().split())
	c = 0
	if a == b:
		print(c)
	elif a > b:
		x = a - b
		if x >= 5:
			a -= 5 * (x // 5)
			c = x // 5
			x = a - b
		if x >= 2:
			a -= 2 * (x // 2)
			c += x // 2
			x = a - b
		if x >= 1:
			a -= x
			c += x
		print(c)
	else:
		x = b - a
		if x >= 5:
			a += 5 * (x // 5)
			c = x // 5
			x = b - a
		if x >= 2:
			a += 2 * (x // 2)
			c += x // 2
			x = b - a
		if x >= 1:
			a += x
			c += x
		print(c)


T = int(input())
for _ in range(T):
	(a, b) = [int(x) for x in input().split()]
	c = abs(a - b)
	print(c // 5 + c % 5 // 2 + c % 5 % 2)


def f():
	(a, b) = [int(s) for s in input().split()]
	x = abs(a - b)
	ans = x // 5
	rem = x % 5
	if rem == 1:
		ans += 1
	elif rem == 2:
		ans += 1
	elif rem == 3:
		ans += 2
	elif rem == 4:
		ans += 2
	return ans
T = int(input())
for t in range(T):
	print(f())


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	if a == b:
		print(0)
		continue
	d = abs(a - b)
	c = 0
	temp1 = d // 5
	c = c + temp1
	d -= temp1 * 5
	if d == 0:
		print(c)
		continue
	temp2 = d // 2
	c += temp2
	d -= temp2 * 2
	if d == 0:
		print(c)
		continue
	temp3 = d // 1
	c += temp3
	d -= temp3
	if d == 0:
		print(c)
		continue


for i in range(int(input())):
	m = 0
	temp = 0
	(a, b) = map(int, input().split())
	if a == b:
		print('0')
	else:
		k = abs(a - b)
		cnt = 0
		m = k // 5
		k -= 5 * m
		cnt += m
		m = k // 2
		k -= 2 * m
		cnt += m
		cnt += k
		print(cnt)


for i in range(int(input())):
	(a, b) = [int(j) for j in input().split()]
	c = 0
	if a == b:
		print(0)
	else:
		if a < b:
			(a, b) = (b, a)
		a = a - b
		c = a // 5
		a = a % 5
		c += a // 2
		a = a % 2
		c += a
		print(c)


I = input
for i in [0] * int(I()):
	(a, b) = map(int, I().split())
	x = abs(b - a)
	print(x // 5 + x % 5 // 2 + x % 5 % 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = 0
	if b == a:
		x = 0
	elif b > a:
		x = b - a
	else:
		x = a - b
	ans += x // 5
	x = x % 5
	if x == 1 or x == 2:
		ans += 1
	elif x == 0:
		pass
	else:
		ans += 2
	print(ans)


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
t = ini()
for _ in range(t):
	(a, b) = inm()
	diff = abs(a - b)
	ans = 0
	for i in [5, 2]:
		x = diff // i
		diff -= x * i
		ans += x
	print(ans + diff)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
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()
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	k1 = (b - a) // 5
	k2 = (b - (5 * k1 + a)) // 2
	k3 = b - (5 * k1 + 2 * k2 + a)
	print(k1 + k2 + k3)


import math as m
answer = []
kolvo = int(input())
for i in range(kolvo):
	aa = list(map(int, input().split()))
	a = aa[0]
	b = aa[1]
	razn = m.fabs(a - b)
	coun = 0
	while razn >= 5:
		kr = int(razn / 5)
		razn = int(razn - 5 * kr)
		coun += kr
	while razn >= 2:
		kr = int(razn / 2)
		razn = razn - 2 * kr
		coun += kr
	while razn >= 1:
		razn = razn - 1
		coun += 1
	answer.append(coun)
for x in answer:
	print(x)


n = int(input())
import math
g = []
for i in range(n):
	s = list(map(int, input().split()))
	b = math.fabs(s[0] - s[1])
	c = b % 5
	e = c % 2
	f = math.fabs(b // 5) + math.fabs(c // 2) + math.fabs(e)
	f = int(f)
	g.append(f)
for i in range(n):
	print(g[i])


from sys import stdin

def input():
	return stdin.readline().strip()
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	diff = b - a
	if diff == 0:
		print(0)
	else:
		(r1, diff) = divmod(diff, 5)
		(r2, diff) = divmod(diff, 2)
		(r3, diff) = divmod(diff, 1)
		print(r1 + r2 + r3)


import sys
queries = int(sys.stdin.readline())
for query in range(queries):
	(need_volume, now_volume) = map(int, sys.stdin.readline().strip().split())
	delta_volume = abs(now_volume - need_volume)
	min_steps = delta_volume // 5 + (delta_volume % 5 + 1) // 2
	print(min_steps)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	count = 0
	a = abs(a - b)
	while a > 0:
		if a >= 100000:
			a -= 100000
			count += 1 * (100000 / 5)
		if a >= 10000:
			a -= 10000
			count += 1 * (10000 / 5)
		if a >= 1000:
			a -= 1000
			count += 1 * (1000 / 5)
		if a >= 5:
			a -= 5
			count += 1
		if a < 5 and a >= 2:
			a -= 2
			count += 1
		if a < 2 and a >= 1:
			a -= 1
			count += 1
	print(int(count))


from math import fabs as abs, modf as mod
n = int(input())
for n in range(n):
	[a, b] = map(int, input().split())
	t = int(abs(a - b))
	q5 = t // 5
	t -= 5 * q5
	q2 = t // 2
	t -= 2 * q2
	print(q5 + q2 + t)


n = int(input())
m = int(0)
while n != 0:
	a = [int(i) for i in input().split()]
	diff = int(abs(a[1] - a[0]))
	m = int(diff / 5)
	diff %= 5
	if diff < 5 and diff > 0:
		if diff == 1 or diff == 2:
			print(m + 1)
		elif diff == 3 or diff == 4:
			print(m + 2)
	elif diff == 0:
		print(m)
	n -= 1


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	ans = int(diff / 5)
	diff -= ans * 5
	if diff == 0:
		print(ans)
	elif diff == 1 or diff == 2:
		print(ans + 1)
	else:
		print(ans + 2)
	t -= 1


n = int(input())
for i in range(n):
	(a, b) = [int(x) for x in input().split(' ')]
	c = abs(a - b)
	d = 0
	d += int(c / 5)
	c = c % 5
	d += int(c / 2)
	c = c % 2
	d += c
	print(d)


import sys
import math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	diff = abs(a - b)
	ans = diff // 5
	diff = diff % 5
	ans += diff // 2
	diff = diff % 2
	ans += diff
	print(ans)


queries = int(input())
for x in range(queries):
	(a, b) = (int(x) for x in input().split())
	count = 0
	diff = abs(a - b)
	while diff > 0:
		if diff >= 5:
			if diff % 5 == 0:
				count += diff // 5
				diff = 0
			else:
				count += diff // 5
				x = diff // 5
				diff -= x * 5
		elif diff < 5 and diff % 2 == 0:
			count += diff // 2
			diff = 0
		elif diff > 1 and diff % 2 == 1:
			count += diff // 2
			x = diff // 2
			diff = 1
		else:
			count += 1
			diff = 0
	print(count)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	c = 0
	while d > 0:
		if d >= 5:
			c += d // 5
			d = d % 5
		elif d >= 2:
			c += d // 2
			d = d % 2
		else:
			c += d
			d = 0
	print(c)


t = int(input())
for i in range(t):
	(e, r) = map(int, input().split())
	g = abs(e - r)
	count = 0
	while g != 0:
		if g >= 5:
			j = g % 5
			g = g // 5
			count += g
			g = j
		elif g >= 2:
			j = g % 2
			g = g // 2
			count += g
			g = j
		else:
			count += g
			g = 0
	print(count)


test = int(input())
while test > 0:
	test -= 1
	(b1, b) = map(int, input().split())
	c = 0
	a = abs(b1 - b)
	if a >= 5:
		c += a // 5
		a = a % 5
	if a >= 2:
		c += a // 2
		a = a % 2
	c += a
	print(c)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	i5 = 0
	i2 = 0
	i1 = 0
	if c >= 5:
		i5 = c // 5
		c = c % 5
	if c >= 2:
		i2 = c // 2
		c = c % 2
	if c != 0:
		i1 = 1
	print(i5 + i2 + i1)


q = int(input())
for i in range(q):
	(a, b) = map(int, input().split())
	a = abs(a - b)
	temp = a // 5
	a = a % 5
	temp += a // 2
	a = a % 2
	temp += a
	print(temp)


import math
t = int(input())
for x in range(t):
	(s1, s2) = map(int, input().split())
	f = abs(s1 - s2)
	r = 0
	if f / 5 >= 1:
		r = math.floor(f / 5)
		p = f / 5 - math.floor(f / 5)
		p = round(p, 1)
		p = math.ceil(p * 5)
		r += math.ceil(p / 2)
	else:
		r = math.ceil(f / 2)
	print(r)


n = int(input())
buttons = 0
for i in range(n):
	volumes = input().split()
	a = int(volumes[0])
	b = int(volumes[1])
	if a > b:
		diff = a - b
		buttons += diff // 5
		rem = diff % 5
		buttons += rem // 2 + rem % 2
	elif b > a:
		diff = b - a
		buttons += diff // 5
		rem = diff % 5
		buttons += rem // 2 + rem % 2
	else:
		pass
	print(buttons)
	buttons = 0


n = int(input())
sres = []
for i in range(n):
	(a, b) = [int(i) for i in input().split(' ')]
	dif = abs(a - b)
	res = 0
	if a != b:
		cnt5 = dif // 5
		res += cnt5
		if dif % 5 > 3:
			res += 1
			cnt5 += 1
		dif -= cnt5 * 5
		dif = abs(dif)
		cnt2 = dif // 2
		res += cnt2
		dif -= cnt2 * 2
		dif = abs(dif)
		res += dif
	sres.append(res)
for i in sres:
	print(i)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		c = abs(b - a)
		k = c % 5
		r = c // 5
		if k == 0:
			print(r)
		elif k == 1 or k == 2:
			print(r + 1)
		elif k == 3 or k == 4:
			print(r + 2)


t = int(input())
for you in range(t):
	l = input().split()
	a = int(l[0])
	b = int(l[1])
	if b > a:
		z = b - a
		if z % 5 == 0:
			ans = (b - a) // 5
		if z % 5 == 1:
			ans = (b - a) // 5 + 1
		if z % 5 == 2:
			ans = (b - a) // 5 + 1
		if z % 5 == 3:
			ans = (b - a) // 5 + 2
		if z % 5 == 4:
			ans = (b - a) // 5 + 2
	else:
		z = a - b
		if z % 5 == 0:
			ans = z // 5
		if z % 5 == 1:
			ans = z // 5 + 1
		if z % 5 == 2:
			ans = z // 5 + 1
		if z % 5 == 3:
			ans = z // 5 + 2
		if z % 5 == 4:
			ans = z // 5 + 2
	print(ans)


import math
from sys import stdin, stdout
t = int(stdin.readline())
for a in range(t):
	(a, b) = map(int, stdin.readline().split())
	r = int(math.fabs(a - b))
	if r > 0:
		c = 0
		if r >= 5:
			c += r // 5
			r -= 5 * (r // 5)
		if r == 2 or r == 1:
			c += 1
		elif r == 3 or r == 4:
			c += 2
		print(c)
	else:
		print(0)


a = int(input())
for i in range(a):
	lst = list(map(int, input().split()))
	c = abs(lst[0] - lst[1])
	print(c // 5 + c % 5 // 2 + c % 5 % 2)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	diff = abs(b - a)
	mov = diff // 5
	diff = diff - mov * 5
	if diff > 0:
		mov2 = diff // 2
		mov += mov2
		diff = diff - mov2 * 2
	if diff > 0:
		mov1 = diff
		mov += mov1
		diff = diff - mov1 * 2
	print(mov)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	z = abs(a - b)
	c = z // 5
	z %= 5
	c += z // 2
	z %= 2
	print(z + c)


t = int(input())
for i in range(t):
	res = 0
	(a, b) = [int(i) for i in input().split()]
	z = abs(a - b)
	if z >= 5:
		res += z // 5
		z = z % 5
	if z >= 2:
		res += z // 2
		z = z % 2
	if z >= 1:
		res += 1
	print(res)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().strip().split()))
	if a > b:
		tmp = a
		a = b
		b = tmp
	rem = b - a
	ans = 0
	ans += rem // 5
	rem = rem % 5
	ans += rem // 2
	rem = rem % 2
	ans += rem // 1
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	c = int(d / 5)
	cnt = d % 5
	if cnt > 2:
		cnt = c + 2
	elif cnt == 0:
		cnt = c
	elif 0 < cnt <= 2:
		cnt = c + 1
	print(cnt)


test = int(input())
for i in range(test):
	count = 0
	(volume_a, volume_b) = map(int, input().split())
	num = abs(volume_a - volume_b)
	print(num // 5 + num % 5 // 2 + num % 5 % 2)


import math
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	count = 0
	if a == b:
		print(0)
	elif a > b:
		gap = a - b
		for j in [5, 2, 1]:
			number = math.floor(gap / j)
			count += number
			gap -= number * j
		print(count)
	else:
		gap = b - a
		for j in [5, 2, 1]:
			number = math.floor(gap / j)
			count += number
			gap -= number * j
		print(count)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	qw = abs(a - b) // 5
	l = abs(a - b) - 5 * qw
	if l == 0:
		print(qw)
	elif l == 1 or l == 2:
		print(qw + 1)
	else:
		print(qw + 2)


import math
T = int(input())
for t in range(T):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	lst = [-5, -2, -1, 1, 2, 5]
	temp = b - a
	if temp in lst:
		print(1)
	else:
		count = 0
		temp = abs(temp)
		lst = [5, 2, 1]
		for i in lst:
			count += int(temp / i)
			temp %= i
		print(count)


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	k = abs(a - b)
	ans = k // 5
	k -= ans * 5
	ans2 = k // 2
	k -= ans2 * 2
	ans3 = k
	print(ans + ans2 + ans3)


q = int(input())
for t in range(q):
	(a, b) = map(int, input().split())
	ans = abs(a - b) // 5
	if b >= a:
		a += 5 * ans
	else:
		a -= 5 * ans
	if abs(a - b) == 1 or abs(a - b) == 2:
		ans += 1
	elif a != b:
		ans += 2
	print(ans)


import math
t = int(input())
while t:
	(a, b) = map(int, input().split())
	suma = 0
	b1 = max(a, b)
	a1 = min(a, b)
	if a1 == b1:
		ans = 0
	else:
		m = 5
		cnt = 0
		cnt = math.ceil((b1 - a1) / 5)
		a1 += cnt * 5
		if a1 - b1 <= 2 and a1 != b1:
			ans = cnt + 1
		else:
			ans = cnt
	print(ans)
	t -= 1


n = int(input())
for _ in range(n):
	(a, b) = [int(x) for x in input().split()]
	time1 = abs(a - b) // 5
	time2 = (abs(a - b) - 5 * time1) // 2
	time3 = abs(a - b) - 5 * time1 - 2 * time2
	print(time1 + time2 + time3)


from functools import reduce
for _ in range(int(input())):
	a = reduce(lambda x, y: abs(x - y), map(int, input().split()))
	c = a // 5
	if a % 5 == 4 or a % 5 == 3:
		c += 2
	elif a % 5 == 2 or a % 5 == 1:
		c += 1
	print(c)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	j = abs(b - a)
	l = [5, 2, 1]
	count = 0
	for k in l:
		count += j // k
		j %= k
	print(count)


n = int(input())
diff = 0
clk = []
for i in range(0, n):
	c = input()
	c = c.split()
	diff = abs(int(c[0]) - int(c[1]))
	count = 0
	if diff >= 5:
		count += diff // 5
		diff = diff % 5
	if diff >= 2:
		count += diff // 2
		diff = diff % 2
	if diff == 1:
		count += 1
	clk.append(count)
for i in clk:
	print(i)


for T in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	s = abs(a - b)
	print(s // 5 + s % 5 // 2 + s % 5 % 2)


from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 1000010
MOD = 10 ** 9 + 7
spf = [i for i in range(MAXN)]

def sieve():
	for i in range(2, MAXN, 2):
		spf[i] = 2
	for i in range(3, int(MAXN ** 0.5) + 1):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def fib(n, m):
	if n == 0:
		return [0, 1]
	else:
		(a, b) = fib(n // 2)
		c = a % m * (b % m * 2 - a % m) % m
		d = a % m * (a % m) % m + b % m * b % m % m
		if n % 2 == 0:
			return [c, d]
		else:
			return [d, c + d]

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))

def ncr(n, r):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % MOD
		den = den * (i + 1) % MOD
	return num * pow(den, MOD - 2, MOD) % MOD

def flush():
	return sys.stdout.flush()
for _ in range(int(input())):
	(a, b) = arrIN()
	d = abs(a - b)
	ans = 0
	(x, y) = divmod(d, 5)
	ans += x
	(z, w) = divmod(y, 2)
	ans += z
	ans += w
	print(ans)


T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	sch = 0
	x = abs(a - b)
	if x >= 5:
		sch += x // 5
		x = x % 5
	if x >= 2:
		sch += x // 2
		x = x % 2
	if x == 1:
		sch += 1
	print(sch)


T = int(input())
for i in range(T):
	u = [int(i) for i in input().split()]
	(a, b) = (u[0], u[1])
	delta = abs(a - b)
	t = 0
	(t, delta) = (delta // 5, delta % 5)
	if delta == 1 or delta == 2:
		t += 1
	elif delta == 3 or delta == 4:
		t += 2
	print(t)


for _ in range(int(input().strip())):
	(a, b) = [int(__) for __ in input().strip().split()]
	diff = abs(a - b)
	co = 0
	co += diff // 5
	diff = diff % 5
	if diff != 0:
		co += diff // 2
		diff = diff % 2
		if diff != 0:
			co += diff
			print(co)
		else:
			print(co)
	else:
		print(co)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		x = b - a
		d = x // 5
		t = x % 5
		if t == 3 or t == 4:
			print(d + 2)
		elif t == 0:
			print(d)
		else:
			print(d + 1)
	elif a > b:
		x = a - b
		d = x // 5
		t = x % 5
		if t == 3 or t == 4:
			print(d + 2)
		elif t == 0:
			print(d)
		else:
			print(d + 1)
	else:
		print(0)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	(res, c) = divmod(abs(a - b), 5)
	(t, d) = divmod(c, 2)
	res += t + d
	print(res)


def solve():
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	k = b - a
	ans = k // 5
	k %= 5
	ans += k // 2
	k %= 2
	ans += k
	print(ans)
for _ in range(int(input())):
	solve()


t = int(input())
ans = []
for number in range(t):
	p = 0
	(a, b) = map(int, input().split())
	p = abs(a - b)
	x = p // 5
	x1 = p % 5
	y = x1 // 2
	z = x1 % 2
	ans.append(x + y + z)
for item in ans:
	print(item)


T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	n = abs(b - a)
	m = n % 5
	if m == 0:
		print(n // 5)
	elif m == 1 or m == 2:
		print(n // 5 + 1)
	else:
		print(n // 5 + 2)


from sys import stdin
t = int(stdin.readline().rstrip())
while t > 0:
	(a, b) = map(int, stdin.readline().split())
	c = 0
	f = abs(a - b)
	if f >= 5:
		c += f // 5
		f = f % 5
	if f >= 2:
		c += f // 2
		f = f % 2
	c += f
	print(c)
	t -= 1


n = int(input())
for i in range(n):
	(b, e) = list(map(int, input().split()))
	diff = abs(b - e)
	print(diff // 5 + diff % 5 // 2 + diff % 5 % 2)


tc = int(input())
for ii in range(tc):
	(a, b) = map(int, input().split())
	dif = abs(a - b)
	c = 0
	if dif >= 5:
		c += dif // 5
		dif = dif % 5
	if dif >= 2:
		c += dif // 2
		dif = dif % 2
	if dif == 1:
		c += 1
	print(c)


test_cases = int(input())
for i in range(test_cases):
	(current_vol, desired_vol) = map(int, input().split())
	change_in_volume = abs(current_vol - desired_vol)
	presses = change_in_volume // 5
	change_in_volume = change_in_volume % 5
	presses += change_in_volume // 2
	change_in_volume = change_in_volume % 2
	presses += change_in_volume // 1
	print(presses)


count = int(input())
for i in range(count):
	arr = list(map(int, input().split()))
	dif = abs(arr[0] - arr[1])
	sum = 0
	if dif >= 5:
		sum = int(dif / 5)
		dif = dif % 5
	if dif >= 2:
		sum = sum + int(dif / 2)
		dif = dif % 2
	if dif >= 1:
		sum = sum + 1
	print(sum)


import math
t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	if a == b:
		print(0)
		continue
	sub = abs(a - b)
	print(sub // 5 + sub % 5 // 2 + sub % 5 % 2 // 1)


import math
from collections import *
from functools import reduce
import sys
input = sys.stdin.readline

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def li():
	return [int(i) for i in input().rstrip('\n').split(' ')]

def st():
	return input().rstrip('\n')

def val():
	return int(input())
for _ in range(val()):
	(a, b) = li()
	tot = 0
	ans = abs(a - b)
	if a < b:
		temp = (b - a) // 5
		a += temp * 5
		curr = temp
		if b - a and b - a < 3:
			curr += 1
		elif b - a:
			curr += 2
		ans = curr
	else:
		(a, b) = (b, a)
		temp = (b - a) // 5
		a += temp * 5
		curr = temp
		if b - a and b - a < 3:
			curr += 1
		elif b - a:
			curr += 2
		ans = curr
	print(ans)


from collections import defaultdict
for _ in range(int(input())):
	(n, m) = map(int, input().split(' '))
	req = abs(n - m)
	ans = req // 5
	req %= 5
	ans += req // 2
	req %= 2
	ans += req
	print(ans)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	k = 0
	k = k + c // 5
	c = c % 5
	k = k + c // 2
	c = c % 2
	k = k + c
	print(k)


T = int(input())
for i in range(T):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	s = 0
	if a > b:
		d = a - b
	else:
		d = b - a
	if d % 5 == 0:
		s = int(d / 5)
	elif d % 5 == 1:
		s = int(d / 5) + 1
	elif d % 5 == 2:
		s = int(d / 5) + 1
	elif d % 5 == 3:
		s = int(d / 5) + 2
	elif d % 5 == 4:
		s = int(d / 5) + 2
	print(s)


test_count = int(input())
test_inputs = list()

def result(a):
	if a == 0:
		return 0
	elif a == 3 or a == 4:
		return 2
	else:
		return 1
for i in range(test_count):
	a = input().split(' ')
	a = [int(a[0]), int(a[1])]
	test_inputs.append(a)
for i in test_inputs:
	range_of_change = abs(i[0] - i[1])
	ans = range_of_change // 5 + result(range_of_change % 5)
	print(ans)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(b - a)
	d = c // 5
	e = c % 5
	f = e // 2
	g = e % 2
	s = d + f + g
	print(s)


def solve(a, b):
	(a, b) = sorted([a, b])
	c = b - a
	n = 0
	if c >= 5:
		n += c // 5
		c = c % 5
	if c >= 2:
		n += c // 2
		c = c % 2
	if c > 0:
		n += c
	print(n)
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	solve(a, b)


t = int(input())
for i in range(t):
	(a, b) = input().split()
	r5 = 0
	r2 = 0
	r1 = 0
	a = int(a)
	b = int(b)
	if a == b:
		print(0)
		continue
	elif a > b:
		r5 = int((a - b) / 5)
		a -= r5 * 5
		r2 = int((a - b) / 2)
		a -= r2 * 2
		r1 = a - b
		print(r5 + r2 + r1)
	else:
		r5 = int((b - a) / 5)
		b -= r5 * 5
		r2 = int((b - a) / 2)
		b -= r2 * 2
		r1 = b - a
		print(r5 + r2 + r1)


for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	if a == b:
		print('0')
		continue
	pushes = 0
	diffs = abs(a - b)
	for i in [5, 2, 1]:
		(div, rest) = divmod(diffs, i)
		pushes += div
		diffs = rest
		if rest == 0:
			print(pushes)
			break


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	count = 0
	if a == b:
		print(0)
	elif a < b:
		count = (b - a) // 5 + (b - a) % 5 // 2 + (b - a) % 5 % 2
		print(count)
	elif a > b:
		count = (a - b) // 5 + (a - b) % 5 // 2 + (a - b) % 5 % 2
		print(count)


for _ in range(int(input())):
	h = 0
	(a, b) = map(int, input().split())
	k = abs(a - b)
	h += k // 5
	k = k % 5
	h += k // 2
	k = k % 2
	h += k
	print(h)


t = int(input())
for j in range(t):
	l = list(map(int, input().split()))
	a = l[0]
	b = l[1]
	c = abs(a - b)
	d = 0
	while c != 0:
		if c >= 5:
			d += c // 5
			c = c % 5
		elif c >= 2:
			d += c // 2
			c = c % 2
		else:
			d += c // 1
			c = c % 1
	print(d)


n = int(input())
for i in range(0, n):
	(x, y) = [int(a) for a in input().split()]
	k = abs(x - y)
	if k % 5 == 0:
		h = k / 5
	else:
		m = k - 5 * (k // 5)
		if m % 2 == 0:
			h = k // 5 + m / 2
		else:
			h = k // 5 + m // 2 + 1
	print(int(h))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	count = 0
	m = abs(b - a)
	k = m // 5
	j = m % 5
	if j == 1 or j == 2:
		print(k + 1)
	elif j == 3 or j == 4:
		print(k + 2)
	elif j == 0:
		print(k)


from sys import stdin

def rl():
	return [int(w) for w in stdin.readline().split()]
t = int(stdin.readline())
while t:
	t -= 1
	(a, b) = rl()
	n = abs(a - b)
	res = n // 5
	tmp = n % 5
	if tmp == 1 or tmp == 2:
		res += 1
	elif tmp == 3 or tmp == 4:
		res += 2
	print(res)


n = int(input())
count = 0
for i in range(n):
	(a, b) = map(int, input().split())
	count = 0
	c = abs(b - a)
	(a1, b1) = divmod(c, 5)
	count += a1
	(a1, b1) = divmod(b1, 2)
	count += a1 + b1
	print(count)


from sys import stdin, stdout
I = lambda : map(int, stdin.readline().split())
test = int(input())
while test > 0:
	(x, y) = I()
	sum = 0
	sub = abs(x - y)
	sum = int(sub / 5)
	sum += int(sub % 5) / 2
	sum += int(sub % 5 % 2)
	print('%d' % sum)
	test -= 1


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	x = abs(a - b)
	if x % 5 == 0:
		print(x // 5)
		continue
	elif x % 5 != 0:
		z = x
		z = z // 5
		x = x % 5
		if x % 2 == 0:
			x = x // 2
			z = z + x
			print(z)
			continue
		elif x == 3:
			print(z + 2)
			continue
		elif x == 1:
			print(z + 1)
			continue


for i in range(int(input())):
	(a, b) = map(int, input().split())
	v = abs(b - a)
	s = (5, 2, 1)
	change = 0
	change += v // 5
	v = v % 5
	change += v // 2
	v = v % 2
	change += v // 1
	print(change)


def main():
	t = int(input())
	for i in range(t):
		(a, b) = input().split()
		a = int(a)
		b = int(b)
		cnt = 0
		if a > b:
			(a, b) = (b, a)
		if b - a >= 5:
			times = int((b - a) / 5)
			cnt += times
			a = a + 5 * times
		if b - a >= 2:
			times = int((b - a) / 2)
			cnt += times
			a = a + 2 * times
		if b - a >= 1:
			cnt += b - a
			a += b - a
		print(cnt)
main()


n = int(input())
c = int(0)
ans = int(0)
for i in range(n):
	ans = 0
	(a, b) = map(int, input().split())
	x = abs(a - b)
	if x % 5 == 1 or x % 5 == 2:
		ans += 1
	if x % 5 == 3 or x % 5 == 4:
		ans += 2
	if x >= 5:
		ans += x // 5
	print(ans)


for i in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	k = 0
	if a > b:
		if a - b >= 5:
			k += (a - b) // 5
			a -= k * 5
		if a - b >= 2:
			k += (a - b) // 2
			a -= 2 * ((a - b) // 2)
		if a - b == 1:
			k += 1
	else:
		if b - a >= 5:
			k += (b - a) // 5
			a += k * 5
		if b - a >= 2:
			k += (b - a) // 2
			a += 2 * ((b - a) // 2)
		if b - a == 1:
			k += 1
	print(k)


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	(a, b) = [int(item) for item in input().split()]
	if a > b:
		(a, b) = (b, a)
	ans = 0
	diff = b - a
	ans += diff // 5
	diff %= 5
	ans += diff // 2
	diff %= 2
	ans += diff
	print(ans)