#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long int a, b;
    int count = 0;
    cin >> a >> b;
    long int diff = (a - b);
    if (diff > 0) {
      while (diff != 0) {
        if (diff >= 5) {
          count += diff / 5;
          diff %= 5;
        } else if (diff >= 2 and diff < 5) {
          count += diff / 2;
          diff %= 2;
        } else if (diff >= 1 and diff < 2) {
          count++;
          diff = diff - 1;
        }
      }
    } else {
      diff *= -1;
      while (diff != 0) {
        if (diff >= 5) {
          count += diff / 5;
          diff %= 5;
        } else if (diff >= 2 and diff < 5) {
          count += diff / 2;
          diff %= 2;
        } else if (diff >= 1 and diff < 2) {
          count++;
          diff = diff - 1;
        }
      }
    }
    cout << count << endl;
  }
}
