#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e4+23;
struct Point{
int x,y;
Point(int x=0,int y=0):x(x),y(y) {}
bool operator < (const Point &b){
return x<b.x||(x==b.x&&y<b.y);
}
};
Point p[maxn],ch[maxn];int cnt;
typedef Point Vector;
Point operator + (Point A,Point B){return Point(A.x+B.x,A.y+B.y);}
Point operator - (Point A,Point B) {return Point(A.x-B.x,A.y-B.y);}
Point operator * (Point A,double B) {return Point(A.x*B,A.y*B);}
Point operator / (Point A,double B) {return Point(A.x/B,A.y/B);}
int dot(Vector a,Vector b){
return a.x*b.x+a.y*b.y;
}
int cross(Vector a,Vector b){
return a.x*b.y-a.y*b.x;
}
int length(Vector a){
return a.x*a.x+a.y*a.y;
}
int ConvexHull(Point *p,int n,Point *ch){
sort(p,p+n);
int m=0;
for(int i=0;i<n;i++){
while(m>1&&cross(ch[m-1]-ch[m-2],p[i]-ch[m-2])<=0) m--;
ch[m++]=p[i];
}
int k=m;
for(int i=n-2;i>=0;i--){
while(m>k&&cross(ch[m-1]-ch[m-2],p[i]-ch[m-2])<=0) m--;
ch[m++]=p[i];
}
if(n>1) m--;
return m;
}
int a[maxn],n,r,sz,ans,vis[100];
void dfs(int p,int dep){
if(dep==n){
int sum=0;
for(int i=0;i<n;i++){
for(int j=0;j<i;j++){
int x=a[i],y=a[j];
sum+=length(ch[y]-ch[x]);
}
}
ans=max(ans,sum);
return ;
}
for(int i=p+1;i<sz;i++){
a[dep]=i;
dfs(i,dep+1);
}
}
void dfs2(int p,int dep){
if(dep==n){
int sum=0;
for(int i=0;i<n;i++){
for(int j=0;j<i;j++){
int x=a[i],y=a[j];
sum+=length(ch[y]-ch[x]);
}
}
ans=max(ans,sum);
return ;
}
for(int i=p;i<sz;i++){
a[dep]=i;
dfs2(i,dep+1);
}
}
void solve(int x,int y){
n=x,r=y;
ans=0;
cnt=0;
for(int i=0;i<=r;i++){
for(int j=0;j<=r;j++){
if(i*i+j*j<=r*r){
p[cnt++]=Point(i,j);
p[cnt++]=Point(-i,j);
p[cnt++]=Point(i,-j);
p[cnt++]=Point(-i,-j);
}
}
}
sz=ConvexHull(p,cnt,ch);
dfs2(0,0);
printf("ans[%d][%d]=%d;\n",n,r,ans);
}
int main(){
// freopen("1.out","w",stdout);
for(int i=1;i<=8;i++){
for(int j=1;j<=30;j++) solve(i,j);
}
}