#include<bits/stdc++.h>
#define N 1005
#define db long double
using namespace std;
int n,K;
const db eps = 1e-10;
db sgn(db x) { return x < -eps ? -1 : x > eps; }
db eq(db x, db y) { return !sgn(x - y); }
struct p2 {
db x, y;
db norm() const { return x * x + y * y; }
db abs() const { return std::sqrt(x * x + y * y); }
db arg() const { return atan2(y, x); }
}a[N];
p2 r90(p2 x) { return {-x.y, x.x}; }
p2 operator + (p2 x, p2 y) { return {x.x + y.x, x.y + y.y}; }
p2 operator - (p2 x, p2 y) { return {x.x - y.x, x.y - y.y}; }
p2 operator / (p2 x, db y) { return {x.x / y, x.y / y}; }
p2 operator * (p2 x, db y) { return {x.x * y, x.y * y}; }
p2 operator * (db y, p2 x) { return {x.x * y, x.y * y}; }
db operator * (p2 x, p2 y) { return x.x * y.y - x.y * y.x; }
db operator % (p2 x, p2 y) { return x.x * y.x + x.y * y.y; }
struct circle : p2 { db r; };
circle incircle(p2 a, p2 b, p2 c) {
db A = (b - c).abs(), B = (c - a).abs(), C = (a - b).abs();
return {(a * A + b * B + c * C) / (A + B + C), fabs((b - a) * (c - a)) / (A + B + C)};
} // 三点确定内心,不是最小圆覆盖内容
circle circumcenter(p2 a, p2 b, p2 c) {
p2 bc = c - b, ca = a - c, ab = b - a;
p2 o = (b + c - r90(bc) * (ca % ab) / (ca * ab)) / 2;
return {o, (a - o).abs()};
}// 三点确定外心
circle cir(p2 a, p2 b) { // 根据直径生成圆
return {(a + b) / 2, (a - b).abs() / 2};
}
bool in(circle x, p2 y) { return (p2(x) - y).abs() <= x.r + eps; }
int gen(int x){
return (1ll*x*233811181+1)%(2147483647);
}
db cst[N][N];
db f[N];
int st[N];
db g[N][N];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin>>n>>K>>a[1].x;
for(int i=1;i<=n;++i){
if(i>=2) a[i].x=gen(a[i-1].y);
a[i].y=gen(a[i].x);
}
for(int bg=1;bg<=n;++bg){
cir o={a[bg],0.0};
cst[bg][bg]=0.0;
for(int bg = bg+1;i < n;++i) {
if(in(o, a[i])) continue;
o = cir(a[bg], a[i]);
for(int j = bg;j < i;++j) {
if(in(o, a[j])) continue;
o = cir(a[j], a[i]);
for(int k = 0;k < j;++k) {
if(in(o, a[k])) continue;
o = circumcenter(a[i], a[j], a[k]);
}
cst[bg][i]=o.r;
}
}
}
// for(int i=1;i<=n;++i){
// for(int j=i;j<=n;++j)
// cerr<<cst[i][j]<<" \n"[j==n];
// }
// db L=-1e10,R=1e10;
// cerr<<L<<" "<<R<<endl;
// for(int t=1;t<=100;++t){
// db mid=(L+R)/2.0;
// f[0]=0;
// st[0]=0;
// for(int i=1;i<=n;++i){
// f[i]=1e18;
// for(int j=0;j<i;++j)
// if(f[i]>f[j]+cst[j+1][i]+mid)
// f[i]=f[j]+cst[j+1][i]+mid,st[i]=st[j]+1;
// }
// if(st[n]>K) L=mid;
// if(st[n]==K){
// cout<<f[n]-mid*K<<'\n';
// return 0;
// }
// if(st[n]<K) R=mid;
// cerr<<mid<<" "<<st[n]<<endl;
// }
for(int i=0;i<=n;++i)
for(int j=0;j<=K;++j)
g[i][j]=1e18;
g[0][0]=0.0;
for(int i=1;i<=n;++i)
for(int j=0;j<i;++j)
for(int k=1;k<=K;++k)
g[i][k]=min(g[i][k],g[j][k-1]+cst[j+1][i]);
cout<<setprecision(20)<<g[n][K]<<'\n';
return 0;
}