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