function [A] = A(flag,alpha1,alpha3,Ku,g,R,D,phi,B,mueu,poisu,kappa,Kf)

if flag==1
    if alpha1~=0
        A = (8/(15*pi*mueu))*((1-poisu)/(2-poisu))*((2-poisu)*D+3)*(1/alpha1);
        if isnan(A) || isinf(A)
            disp('A1 IS NAN OR INF -> SETTING TO ZERO!');
            A = 0;
        end
    else
        A = 0;
    end
elseif flag==2
    s1 = ((2*(1-poisu)*((2+kappa)^2+2))/((2+kappa)^2-2))-1+2*poisu;
    s2 = 2*(1-poisu)*((2+kappa)^2+2)-(1-2*poisu)*((2+kappa)^2-2);
    s3 = (-2*(1-poisu)*((2+kappa)^2+2)+mueu*((2+kappa)^2-2))^-1;
    s4 = (1/Ku-1/Kf-((1-2*poisu)^2/(2*mueu*(1+poisu))))^-1;
    
    A = B + (1/(15*mueu))*s1*s2*s3*s4;
    if isnan(A) || isinf(A)
        disp('A2 IS NAN OR INF -> SETTING TO ZERO!')
        A = 0;
    end
elseif flag==3
    if alpha3==1
        A = (5/mueu)*(4*mueu+3*Ku)/(8*mueu+9*Ku);
    else
        t1 = 2*(1-.5*(-(1+alpha3^2)*(g/alpha3^2)+R*(2-phi+(1+alpha3^2)*(g/alpha3^2))))^-1;
        t2 = (1-(1/4)*(3*phi+g-R*(g-phi)))^-1;
        t3 = (1-(1/4)*(3*phi+g-R*(g-phi)));
        t4 = (B*phi*(3-4*R)+g-R*(g+phi-4/3));
        t5 = 2*(R*(g+phi)-g+B*(1-phi)*(3-4*R));
        t6 = (1-(1/8)*(9*phi+3*g-R*(5*phi+3*g))+.5*B*phi*(3-4*R));
        t7 = 2*(B*(1-phi)*(3-4*R)-1+(3/2)*phi+.5*g-.5*R*(5*phi+g-4));
        t8 = (.5*B*phi*(3-4*R)+.5*g-.5*R*(g-phi));
        t9 = (1-(1/4)*(3*phi+g-R*(g-phi)))^-1;
        t10 = (R*((3/2)*g+(5/2)*phi)-(3/2)*(g+phi)+B*(3-4*R)-.5*(3*B-1)*(3-4*R)*(g+phi-R*(g-phi+2*phi^2)))^-1;
        
        A = (1/(5*mueu))*(t1+t2+(t3*t4+t5*t6-t7*t8)*t9*t10);
        if isnan(A) || isinf(A)
            disp('A3 IS NAN OR INF -> SETTING TO ZERO!')
            A = 0;
        end
    end
end