#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 cha = abs(a - b);
    int num5 = cha / 5;
    int num2 = (cha - num5 * 5) / 2;
    int num1 = (cha - num5 * 5 - num2 * 2) / 1;
    cout << num5 + num2 + num1 << endl;
  }
  return 0;
}
