#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T) {
    long long a, b;
    cin >> a >> b;
    if (a > b) {
      int t = a;
      a = b;
      b = t;
    }
    int five = (b - a) / 5;
    b -= five * 5;
    int two = (b - a) / 2;
    b -= two * 2;
    int one = b - a;
    b -= one;
    cout << five + two + one << endl;
    T--;
  }
  return 0;
}
