#include <bits/stdc++.h>
void swap(long long &a, long long &b) {
  long long t = 0;
  t = a;
  a = b;
  b = t;
}
using namespace std;
const int N = 2e5 + 5;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    long long k = abs(b - a);
    int count = 0;
    count = count + k / 5;
    k = k % 5;
    count = count + k / 2;
    k = k % 2;
    count = count + k;
    cout << count << endl;
  }
}
