DZY loves colors, and he enjoys painting.

On a colorful day, DZY gets a colorful ribbon, which consists of n units (they are numbered from 1 to n from left to right). The color of the i-th unit of the ribbon is i at first. It is colorful enough, but we still consider that the colorfulness of each unit is 0 at first.

DZY loves painting, we know. He takes up a paintbrush with color x and uses it to draw a line on the ribbon. In such a case some contiguous units are painted. Imagine that the color of unit i currently is y. When it is painted by this paintbrush, the color of the unit becomes x, and the colorfulness of the unit increases by |x - y|.

DZY wants to perform m operations, each operation can be one of the following:

  1. Paint all the units with numbers between l and r (both inclusive) with color x. 
  2. Ask the sum of colorfulness of the units between l and r (both inclusive). 



Can you help DZY?

Input

The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105).

Each of the next m lines begins with a integer type (1 ≤ type ≤ 2), which represents the type of this operation.

If type = 1, there will be 3 more integers l, r, x (1 ≤ l ≤ r ≤ n; 1 ≤ x ≤ 108) in this line, describing an operation 1.

If type = 2, there will be 2 more integers l, r (1 ≤ l ≤ r ≤ n) in this line, describing an operation 2.

Output

For each operation 2, print a line containing the answer — sum of colorfulness.

Examples

Input

3 3
1 1 2 4
1 2 3 5
2 1 3


Output

8


Input

3 4
1 1 3 4
2 1 1
2 2 2
2 3 3


Output

3
2
1


Input

10 6
1 1 5 3
1 2 7 9
1 10 10 11
1 3 8 12
1 1 10 3
2 1 10


Output

129

Note

In the first sample, the color of each unit is initially [1, 2, 3], and the colorfulness is [0, 0, 0].

After the first operation, colors become [4, 4, 3], colorfulness become [3, 2, 0].

After the second operation, colors become [4, 5, 5], colorfulness become [3, 3, 2].

So the answer to the only operation of type 2 is 8.
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.util.NavigableMap;
import java.io.UncheckedIOException;
import java.util.TreeMap;
import java.io.Closeable;
import java.util.Map;
import java.io.Writer;
import java.util.Map.Entry;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 29);
        thread.start();
        thread.join();
    }

    static class TaskAdapter implements Runnable {
        @Override
        public void run() {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            FastInput in = new FastInput(inputStream);
            FastOutput out = new FastOutput(outputStream);
            CDZYLovesColors solver = new CDZYLovesColors();
            solver.solve(1, in, out);
            out.close();
        }
    }

    static class CDZYLovesColors {
        private void split(TreeMap<Integer, Interval> map, int pt) {
            Interval floor = CollectionUtils.floorValue(map, pt);
            if (floor != null && floor.r >= pt && floor.l < pt) {
                Interval clone = floor.clone();
                clone.l = pt;
                floor.r = pt - 1;
                map.put(clone.l, clone);
            }
        }

        public void solve(int testNumber, FastInput in, FastOutput out) {
            int n = in.ri();
            int m = in.ri();
            LongBITExt bit = new LongBITExt(n);
            TreeMap<Integer, Interval> map = new TreeMap<>();
            for (int i = 1; i <= n; i++) {
                map.put(i, new Interval(i, i, i));
            }
            for (int i = 0; i < m; i++) {
                int t = in.ri();
                int l = in.ri();
                int r = in.ri();
                if (t == 1) {
                    int x = in.ri();
                    split(map, l);
                    split(map, r + 1);
                    Interval newInterval = new Interval(l, r, x);
                    while (true) {
                        Interval ceil = CollectionUtils.ceilValue(map, l);
                        if (ceil == null || ceil.l > r) {
                            break;
                        }
                        map.remove(ceil.l);
                        int delta = Math.abs(x - ceil.x);
                        bit.update(ceil.l, ceil.r, delta);
                    }
                    map.put(newInterval.l, newInterval);
                } else {
                    long ans = bit.query(l, r);
                    out.println(ans);
                }
            }
        }

    }

    static class FastOutput implements AutoCloseable, Closeable, Appendable {
        private static final int THRESHOLD = 32 << 10;
        private final Writer os;
        private StringBuilder cache = new StringBuilder(THRESHOLD * 2);

        public FastOutput append(CharSequence csq) {
            cache.append(csq);
            return this;
        }

        public FastOutput append(CharSequence csq, int start, int end) {
            cache.append(csq, start, end);
            return this;
        }

        private void afterWrite() {
            if (cache.length() < THRESHOLD) {
                return;
            }
            flush();
        }

        public FastOutput(Writer os) {
            this.os = os;
        }

        public FastOutput(OutputStream os) {
            this(new OutputStreamWriter(os));
        }

        public FastOutput append(char c) {
            cache.append(c);
            afterWrite();
            return this;
        }

        public FastOutput append(long c) {
            cache.append(c);
            afterWrite();
            return this;
        }

        public FastOutput println(long c) {
            return append(c).println();
        }

        public FastOutput println() {
            return append('\n');
        }

        public FastOutput flush() {
            try {
//            boolean success = false;
//            if (stringBuilderValueField != null) {
//                try {
//                    char[] value = (char[]) stringBuilderValueField.get(cache);
//                    os.write(value, 0, cache.length());
//                    success = true;
//                } catch (Exception e) {
//                }
//            }
//            if (!success) {
                os.append(cache);
//            }
                os.flush();
                cache.setLength(0);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
            return this;
        }

        public void close() {
            flush();
            try {
                os.close();
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        public String toString() {
            return cache.toString();
        }

    }

    static class CollectionUtils {
        public static <K, V> V floorValue(NavigableMap<K, V> map, K key) {
            Map.Entry<K, V> entry = map.floorEntry(key);
            return entry == null ? null : entry.getValue();
        }

        public static <K, V> V ceilValue(NavigableMap<K, V> map, K key) {
            Map.Entry<K, V> entry = map.ceilingEntry(key);
            return entry == null ? null : entry.getValue();
        }

    }

    static class LongBITExt {
        long[] delta;
        long[] idelta;
        int n;

        public LongBITExt(int n) {
            this.n = n;
            delta = new long[n + 1];
            idelta = new long[n + 1];
        }

        private void update(int i, long x) {
            long x1 = x;
            long x2 = x * i;
            for (; i <= n; i += i & -i) {
                delta[i] += x1;
                idelta[i] += x2;
            }
        }

        public void update(int l, int r, long x) {
            update(l, x);
            update(r + 1, -x);
        }

        public long query(int x) {
            long ans1 = 0;
            long ans2 = 0;
            for (int i = x; i > 0; i -= (i & -i)) {
                ans1 += delta[i];
                ans2 += idelta[i];
            }
            return (x + 1) * ans1 - ans2;
        }

        public long query(int l, int r) {
            return query(r) - query(l - 1);
        }

        public String toString() {
            StringBuilder ans = new StringBuilder("[");
            for (int i = 1; i <= n; i++) {
                ans.append(query(i, i)).append(',');
            }
            if (ans.length() > 1) {
                ans.setLength(ans.length() - 1);
            }
            ans.append("]");
            return ans.toString();
        }

    }

    static abstract class CloneSupportObject<T> implements Cloneable {
        public T clone() {
            try {
                return (T) super.clone();
            } catch (CloneNotSupportedException e) {
                throw new RuntimeException(e);
            }
        }

    }

    static class Interval extends CloneSupportObject<Interval> {
        int l;
        int r;
        int x;

        public Interval(int l, int r, int x) {
            this.l = l;
            this.r = r;
            this.x = x;
        }

    }

    static class FastInput {
        private final InputStream is;
        private byte[] buf = new byte[1 << 13];
        private int bufLen;
        private int bufOffset;
        private int next;

        public FastInput(InputStream is) {
            this.is = is;
        }

        private int read() {
            while (bufLen == bufOffset) {
                bufOffset = 0;
                try {
                    bufLen = is.read(buf);
                } catch (IOException e) {
                    bufLen = -1;
                }
                if (bufLen == -1) {
                    return -1;
                }
            }
            return buf[bufOffset++];
        }

        public void skipBlank() {
            while (next >= 0 && next <= 32) {
                next = read();
            }
        }

        public int ri() {
            return readInt();
        }

        public int readInt() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            int val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

    }
}

