#include <bits/stdc++.h>
int main() {
  int T, a, b, c = 1, s, d = 2, e = 5, i, j;
  scanf("%d", &T);
  for (i = 0; i < T; i++) {
    s = 0;
    scanf("%d %d", &a, &b);
    if (a < b) {
      while ((b - a) >= 5) {
        j = (b - a) / 5;
        a = a + 5 * j;
        s += j;
      }
      while ((b - a) >= 2) {
        a += 2;
        s++;
      }
      while ((b - a) != 0) {
        s++;
        a++;
      }
    }
    if (a > b) {
      while ((a - b) >= 5) {
        j = (a - b) / 5;
        b = b + 5 * j;
        s += j;
      }
      while ((a - b) >= 2) {
        b += 2;
        s++;
      }
      while ((a - b) != 0) {
        s++;
        b++;
      }
    }
    printf("%d\n", s);
  }
  return 0;
}
