Problem:
Area

For a given polygon g, computes the area of the polygon.

g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The line segment connecting pn and p1 is also a side of the polygon.

Note that the polygon is not necessarily convex.

Input

The input consists of coordinates of the points p1,..., pn in the following format:

n
x1 y1
x2 y2
:
xn yn

The first integer n is the number of points. The coordinate of a point pi is given by two integers xi and yi. The coordinates of points are given in the order of counter-clockwise visit of them.

Output

Print the area of the polygon in a line. The area should be printed with one digit to the right of the decimal point.

Constraints

3 ≤ n ≤ 100

-10000 ≤ xi, yi ≤ 10000

No point will occur more than once.

Two sides can intersect only at a common endpoint.

Sample Input 1

3
0 0
2 2
-1 1

Sample Output 1

2.0

Sample Input 2

4
0 0
1 1
1 2
0 2

Sample Output 2

1.5

Solution in C# (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
using P_Pair = System.Collections.Generic.KeyValuePair<Point, Point>;
using Polygon = System.Collections.Generic.List<Point>;

class Program
{
    static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        new Program().solve();
        Console.Out.Flush();
    }
    Scanner cin = new Scanner();

    int n;
    void solve()
    {
        n = cin.nextint;
        var PO = new Polygon();
        for (int i = 0; i < n; i++)
        {
            PO.Add(new Point(cin.nextint, cin.nextint));
        }
        double sum = 0;
        for (int i = 0; i < n; i++)
        {
            int d = (i + 1 == n) ? 0 : i + 1;
            sum += PO[i].Cross(PO[d]);
        }
        Console.WriteLine((sum / 2).ToString("F1"));
    }

}
struct Point
{
    static readonly double EPS = 1E-10;
    internal double x, y;
    public Point(double x, double y)
    {
        this.x = x;
        this.y = y;
    }

    public static Point operator +(Point a, Point b) { return new Point(a.x + b.x, a.y + b.y); }
    public static Point operator -(Point a, Point b) { return new Point(a.x - b.x, a.y - b.y); }
    public static Point operator *(Point a, double k) { return new Point(k * a.x, k * a.y); }
    public static Point operator /(Point a, double k) { return new Point(a.x / k, a.y / k); }

    public double Abs { get { return Math.Sqrt(Norm); } }
    public double Norm { get { return x * x + y * y; } }
    public double Arg { get { return Math.Atan2(y, x); } }
    public double Dot(Point p) { return x * p.x + y * p.y; }
    public double Cross(Point p) { return x * p.y - y * p.x; }
    public double GetDistance(Point p) { return (this - p).Abs; }

    public static bool operator <(Point a, Point b) { return Math.Abs(a.x - b.x) > EPS ? a.x < b.x : a.y < b.y; }
    public static bool operator >(Point a, Point b) { return Math.Abs(a.x - b.x) > EPS ? a.x > b.x : a.y > b.y; }
    public static bool operator ==(Point a, Point b) { return Math.Abs(a.x - b.x) < EPS && Math.Abs(a.y - b.y) < EPS; }
    public static bool operator !=(Point a, Point b) { return Math.Abs(a.x - b.x) >= EPS || Math.Abs(a.y - b.y) >= EPS; }

    public override bool Equals(object p) { return Math.Abs(x - ((Point)p).x) < EPS && Math.Abs(y - ((Point)p).y) < EPS; }
    public override int GetHashCode() { return x.GetHashCode() ^ y.GetHashCode(); }

    public int CCW(Point b)
    {
        if (Cross(b) > EPS) return 1;
        if (Cross(b) < -EPS) return -1;
        if (Dot(b) < -EPS) return 2;
        if (Norm < b.Norm) return -2;
        return 0;
    }
    public int Contains(Polygon g)
    {
        int n = g.Count;
        bool x = false;
        for (int i = 0; i < n; i++)
        {
            Point a = g[i] - this, b = g[(i + 1) % n] - this;
            if (Math.Abs(a.Cross(b)) < EPS && a.Dot(b) < EPS) return 1;
            if (a.y > b.y)
            {
                Point t = a;
                a = b;
                b = t;
            }
            if (a.y < EPS && EPS < b.y && a.Cross(b) > EPS) x = !x;
        }
        return (x ? 2 : 0);
    }
}
struct Segment
{
    internal Point p1, p2;
    public Segment(Point p1, Point p2)
    {
        this.p1 = p1;
        this.p2 = p2;
    }
    public Point Projection(Point p)
    {
        Point b = p2 - p1;
        double r = b.Dot(p - p1) / b.Norm;
        return p1 + b * r;
    }
    public Point Reflection(Point p)
    {
        return p + (Projection(p) - p) * 2;
    }
    public double GetD_LP(Point p)
    {
        return Math.Abs((p - p1).Cross(p2 - p1) / (p2 - p1).Abs);
    }
    public double GetD_SP(Point p)
    {
        if ((p - p1).Dot(p2 - p1) < 0) return (p - p1).Abs;
        if ((p - p2).Dot(p1 - p2) < 0) return (p - p2).Abs;
        return GetD_LP(p);
    }
    public bool Intersect(Segment s)
    {
        return (p2 - p1).CCW(s.p1 - p1) * (p2 - p1).CCW(s.p2 - p1) <= 0 &&
            (s.p2 - s.p1).CCW(p1 - s.p1) * (s.p2 - s.p1).CCW(p2 - s.p1) <= 0;
    }
    public double GetDistance(Segment s)
    {
        if (this.Intersect(s)) return 0;
        return Math.Min(Math.Min(GetD_SP(s.p1), GetD_SP(s.p2)), Math.Min(s.GetD_SP(p1), s.GetD_SP(p2)));
    }
    public Point GetCrossPoint(Segment s)
    {
        Point b = s.p2 - s.p1;
        double d1 = Math.Abs(b.Cross(p1 - s.p1));
        double d2 = Math.Abs(b.Cross(p2 - s.p1));
        double t = d1 / (d1 + d2);
        return p1 + (p2 - p1) * t;
    }
}
struct Circle
{
    internal Point c; internal double r;
    public Circle(Point c, double r)
    {
        this.c = c;
        this.r = r;
    }
    public bool Intersect(Segment l)
    {
        return l.GetD_LP(c) <= r;
    }
    public P_Pair GetCrossPoints(Segment l)
    {
        Point pr = l.Projection(c);
        Point e = (l.p2 - l.p1) / (l.p2 - l.p1).Abs;
        double b = Math.Sqrt(r * r - (pr - c).Norm);
        return new P_Pair(pr + e * b, pr - e * b);
    }
    public P_Pair GetCrossPoints(Circle c2)
    {
        double d = (c - c2.c).Abs;
        double a = Math.Acos((r * r + d * d - c2.r * c2.r) / (2 * r * d));
        double t = (c2.c - c).Arg;
        Point p1 = c + new Point(Math.Cos(t + a) * r, Math.Sin(t + a) * r);
        Point p2 = c + new Point(Math.Cos(t - a) * r, Math.Sin(t - a) * r);
        return new P_Pair(p1, p2);
    }
}
class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return Console.ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}