using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static string InputPattern = "InputX";
static List<string> GetInputList()
{
var WillReturn = new List<string>();
if (InputPattern == "Input1") {
WillReturn.Add("10 10 10");
WillReturn.Add("1 1 1");
}
else if (InputPattern == "Input2") {
WillReturn.Add("10 3 1");
WillReturn.Add("2 1 1");
}
else if (InputPattern == "Input3") {
WillReturn.Add("5 10 3");
WillReturn.Add("2 5 3");
}
else if (InputPattern == "Input4") {
WillReturn.Add("8 8 8");
WillReturn.Add("1 1 9");
}
else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
}
return WillReturn;
}
static int mX1;
static int mY1;
static int mZ1;
static int mX2;
static int mY2;
static int mZ2;
static void Main()
{
List<string> InputList = GetInputList();
int[] wkArr = { };
Action<string> SplitAct = pStr =>
wkArr = pStr.Split(' ').Select(pX => int.Parse(pX)).ToArray();
SplitAct(InputList[0]);
mX1 = wkArr[0];
mY1 = wkArr[1];
mZ1 = wkArr[2];
SplitAct(InputList[1]);
mX2 = wkArr[0];
mY2 = wkArr[1];
mZ2 = wkArr[2];
var AnswerKouhoList = new List<int>();
AnswerKouhoList.Add(DeriveAnswerKouho(mX2, mY2, mZ2));
AnswerKouhoList.Add(DeriveAnswerKouho(mX2, mZ2, mY2));
AnswerKouhoList.Add(DeriveAnswerKouho(mY2, mZ2, mX2));
AnswerKouhoList.Add(DeriveAnswerKouho(mY2, mX2, mZ2));
AnswerKouhoList.Add(DeriveAnswerKouho(mZ2, mX2, mY2));
AnswerKouhoList.Add(DeriveAnswerKouho(mZ2, mY2, mX2));
Console.WriteLine(AnswerKouhoList.Max());
}
static int DeriveAnswerKouho(int pX2, int pY2, int pZ2)
{
int Div1 = mX1 / pX2;
int Div2 = mY1 / pY2;
int Div3 = mZ1 / pZ2;
return Div1 * Div2 * Div3;
}
}