#include int gcd(int a, int b) { int r = a % b; while (r > 0) { a = b; b = r; r = a % b; } return b; } int main() { int a, b, c, d, e; scanf("%d %d %d %d %d", &a, &b, &c, &d, &e); int l = (a + c) / gcd(a + b, c + d) * (c + d); int i, cnt = 0; for (i = 1; i <= l; i++) if (1 <= i % (a + b) && i % (a + b) <= a && 1 <= i % (c + d) && i % (c + d) <= c) cnt++; cnt *= e / l; for (i = 1; i <= e % l; i++) if (1 <= i % (a + b) && i % (a + b) <= a && 1 <= i % (c + d) && i % (c + d) <= c) cnt++; printf("%d\n", cnt); return 0; }