Пример программы на java:
import java.io.*;
import java.util.Scanner;
public class Test {
public static void main(String[] args) throws IOException {
int P = 0;
Scanner scanner = new Scanner(System.in);
int a = scanner.nextInt();
int b = scanner.nextInt();
double x = (a+b)/(a*b);
System.out.println(x);
}
}