#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t-- != 0) {
    long long a, b;
    cin >> a >> b;
    long long t = max(a, b);
    b = min(a, b);
    a = t;
    long long d = a - b;
    long long ans = d / 5;
    d %= 5;
    ans += d / 2;
    d %= 2;
    ans += d;
    cout << ans << endl;
  }
}
