#include <bits/stdc++.h>
using namespace std;
int main() {
  int tests, a, b, x, sum = 0, f5;
  cin >> tests;
  while (tests--) {
    cin >> a >> b;
    x = abs(a - b);
    sum = 0;
    if (x >= 5) {
      sum = sum + (x / 5);
      f5 = x % 5;
      sum = sum + (f5 / 2);
      sum = sum + (f5 % 2);
      cout << sum << endl;
    } else if (x == 1) {
      cout << 1 << endl;
    } else if (x == 2) {
      cout << 1 << endl;
    } else if (x == 3 || x == 4) {
      cout << 2 << endl;
    } else {
      cout << 0 << endl;
    }
  }
  return 0;
}
