#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
double Px[maxn], P[maxn][maxn];
long long L[maxn], R[maxn];
long long f(long long x) {
  long long x0 = x;
  if (x == 0) return 0;
  long long case2 = 0, case1 = 0;
  while (x >= 10) {
    case2 = case2 * 10 + 8;
    case1 = case1 * 10 + 1;
    x /= 10;
  }
  if (x == 1) return x0 - case2;
  return case1 * 10 + 1;
}
int get() {
  int n, K;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d%I64d", L + i, R + i);
    Px[i] = (double)(f(R[i]) - f(L[i] - 1)) / (double)(R[i] - L[i] + 1);
  }
  scanf("%d", &K);
  P[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      P[i][j] = P[i - 1][j] * (1.0 - Px[i]) + P[i - 1][j - 1] * Px[i];
    }
  }
  double ans = 0;
  for (int m = 0; m <= n; m++) {
    if (m * 100 >= K * n) ans += P[n][m];
  }
  printf("%.15f\n", ans);
  return 1;
}
int main() {
  get();
  return 0;
}
