interface Tree{
  <R> R welcome(Visitor<R> v);

  static class Prog implements Tree{
    Tree expr;
    Prog(Tree expr){this.expr=expr;}
    @Override public <R> R welcome(Visitor<R> v){
      return v.visit(this);
    }
  } 
  
  static class IntLit implements Tree{
    int n;
    IntLit(int n){
      this.n=n;
    }
    @Override public <R> R welcome(Visitor<R> v){
      return v.visit(this);
    }
  }
  static class MultExpr implements Tree{
    Tree op1;
    Tree op2;
    MultExpr(Tree op1,Tree op2){
      this.op1 = op1;
      this.op2 = op2;
    }
    @Override public <R> R welcome(Visitor<R> v){
      return v.visit(this);
    }

  }
  static class AddExpr implements Tree{
    Tree op1;
    Tree op2;
    AddExpr(Tree op1,Tree op2){
      this.op1 = op1;
      this.op2 = op2;
    }
    @Override public <R> R welcome(Visitor<R> v){
      return v.visit(this);
    }

  }

}
