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