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