Problem: In the probability theory the following paradox called Benford's law is known: "In many lists of random numbers taken from real sources, numbers starting with digit 1 occur much more often than numbers starting with any other digit" (that's the simplest form of the law).

Having read about it on Codeforces, the Hedgehog got intrigued by the statement and wishes to thoroughly explore it. He finds the following similar problem interesting in particular: there are N random variables, the i-th of which can take any integer value from some segment [Li;Ri] (all numbers from this segment are equiprobable). It means that the value of the i-th quantity can be equal to any integer number from a given interval [Li;Ri] with probability 1 / (Ri - Li + 1).

The Hedgehog wants to know the probability of the event that the first digits of at least K% of those values will be equal to one. In other words, let us consider some set of fixed values of these random variables and leave only the first digit (the MSD — most significant digit) of each value. Then let's count how many times the digit 1 is encountered and if it is encountered in at least K per cent of those N values, than such set of values will be called a good one. You have to find the probability that a set of values of the given random variables will be a good one.

Input

The first line contains number N which is the number of random variables (1 ≤ N ≤ 1000). Then follow N lines containing pairs of numbers Li, Ri, each of whom is a description of a random variable. It is guaranteed that 1 ≤ Li ≤ Ri ≤ 1018.

The last line contains an integer K (0 ≤ K ≤ 100).

All the numbers in the input file are integers.

Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cin (also you may use %I64d).

Output

Print the required probability. Print the fractional number with such a precision that the relative or absolute error of the result won't exceed 10 - 9.

Examples

Input

1
1 2
50


Output

0.500000000000000

Input

2
1 2
9 11
50


Output

0.833333333333333

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:247474112")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long long mod = (long long)1e9 + 7;
const int inf = 1e9 + 7;
const long long infL = 1e18;
int setbit(int n, int pos) { return n = n | (1 << pos); }
int resetbit(int n, int pos) { return n = n & ~(1 << pos); }
bool checkbit(int n, int pos) { return (bool)(n & (1 << pos)); }
template <typename T>
T mul(T x, T y) {
  x %= mod;
  y %= mod;
  return (x * y) % mod;
}
template <typename T>
T add(T x, T y) {
  x %= mod;
  y %= mod;
  return (x + y) % mod;
}
template <typename T>
T modPow(T x, T k, T mod) {
  if (k == 0) return 1;
  if (k & 1) {
    return ((x % mod) * modPow(x, k - 1, mod) % mod) % mod;
  } else {
    T ret = modPow(x, k / 2, mod);
    ret %= mod;
    return (ret * ret) % mod;
  }
}
template <typename T>
T ext_gcd(T num1, T num2, T &X, T &Y) {
  T r2, r1, q2, q1, x2, x1, y2, y1, x, y, r;
  x2 = 1;
  y2 = 0;
  x1 = 0;
  y1 = 1;
  for (r2 = num1, r1 = num2; r1 != 0;
       y2 = y1, y1 = y, x2 = x1, x1 = x, r2 = r1, r1 = r) {
    q1 = r2 / r1;
    x = x2 - q1 * x1;
    y = y2 - q1 * y1;
    r = r2 % r1;
  }
  X = x2;
  Y = y2;
  return r2;
}
template <typename T>
void print(const T &v) {
  cerr << v << ' ';
}
template <typename T1, typename... T2>
void print(const T1 &first, const T2 &...rest) {
  print(first);
  print(rest...);
}
template <typename T>
T modInv(T x, T m = 1e9 + 7) {
  return modPow(x, m - 2, m);
}
template <typename T>
void dbg_a(T a[], int n = 10) {
  cerr << "[ ";
  for (int i = 0; i < n; i++) cerr << a[i] << ' ';
  cerr << " ]"
       << "\n";
}
template <typename F, typename S>
ostream &operator<<(ostream &os, const pair<F, S> &p) {
  return os << "[ " << p.first << ", " << p.second << " ]";
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[ ";
  for (int i = 0; i < v.size(); i++) os << v[i] << ' ';
  return os << " ]";
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &s) {
  os << "[ ";
  for (__typeof((s).begin()) it = (s).begin(); it != (s).end(); ++it)
    os << *it << ' ';
  return os << " ]";
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &s) {
  os << "[ ";
  for (__typeof((s).begin()) it = (s).begin(); it != (s).end(); ++it)
    os << *it << ' ';
  return os << " ]";
}
long long modAdd(long long &x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
  return x;
}
const int M = (int)1e6 + 33;
const int mx = 1000 + 23;
double dp[mx][mx], p[mx];
long long n, dvis = 0;
long long save[20][2][2], vis[20][2][2], cnt[mx];
vector<int> v;
long long func(int id, int f, int zero) {
  if (id >= v.size()) return (zero == 1) * 1LL;
  long long &ans = save[id][f][zero], &dv = vis[id][f][zero];
  if (ans != -1) return ans;
  dv = dvis;
  int lo, hi;
  ans = 0;
  if (zero == 0) {
    ans = func(id + 1, f, zero);
    if (id > 0)
      f = 1;
    else {
      if (v[id] > 1)
        f = 1;
      else
        f = 0;
    }
    ans += func(id + 1, f, 1);
  } else {
    if (f == 0) {
      lo = 0;
      hi = v[id];
      for (int i = lo; i <= hi; i++) {
        ans += func(id + 1, (i == hi ? 0 : 1), zero);
      }
    } else {
      lo = 0;
      hi = 9;
      for (int i = lo; i <= hi; i++) ans += func(id + 1, f, zero);
    }
  }
  return ans;
}
long long calc(long long x) {
  dvis++;
  memset(save, -1, sizeof save);
  v.clear();
  while (x) {
    v.push_back(x % 10);
    x /= 10;
  }
  reverse(v.begin(), v.end());
  return func(0, 0, 0);
}
double go(int id, int cnt) {
  if (cnt < 0) return 0;
  if (id < 1) {
    return (cnt == 0) * 1.0;
  }
  double &ans = dp[id][cnt];
  if (ans > -1.0) return ans;
  ans = go(id - 1, cnt - 1) * p[id];
  ans += go(id - 1, cnt) * (1.0 - p[id]);
  return ans;
}
void solve() {
  long long x, y, k;
  memset(dp, -1, sizeof dp);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y;
    cnt[i] = calc(y) - calc(x - 1);
    p[i] = cnt[i] / ((y - x + 1) * 1.0);
  }
  cin >> k;
  double ans = 0;
  for (long long i = 1; i <= n; i++) {
    if ((i * 100LL) >= k * n) {
      double tm = go(n, i);
      if (tm > -1.0) ans += tm;
    }
  }
  if (k == 0) ans = 1.0;
  cout << setprecision(12) << fixed;
  cout << ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1, c = 0;
  while (t--) {
    solve();
  }
  return 0;
}