#include <iostream>
using namespace std;
int main() {
int a1, a2, a3, b1, b2, b3;
int c1, c2, c3, d1, d2, d3;
int x1, x2, y1, y2, z1, z2;
cin >> a1 >> a2 >> a3 >> b1 >> b2 >> b3;
cin >> c1 >> c2 >> c3 >> d1 >> d2 >> d3;
if (a1 > c1)
{
x1 = a1;
}
else
{
x1 = c1;
}
if (b1 < d1)
{
x2 = b1;
}
else
{
x2 = d1;
}
if (a2 > c2)
{
y1 = a2;
}
else
{
y1 = c2;
}
if (b2 < d2)
{
y2 = b2;
}
else
{
y2 = d2;
}
if (a3 > c3)
{
z1 = a3;
}
else
{
z1 = c3;
}
if (b3 < d3)
{
x2 = b3;
}
else
{
x2 = d3;
}
if (x1 <= x2 && y1 <= y2 && z1 <= z2)
{
int ans = (x2 - x1 + 1) * (y2 - y1 + 1) * (z2 - z1 + 1);
cout << ans << endl;
}
else
{
cout << 0 << endl;
}
return 0;
}