#define _USE_MATH_DEFINES //M_PI #include <iostream> //std::cout, std::cin #include <string> //std::string #include <vector> //std::vector #include <valarray> //std::valarray 数値のみの一次配列 #include <algorithm> //std::sort #include <time.h> //localtime_s #include <cstdlib> //abs #include <cmath> //abs, std::pow, sqrt, sin, cos, #include <fstream> //std::ifstream #include <iomanip> //std::setprecision #include <random> //std::random(C++11) int main(void) { //test用 //std::ifstream in("test.txt"); //std::cin.rdbuf(in.rdbuf()); int W, D; std::cin >> W >> D; for (int i = 0; i < D - 1; i++) { W -= (int)(W / std::pow((D - i), 2)); } std::cout << W << std::endl; }