#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    int a, b;
    cin >> a >> b;
    int x = abs(a - b);
    int ans = x / 5;
    x %= 5;
    ans += x / 2;
    x %= 2;
    ans += x;
    cout << ans << endl;
  }
  return 0;
}
