/*
    author:  Maksim1744
    created: 14.11.2020 15:06:23
*/

#include <bits/stdc++.h>

using namespace std;

#define ll   long long
#define ld   long double

#define mp   make_pair
#define pb   push_back
#define eb   emplace_back

#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

template<typename T>             vector<T>& operator--            (vector<T>& v){for (auto& i : v) --i;            return  v;}
template<typename T>             vector<T>& operator++            (vector<T>& v){for (auto& i : v) ++i;            return  v;}
template<typename T>             istream& operator>>(istream& is,  vector<T>& v){for (auto& i : v) is >> i;        return is;}
template<typename T>             ostream& operator<<(ostream& os,  vector<T>& v){for (auto& i : v) os << i << ' '; return os;}
template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& p){is >> p.first >> p.second;        return is;}
template<typename T, typename U> ostream& operator<<(ostream& os, pair<T, U>& p){os << p.first << ' ' << p.second; return os;}
template<typename T, typename U> pair<T,U> operator-(pair<T,U> a, pair<T,U> b){return mp(a.first-b.first, a.second-b.second);}
template<typename T, typename U> pair<T,U> operator+(pair<T,U> a, pair<T,U> b){return mp(a.first+b.first, a.second+b.second);}
template<typename T, typename U> void umin(T& a, U b){if (a > b) a = b;}
template<typename T, typename U> void umax(T& a, U b){if (a < b) a = b;}

#ifdef HOME
#define TAG_LENGTH       25
#define LR_LEFT          left
#define LR_RIGHT         right
#define LR_VALUE         value
#define LR_SECOND_VALUE  mn
#include "C:/C++ libs/print.cpp"
#else
#define showl            42;
#define shows            42;
#define show(...)        42;
#define showm(...)       42;
#define showt(...)       42;
#define printTree(...)   42;
#define printGraph(...)  42;
#define printLRTree(...) 42;
#define printMatrix(...) 42;
#define printWGraph(...) 42;
#define debug     if (false)
#endif

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int n;
    cin >> n;
    vector<vector<int>> g(n);
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        for (int j = 0; j < n; ++j) {
            if (s[j] == '1') {
                g[j].pb(i);
            }
        }
    }

    ld ans = 0;
    for (int i = 0; i < n; ++i) {
        vector<int> u(n, false);
        function<void(int)> dfs = [&](int v) {
            u[v] = true;
            for (auto k : g[v]) {
                if (!u[k]) {
                    dfs(k);
                }
            }
        };
        dfs(i);
        int sz = sum(u);
        ans += 1.0l / sz;
    }
    cout << setprecision(20) << fixed << ans << '\n';

    return 0;
}

//#include <atcoder/all>
//using namespace atcoder;
#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (ll i = (a); i > (b); --i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define SZ(a) ((ll)size(a))
#define print(x) cout << (x) << endl;
#define printn(x, n)                     \
    rep(i, n) { cout << (x[i]) << " "; } \
    cout << endl;

template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;

void solve(long long t, long long N)
{
    ll i;
    i = 1;
    ll tmp,tmp2,tmp3;
    ll prev = 1;
    ll num = 0;
    vl v;
    FOR(i, 1, 101)
    {
        tmp = ((100 + t) * i) / 100;
        if (tmp > prev + 1)
        {
            num++;
            v.push_back(tmp-1);
        }
        prev = tmp;
    }

    tmp=(N-1)/num;
    tmp2=(N-1)%num;
    print((100+t)*tmp+v[tmp2]);
}

int main()
{
    long long t;
    scanf("%lld", &t);
    long long N;
    scanf("%lld", &N);
    solve(t, N);
    return 0;
}
