#include int gcd(int a, int b) { if (a == 0) return b; else return gcd(b % a, a); } int main() { int A, B, C, D, E; scanf("%d %d %d %d %d", &A, &B, &C, &D, &E); int i, g = gcd(A + B, C + D), l = (A + B) * (C + D) / g, x[250001] = {}, sum = 0; for (i = 0; i < l; i++) { if (i % (A + B) < A && i % (C + D) < C) { x[i] = 1; sum++; } } sum *= E / l; for (i = E % l - 1; i >= 0; i--) sum += x[i]; printf("%d\n", sum); fflush(stdout); return 0; }