#include <bits/stdc++.h>
using namespace std;
int n, kp;
long long ones[1005];
long long range[1005];
long long countf(long long num) {
  if (num < 10) {
    if (num >= 1) return 1;
    return 0;
  }
  int c, c2;
  long long ret = 0;
  long long K = 1;
  while (num / K >= 10) {
    ret += K;
    K *= 10;
  }
  if (num / K > 1)
    ret += K;
  else
    ret += num - K + 1;
  return ret;
}
double best[1005][1005];
bool flag[1005][1005];
double solve(int ind, int k) {
  if (ind == n) {
    if (k == 0) return 1;
    return 0;
  }
  if (flag[ind][k]) return best[ind][k];
  int c, c2;
  double ret = 0;
  ret = (double)ones[ind] / (double)range[ind] * solve(ind + 1, max(k - 1, 0));
  ret += ((double)range[ind] - (double)ones[ind]) / ((double)range[ind]) *
         solve(ind + 1, k);
  flag[ind][k] = 1;
  return best[ind][k] = ret;
}
int main() {
  FILE *in = stdin;
  int c, c2;
  fscanf(in, "%d", &n);
  for (c = 0; c < n; c++) {
    long long t1, t2;
    fscanf(in, "%I64d%I64d", &t1, &t2);
    range[c] = t2 - t1 + 1;
    ones[c] = countf(t2) - countf(t1 - 1);
  }
  fscanf(in, "%d", &kp);
  int k = (kp * n) / 100;
  k += (bool)((kp * n) % 100);
  memset(flag, 0, sizeof(flag));
  double ret = solve(0, k);
  printf("%.10lf\n", ret);
  return 0;
}
