#include <bits/stdc++.h>
using namespace std;
int main() {
  int tc, a, b;
  int fiveMult = 0, twoMult = 0, oneMult = 0;
  cin >> tc;
  while (tc--) {
    cin >> a;
    cin >> b;
    int temp = b - a;
    fiveMult = 0, twoMult = 0, oneMult = 0;
    if (temp < 0) temp = temp * -1;
    fiveMult = temp / 5;
    temp = temp % 5;
    if (temp != 0) {
      twoMult = temp / 2;
      temp = temp % 2;
      if (temp != 0) {
        oneMult = temp;
      }
    }
    cout << fiveMult + twoMult + oneMult << endl;
  }
}
