#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t = 0;
  cin >> t;
  long long a = 0, b = 0;
  for (int i = 0; i < t; i++) {
    cin >> a >> b;
    long long dif = abs(a - b);
    long long res = dif / 5;
    dif = dif % 5;
    res += dif / 2;
    dif %= 2;
    res += dif;
    cout << res << endl;
  }
  return 0;
}
