#include <bits/stdc++.h>
int INF = 1000000005;
long long INFF = 1000000000000000005LL;
double pi = acos(-1);
int dirx[8] = {-1, 0, 0, 1, -1, -1, 1, 1};
int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1};
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int a, b, cnt = 0;
    cin >> a >> b;
    long long int diff = abs(b - a);
    cnt += diff / 5;
    diff %= 5;
    cnt += diff / 2;
    diff %= 2;
    cnt += diff;
    cout << cnt << endl;
  }
  return 0;
}
