#include <bits/stdc++.h>
using namespace std;
void solve() {
  int a, b;
  cin >> a >> b;
  int d = abs(a - b);
  int count = 0;
  int rem;
  count += (d / 5);
  rem = d % 5;
  if (rem == 0) {
    cout << count << '\n';
    return;
  }
  if (rem >= 2) {
    count += (rem / 2);
    rem = rem % 2;
  }
  if (rem == 0) {
    cout << count << '\n';
    return;
  }
  cout << count + rem << '\n';
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
