#include #define MAP(BODY) Map([](auto const X1) { return BODY; }) #define vec(N, I) make_vec(N, I) #define rep(i, n) for (int i = 0; i < (int)(n); i++) template std::vector make_vec(N n, T i) { return std::vector(n, i); } template auto operator|(const A &a, const F &f) { return f(a); } template std::ostream &operator<<(std::ostream &os, const std::vector &vec) { os << "["; const size_t vec_len = vec.size(); if (vec_len > 0) { for (int i = 0; i < vec_len - 1; i++) { os << vec[i] << ',' << ' '; } os << vec[vec_len - 1]; } os << "]\n"; return os; } template std::ostream &operator<<(std::ostream &os, const std::set &vec) { os << "{"; auto i = vec.begin(); while (i != vec.end()) std::cout << *i++ << ","; os << "\b}"; return os; } template std::ostream &operator<<(std::ostream &os, const std::vector> &vec) { os << '{'; vec | MAP(({ std::cout << "<" << X1.first << "," << X1.second << ">" << std::endl, X1; })); os << "}\n"; return os; } template std::ostream &operator<<(std::ostream &os, const std::pair &tar) { os << '<' << tar.first << ',' << tar.second << '>' << std::endl; return os; } auto print = [](const auto a) { std::cout << a << std::endl; return a; }; template auto Map(F f) { return [=](const auto &ma) { return map_instance(f, ma); }; } template auto map_instance(F f, const std::vector &vec) { using R = typename std::result_of::type; int size = vec.size(); std::vector result(size); for (int i = 0; i < size; i++) { result[i] = f(vec[i]); } return result; } using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef unsigned long long int ull; typedef pair pll; typedef pair pull; typedef pair pi; int N; int main() { cin >> N ; auto num=N/500; if(N-num*500<=100){ num|print; }else if(N-num*500>=0){ num+1|print; } }