#include <bits/stdc++.h>
int main() {
  long long int t, a, b, diff;
  scanf("%lld", &t);
  long long int swaps;
  while (t--) {
    scanf("%lld%lld", &a, &b);
    swaps = 0;
    diff = b - a;
    if (diff < 0) {
      diff = -diff;
    }
    swaps = swaps + diff / 5;
    diff = diff % 5;
    swaps = swaps + diff / 2;
    diff = diff % 2;
    swaps = swaps + diff / 1;
    diff = diff % 1;
    printf("%lld\n", swaps);
  }
  return 0;
}
