#include <bits/stdc++.h>
using namespace std;
long long powerFunction(long long x, long long y) {
  long long res = 1;
  long long p = 1000000007;
  ;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    long long diff = abs(a - b);
    long long five, two, one, ans = 0;
    five = diff / 5;
    if (five != 0) {
      ans += five;
      diff -= 5 * five;
    }
    two = diff / 2;
    if (two != 0) {
      ans += two;
      diff -= 2 * two;
    }
    one = diff / 1;
    if (one != 0) {
      ans += one;
      diff -= 1 * one;
    }
    cout << ans << '\n';
  }
}
