#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a, b;
    cin >> a >> b;
    int ans;
    int diff = abs(b - a);
    int x = diff / 5;
    diff = diff % 5;
    int y = diff / 2;
    diff = diff % 2;
    ans = x + y + diff;
    cout << ans << endl;
  }
  return 0;
}
