#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, a, b, ans, go;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    go = abs(a - b);
    ans = go / 5;
    long long dif = go % 5;
    ans += dif / 2;
    if (dif % 2 == 1) ans++;
    cout << ans << endl;
  }
}
