#include <bits/stdc++.h>
using namespace std;
void solve() {
  int a, b;
  cin >> a >> b;
  int x = abs(a - b);
  int res = x / 5;
  x %= 5;
  res += x / 2;
  x %= 2;
  res += x;
  cout << res << '\n';
}
int main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (fopen("main.in", "r"))
    freopen("main.in", "r", stdin);
  else if (fopen("1255A"
                 ".inp",
                 "r"))
    freopen(
        "1255A"
        ".inp",
        "r", stdin),
        freopen(
            "1255A"
            ".out",
            "w", stdout);
  int nTest;
  cin >> nTest;
  while (nTest--) solve();
  return 0;
}
