#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, a, b, nn, t, x, f, p, dd = 1000000, rr, sl, tl, i, l, d, val,
                                         j, lo, k, h, c, e;
  cin >> t;
  while (t--) {
    long long int curr, des, ans = 0;
    cin >> curr >> des;
    d = des - curr;
    d = abs(d);
    ans = d / 5;
    d = d % 5;
    ans += d / 2;
    d = d % 2;
    ans += d;
    cout << ans << "\n";
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
