#include <bits/stdc++.h>
using namespace std;
void _SSGJ_() {
  long long a, b;
  cin >> a >> b;
  long long val = abs(a - b);
  long long ans = 0;
  ans += val / 5;
  val %= 5;
  ans += val / 2;
  val %= 2;
  ans += val;
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) _SSGJ_();
  return 0;
}
