#include <iostream>
#include <cmath>
using namespace std;
int main(){
float k, n, m, d, s;
cin >> k >> n >> m >> d;
s = (d * k * n * m) / (k * n * m - k * m - k * n - m * n);
if((1/k + 1/n + 1/m >= 1) || (floor(s/k) != s/k || floor(s/n) != s/n || floor(s/m) != s/m) || !(floor(s) == s)){
cout << "-1";
}else{
cout << s;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAKaW50IG1haW4oKXsKICAgIGZsb2F0IGssIG4sIG0sIGQsIHM7CiAgICBjaW4gPj4gayA+PiBuID4+IG0gPj4gZDsKICAgIHMgPSAoZCAqIGsgKiBuICogbSkgLyAoayAqIG4gKiBtIC0gayAqIG0gLSBrICogbiAtIG0gKiBuKTsKICAgIGlmKCgxL2sgKyAxL24gKyAxL20gPj0gMSkgfHwgKGZsb29yKHMvaykgIT0gcy9rIHx8IGZsb29yKHMvbikgIT0gcy9uIHx8IGZsb29yKHMvbSkgIT0gcy9tKSB8fCAhKGZsb29yKHMpID09IHMpKXsKCWNvdXQgPDwgIi0xIjsKICAgIH1lbHNlewogICAgCWNvdXQgPDwgczsKICAgIH0KICAgIAogICAgcmV0dXJuIDA7Cn0=