#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int main() {
  cin.tie(nullptr);
  int t;
  while (cin >> t) {
    while (t--) {
      int a, b, cnt = 0;
      cin >> a >> b;
      int d = abs(a - b);
      cnt += (d / 5);
      d -= (d / 5) * 5;
      cnt += (d / 2);
      d -= (d / 2) * 2;
      cnt += d;
      cout << cnt << '\n';
    }
  }
}
