#include <bits/stdc++.h>
using namespace std;
string en = "\n";
string sp = " ";
long long int Pow(long long int a, long long int x) {
  if (x == 0)
    return 1;
  else {
    long long int y = a;
    for (long long int i = 1; i < x; i++) {
      a = a * y;
    }
    return a;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    long long int dif = b - a;
    long long int ans = 0;
    ans = ans + dif / 5;
    long long int rem = dif % 5;
    ans = ans + rem / 2;
    rem = rem % 2;
    ans = ans + rem;
    cout << ans << endl;
  }
}
