#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, a, b, x, c;
  cin >> t;
  string o = "", s;
loop:
  while (t--) {
    s = "";
    cin >> a >> b;
    c = 0;
    int d = abs(a - b);
    c += d / 5;
    d %= 5;
    c += d / 2;
    d %= 2;
    c += d;
    o += to_string(c) + "\n";
  }
  cout << o;
  return 0;
}
