#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;



int main(){
    double x,y;
    
    scanf("%lf%lf",&x,&y);
    
    double a=x*(1-y);
    double b=1-(x*y+(1-x)*y+(1-x)*(1-y));
    printf("%lf %lf\n",max(a,b),min(a,b));
    
    return 0;
}