http://noi.openjudge.cn/ch0201/1749/
/*
2.1基本算法之枚举_1749数字方格01
http://noi.openjudge.cn/ch0201/1749/
https://blog.csdn.net/zqwang/article/details/79373814
https://blog.csdn.net/DreamChaserYx/article/details/78158339
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m,maxx;
cin>>n;
maxx=-1;
for(int i=0;i<=n;i++)
for(int j=0;j<=n;j++)
for(int k=0;k<=n;k++)
{
if((i+j)%2==0 && (j+k)%3==0 && (i+j+k)%5==0)
{
m=i+j+k;
}
if(m>maxx)
{
maxx=m;
}
}
printf("%d",maxx);
return 0;
}