#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  while (n--) {
    long long int arr[3] = {5, 2, 1};
    long long int count = 0;
    long long int a, b;
    cin >> a >> b;
    long long int diff = abs(b - a);
    for (long long int i = 0; i < 3; i++) {
      count += diff / arr[i];
      diff %= arr[i];
    }
    cout << count << "\n";
  }
}
