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