func_code_string: #include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }   long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }   long long n, s1, v1, s2, v2;   long long i, j, k, ans, p, q, m, num;   inline long long cal_1() { return i * v1 + (n - i * s1) / s2 * v2; }   inline long long cal_2() { return i * v2 + (n - i * s2) / s1 * v1; }   inline long long maxn(long long a, long long b) {     if (a > b)       return a;     else       return b;   }   int main() {     cin >> n >> v1 >> v2 >> s1 >> s2;     m = lcm(s1, s2);     num = n / m;     if (num > 0) num--;     if (v1 * s2 >= v2 * s1) {       num = m / s1 * num;       p = (n - num * s1) / s2;       ans = num * v1 + p * v2;       if (s1 >= s2) {         for (i = num; i * s1 <= n; i++) ans = maxn(ans, cal_1());       } else {         for (i = p; i >= 0; i--) ans = maxn(ans, cal_2());       }     } else {       num = m / s2 * num;       p = (n - num * s2) / s1;       ans = num * v2 + p * v1;       if (s2 >= s1) {         for (i = num; i * s2 <= n; i++) ans = maxn(ans, cal_2());       } else {         for (i = p; i >= 0; i--) ans = maxn(ans, cal_1());       }     }     cout << ans << endl;     return 0;   }   