#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    long long a, b;
    long long ans = 0;
    scanf("%I64d%I64d", &a, &b);
    if (a == b)
      printf("0\n");
    else {
      long long x = abs(b - a);
      ans += x / 5;
      x -= (x / 5) * 5;
      ans += x / 2;
      x -= (x / 2) * 2;
      ans += x / 1;
      printf("%I64d\n", ans);
    }
  }
  return 0;
}
