#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main() {
int n;cin>>n;n=n-3500;
if(n<=0)cout<<n+3500;
else if(n<=1455) cout<<n/0.97+3500;
else if(n<=4155) cout<<(n-1455)/0.9+1500+3500;
else if(n<=7755) cout<<(n-4155)/0.8+4500+3500;
else if(n<=27255) cout<<(n-7755)/0.75+9000+3500;
else if(n<=41255) cout<<(n-27255)/0.7+35000+3500;
else if(n<57505) cout<<(n-41255)/0.65+55000+3500;
else cout<<(n-57505)/0.55+80000+3500;
return 0;
}