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