import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int e = sc.nextInt(); int ab = a + b; int cd = c + d; int lcm = getLCM(ab, cd); int[] imos = new int[lcm]; for (int i = 0; i * ab < lcm; i++) { imos[i * ab]++; imos[i * ab + a]--; } for (int i = 0; i * cd < lcm; i++) { imos[i * cd]++; imos[i * cd + c]--; } int base = 1; for (int i = 1; i < lcm; i++) { imos[i] += imos[i - 1]; base += imos[i] / 2; } int ans = base * (e / lcm); for (int i = 0; i < e % lcm; i++) { ans += imos[i] / 2; } System.out.println(ans); } static int getLCM(int x, int y) { return x / getGCD(x, y) * y; } static int getGCD(int x, int y) { if (x % y == 0) { return y; } else { return getGCD(y, x % y); } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }