public class Rectangle
    {
        public int x1;
        public int y1;
        public int x2;
        public int y2;
        public Rectangle(int x1, int y1, int x2, int y2)
        {
        this.x1 = x1;
        this.y1 = y1;
        this.x2 = x2;
        this.y2 = y2;
        }
    }

    static int RectangleArea(Rectangle r1, Rectangle r2)
    {
        int maxx = Math.Max(r1.x1, r2.x1);
        int minx = Math.Min(r1.x2, r2.x2);
        int maxy = Math.Max(r1.y1, r2.y1);
        int miny = Math.Min(r1.y2, r2.y2);

        if (minx>maxx && miny > maxy )
        {
        return (maxx - minx) * (maxy - miny);
        }
        else
        {
        return 0;
        }
    }