For this Question: <i>We didn't like the final season much, so finale isn't GOT! :P </i>

Making a sword involves three stages, forging it, carrying it to polishing center and then polishing it. There are two types of swords that must be made. 
Forging sword 1 and sword 2 takes X hours.
Carrying sword 1 from forging centre to polishing centre takes T1 hours.
Carrying sword 2 from forging centre to polishing centre takes T2 hours.
Polishing sword 1 and sword 2 takes X hours.
No two swords can be in same stage at a time, but two swords can be in different stages in parallel.
Thomas is required to make A swords of type 1 and B swords of type 2. Find the minimum time required by Thomas to make all the swords. You can make swords in any order.Input contains 5 integers X T1 T2 A B.

Constraints:
1 <= X, T1, T2 <= 10000
1 <= A, B <= 100000The minimum time required to produce the required swords.Sample Input
6 4 8 2 2

Sample Output
38

Explanation: Optimal order is sword 2 sword 1 sword 1 sword 2.
First sword will be finished forging after 6 hours.
First sword will be finished transporting after 14 hours.
First sword will be finished polishing after 20 hours.
Second sword can enter forging after 6 hours so it will be finished forging at 12 hours.
Second sword can enter transporting after 14 hours so it will be finished transporting at 18 hours.
Second sword can enter polishing after 20 hours so it will be finished polishing at 26 hours.
Third sword can enter forging after 12 hours so it will be finished forging at 18 hours.
Third sword can enter transporting after 18 hours so it will be finished transporting at 22 hours.
Third sword can enter polishing after 26 hours so it will be finished polishing at 32 hours.
Fourth sword can enter forging after 18 hours so it will be finished forging at 24 hours.
Fourth sword can enter transporting after 24 hours so it will be finished transporting at 32 hours.
Fourth sword can enter polishing after 32 hours so it will be finished polishing at 38 hours., I have written this Solution Code: #pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountll
#define m_p make_pair
#define infi 1e18+1
#define eps 0.000000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
//////////////
template<class C> void mini(C&a4, C b4){a4=min(a4,b4);}
typedef unsigned long long ull;
auto clk=clock();
#define all(x) x.begin(),x.end()
#define S second
#define F first
#define sz(x) ((long long)x.size())
#define int long long  
#define f80 __float128
#define pii pair<int,int>
/////////////

int t,c1,c2,a1,a2;
bool spr(int x){
  int zapas = x;
  int b1 = a1;
  int b2 = a2;
  while(b1 || b2){
    mini(zapas,x);
    if(b2 && zapas >= c2){
      zapas -= c2;
      b2--;
    }else{
      if(b1 == 0 || zapas < c1){
        return 0;
      }
      zapas -= c1;
      b1--;
    }
    zapas += t;
  }
  return 1;
}

signed main(){
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	cin >> t >> c1 >> c2 >> a1 >> a2;
	if(a1 + a2 == 0){
	cout << "0\n";
	return 0;
	}
	int po = 0;
	int ko = 2e9;
	while(po+1 < ko){
	int m = (po+ko) >>1;
	if(spr(m))
	  ko = m;
	else
	  po = m;
	}
	cout << t*(a1+a2+1) + ko << endl;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?