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