#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  while (a--) {
    int b, c;
    cin >> b >> c;
    int n = abs(b - c);
    n = n / 5 + (n % 5) / 2 + (n % 5) % 2;
    cout << n << '\n';
  }
  return 0;
}
