#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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;}

const ll mod=1e9+7;

int main(){
    ll n;
    cin >> n;
    ll ans=0;
    for(ll i=1;i<=100000;i++){
        if(i*i<=n){
            ans=i*i;
        }
    }
    cout << ans << endl;
}
#include<bits/stdc++.h>
using namespace std;

int main () {
    int x, ans = 0;
    cin >> x;

    ans += x/500*1000;
    x -= x/500*500;
    ans += x/5*5;
    cout << ans << endl;
}