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