#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long a, b, x;
    cin >> a >> b;
    long long cnt = 0;
    x = fabs(a - b);
    if (x == 0) {
      cout << cnt << endl;
      continue;
    }
    long long p = x / 5;
    cnt += p;
    x -= (p * 5);
    if (x == 0) {
      cout << cnt << endl;
      continue;
    }
    p = x / 2;
    cnt += p;
    x -= (p * 2);
    if (x == 0) {
      cout << cnt << endl;
      continue;
    }
    p = x;
    cnt += p;
    x -= p;
    if (x == 0) {
      cout << cnt << endl;
      continue;
    }
  }
}
