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