#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  long long a;
  long long b;
  long long c;
  long long c1;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    long long a1 = min(a, b);
    long long b1 = max(a, b);
    if (a == b)
      cout << 0 << endl;
    else {
      c1 = 0;
      c = b1 - a1;
      c1 += c / 5;
      c = c % 5;
      c1 += c / 2;
      c = c % 2;
      c1 += c;
      cout << c1 << endl;
    }
  }
  return 0;
}
