#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/lesson/2/ITP1/1/ITP1_1_A"
#include "../src/dataStructure/monotone_CHT.hpp"
#include <iostream>
intmain(){// std::cin.tie(nullptr);// std::ios::sync_with_stdio(false);// int N; std::cin >> N;// long long C; std::cin >> C;// zawa::monotone_CHT<long long, true> cht;// long long h1; std::cin >> h1;// cht.add(-2 * h1, h1 * h1);// long long ans;// for (int _ = 0 ; _ < N - 1 ; _++) {// long long h; std::cin >> h;// ans = cht.incremental_query(h) + C + h * h;// cht.add(-2 * h, ans + h * h);// }// std::cout << ans << '\n';std::cout<<"Hello World"<<std::endl;}/*
* Educational DP Contest - Z Frog 3
* https://atcoder.jp/contests/dp/submissions/39114088
*/
#line 1 "test/EDPC-Z.test.cpp"
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/lesson/2/ITP1/1/ITP1_1_A"
#line 2 "src/dataStructure/monotone_CHT.hpp"
#include <deque>
#include <cassert>
namespacezawa{template<classT,boolmin>classmonotone_CHT{private:structline{Tcoeff,intercept;line(T_coeff,T_intercept):coeff(_coeff),intercept(_intercept){}Tmap(Tx){returncoeff*x+intercept;}};std::deque<line>dat;boolis_need(constline&l1,constline&l2,constline&l3){assert(l1.coeff>=l2.coeffandl2.coeff>=l3.coeff);return(l1.coeff-l2.coeff)*(l2.intercept-l3.intercept)<(l2.coeff-l3.coeff)*(l1.intercept-l2.intercept);}boolmanage_front(constline&l){if(l.coeff==dat.front().coeffandl.intercept>=dat.front().intercept){returnfalse;}while(size()>=2and!is_need(l,dat.front(),dat[1])){dat.pop_front();}returntrue;}boolmanage_back(constline&l){if(l.coeff==dat.back().coeffandl.intercept>=dat.back().intercept){returnfalse;}while(size()>=2and!is_need(dat[size()-2],dat.back(),l)){dat.pop_back();}returntrue;}voidadd(constline&l){if(empty()){dat.push_back(l);return;}if(l.coeff>=dat.front().coeff){if(manage_front(l)){dat.push_front(l);}}elseif(dat.back().coeff>=l.coeff){if(manage_back(l)){dat.push_back(l);}}else{assert(false);}}public:monotone_CHT(){}inlineboolempty(){returndat.empty();}inlinestd::size_tsize(){returndat.size();}inlinestd::deque<line>_dat(){returndat;}voidadd(Tcoeff,Tintercept){if(!min){coeff*=-1;intercept*=-1;}add(line(coeff,intercept));}Tincremental_query(Tx){assert(!empty());while(dat.size()>=2anddat.front().map(x)>=dat[1].map(x)){dat.pop_front();}return(min?1:-1)*dat.front().map(x);}Tdecremental_query(Tx){assert(!empty());while(dat.size()>=2anddat.back().map(x)>=dat[size()-2].map(x)){dat.pop_back();}return(min?1:-1)*dat.back().map(x);}Tquery(Tx){assert(!empty());intleft=-1,right=size()-1;while(right-left>1){intmid=(left+right)>>1;if(dat[mid].map(x)>=dat[mid+1].map(x)){left=mid;}else{right=mid;}}return(min?1:-1)*dat[right].map(x);}};}// namespace zawa#line 4 "test/EDPC-Z.test.cpp"
#include <iostream>
intmain(){// std::cin.tie(nullptr);// std::ios::sync_with_stdio(false);// int N; std::cin >> N;// long long C; std::cin >> C;// zawa::monotone_CHT<long long, true> cht;// long long h1; std::cin >> h1;// cht.add(-2 * h1, h1 * h1);// long long ans;// for (int _ = 0 ; _ < N - 1 ; _++) {// long long h; std::cin >> h;// ans = cht.incremental_query(h) + C + h * h;// cht.add(-2 * h, ans + h * h);// }// std::cout << ans << '\n';std::cout<<"Hello World"<<std::endl;}/*
* Educational DP Contest - Z Frog 3
* https://atcoder.jp/contests/dp/submissions/39114088
*/