#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, ans;
  scanf(" %d", &n);
  while (n--) {
    scanf(" %d %d", &a, &b);
    a = abs(a - b);
    ans = a / 5;
    a = a % 5;
    ans = ans + a / 2;
    a = a % 2;
    ans = ans + a;
    printf("%d\n", ans);
  }
  return 0;
}
