#include <bits/stdc++.h>
using namespace std;
long long int i, j, k, l, m, n, c, p, q;
long long int a[100002], b[100002], x[100002];
int main() {
  cin >> q;
  while (q--) {
    p = 0;
    long long int y;
    cin >> l;
    cin >> m;
    c = abs(l - m);
    p = c / 5;
    c -= p * 5;
    y = c / 2;
    p += y;
    c -= 2 * y;
    p += c;
    cout << p;
    cout << endl;
  }
}
