#define    ll           long long
#define    dn           double
#define    mp           make_pair
#define    pb           push_back
#define    se           second
#define    fi           first
#define    mod          1000000007
#define    sob(v)       v.begin(),v.end()
#define    sobr(v)      v.rbegin(),v.rend()
#define    fr(i,a,b)    for(int i=a;i<=b;++i)
#define    frr(i,a,b)   for(int i=a;i>=b;--i)
#define    pi           acos(-1.00)
#define    inf          1e9
#define    check        cout<<"*"<<endl
#define    ffix(x)      cout<<fixed<<setprecision(x)
#define    fast         ios_base::sync_with_stdio(false);cill n.tie(NULL);cout.tie(NULL)

#include<bits/stdc++.h>
#include<string.h>
using namespace std;

typedef vector<int> vi;
typedef map<int,int> mii;
typedef pair<ll,int> pii;
typedef pair<int,vi> pp;
typedef pair<pair<int,int>,int> pain;

int dr[8]= {-1,0,+1,0,-1,-1,+1,+1};
int dc[8]= {0,+1,0,-1,-1,+1,-1,+1};

int kx[8]= {-1,+1,+1,-1,+2,+2,-2,-2};
int ky[8]= {+2,+2,-2,-2,-1,+1,+1,-1};


const int N=100005;

int main()
{
   ffix(12);
   dn a,b,c,d;
   cin>>a>>b>>c>>d;
   dn ans=a+((c-a)*b)/(b+d);
   cout<<ans<<endl;
}


#include <iostream>
#include <vector>

std::vector<int> StringsToInt(std::string str, std::string delimit) {
  std::vector<int> vec;

  if (str.find(delimit) == std::string::npos) {
    vec.emplace_back(std::atoi(str.c_str()));
    return vec;
  }
  
  for (std::size_t pos = 0;
       str.find(delimit) != std::string::npos;) {
    pos = str.find(delimit);
    vec.emplace_back(std::atoi(str.substr(0, pos).c_str()));
    str = str.substr(pos + delimit.size(), str.size());
  }
  vec.emplace_back(std::atoi(str.c_str()));
  return vec;
}

int main() {
  std::string dish, orange;
  if (std::getline(std::cin, dish) && std::getline(std::cin, orange)) {
    int sumDish = std::atoi(dish.c_str());
    std::vector<int> vOrange = StringsToInt(orange, " ");
    
    int max = 0;
    int left=0, right=sumDish, min=0, sum=0;
    while(true) {
      for (int k=left, count=1; k < right; ++k, ++count) {
        if (k == left) {
          min = vOrange.at(k);
        }
        int n = vOrange.at(k);
        if (min > n) {
          min = n;
        }
        sum = min * count;
        if (sum > max) {
          max = sum;
        }
      }
      for (int k=right-1, count=1; k > left-1; --k, ++count) {
        if (k == (right-1)) {
          min = vOrange.at(k);
        }
        int n = vOrange.at(k);
        if (min > n) {
          min = n;
        }
        sum = min * count;
        if (sum > max) {
          max = sum;
        }
      }
      if (left > right) {
        break;
      }
      ++left;
      --right;
    }
    std::cout << max << std::endl;
  }
  return 0;
}