import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.io.*;
import java.math.*;
public class Main7{
	static public void main(String args[])throws IOException{
		int tt=1;
		StringBuilder sb=new StringBuilder();
		for(int ttt=1;ttt<=tt;ttt++){
			int n=i();
			int[][] a=new int[n+3][n+3];
			int tot=7+(n-1)*3;
			sb.append(tot+"\n");
			for(int i=0;i<n+1;i++){
				sb.append("0 "+i+"\n");
			}
			for(int i=0;i<n+2;i++){
				sb.append("1 "+i+"\n");
			}
			for(int i=1;i<n+2;i++){
				sb.append("2 "+i+"\n");
			}
		}
		System.out.print(sb.toString());
	}
	static InputReader in=new InputReader(System.in);
	static OutputWriter out=new OutputWriter(System.out);
	static ArrayList<ArrayList<Integer>> graph;
	static int mod=1000000007;
	static class Pair{
		int x;
		int y;
		Pair(int x,int y){
			this.x=x;
			this.y=y;
		}
		/*@Override
		public int hashCode()
		{
			final int temp = 14;
			int ans = 1;
			ans =x*31+y*13;
			return (int)ans;
		}
       @Override
        public boolean equals(Object o)
        {
            if (this == o) {
                return true;
            }
            if (o == null) {
                return false;
            }
            if (this.getClass() != o.getClass()) {
                return false;
            }
            Pair other = (Pair)o;
            if (this.x != other.x || this.y!=other.y) {
                return false;
            }
            return true;
        }*/
	}
	public static int[] sort(int[] a){
		int n=a.length;
		ArrayList<Integer> ar=new ArrayList<>();
		for(int i=0;i<a.length;i++){
			ar.add(a[i]);
		}
		Collections.sort(ar);
		for(int i=0;i<n;i++){
			a[i]=ar.get(i);
		}
		return a;
	}
	public static long pow(long a, long b){
        long result=1;
        while(b>0){
            if (b % 2 != 0){
                result=(result*a);
                b--;
            }
            a=(a*a);
            b /= 2;
        }
        return result;
    }
	public static long gcd(long a, long b){
        if (a == 0){
            return b;
		}
        return gcd(b%a, a);
    }
	public static long lcm(long a, long b){
		return a*(b/gcd(a,b));
	}
	public static long l(){
		String s=in.String();
		return Long.parseLong(s);
	}
	public static void pln(String value){
		System.out.println(value);
	}
	public static int i(){
		return in.Int();
	}
	public static String s(){
		return in.String();
	}
}
class InputReader
{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;
	public InputReader(InputStream stream) {
		this.stream = stream;
	}
	public int read() {
		if (numChars== -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}
	public int Int() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	public String String() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
	public String next() {
		return String();
	}
	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}
class OutputWriter {
	private final PrintWriter writer;
	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}
	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}
	public void print(Object...objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}
	public void printLine(Object...objects) {
		print(objects);
		writer.println();
	}
	public void close() {
		writer.close();
	}
	public void flush() {
		writer.flush();
	}
 }
class IOUtils {
	public static int[] readIntArray(InputReader in, int size) {
		int[] array = new int[size];
		for (int i = 0; i < size; i++)
			array[i] = in.Int();
		return array;
	}
}


import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.io.*;
import java.math.*;
public class Main7{
	static public void main(String args[])throws IOException{
		int tt=1;
		StringBuilder sb1=new StringBuilder();
		for(int ttt=1;ttt<=tt;ttt++){
			int n=i();
			StringBuilder sb=new StringBuilder();
			if(n==1){
				sb.append("7\n");
				sb.append("0 0\n");
				sb.append("0 1\n");
				sb.append("1 1\n");
				sb.append("1 2\n");
				sb.append("2 1\n");
				sb.append("2 2\n");
				sb.append("1 0\n");
				sb1.append(sb.toString());
			}else{
				int ans=0;
				for(int i=0;i<n*2+1;i++){
					sb.append("1 "+i+"\n");
					ans++;
				}
				for(int i=1;i<n*2+1;i+=2){
					sb.append("0 "+i+"\n");
					ans++;
				}
				for(int i=1;i<n*2+1;i+=2){
					sb.append("2 "+i+"\n");
					ans++;
				}
				if(n%2==0){
					for(int i=1;i<2*n+1;i+=4){
						sb.append("-1 "+(i)+"\n");
						sb.append("-1 "+(i+1)+"\n");
						sb.append("-1 "+(i+2)+"\n");
						sb.append("3 "+(i)+"\n");
						sb.append("3 "+(i+1)+"\n");
						sb.append("3 "+(i+2)+"\n");
						ans+=6;
					}
					sb.append("1 -1\n");
					sb.append("1 "+(2*n+1)+"\n");
					ans+=2;
					for(int i=0;i<4;i++){
						sb.append((i+2)+" -1\n");
						sb.append((i+2)+" "+(2*n+1)+"\n");
						ans+=2;
					}
					for(int i=0;i<2*n+1;i++){
						sb.append("5 "+i+"\n");
						ans++;
					}
				}else{
					for(int i=1;i<2*n+1;i+=4){
						if(i+4>=2*n+1){
							break;
						}
						sb.append("-1 "+(i)+"\n");
						sb.append("-1 "+(i+1)+"\n");
						sb.append("-1 "+(i+2)+"\n");
						sb.append("3 "+(i)+"\n");
						sb.append("3 "+(i+1)+"\n");
						sb.append("3 "+(i+2)+"\n");
						ans+=6;
					}
					sb.append("1 -1\n");
					sb.append("1 "+(2*n+1)+"\n");
					sb.append("0 "+(2*n+1)+"\n");
					sb.append("-1 "+(2*n+1)+"\n");
					sb.append("-1 "+(2*n)+"\n");
					sb.append("-1 "+(2*n-1)+"\n");
					sb.append("3 "+(2*n-1)+"\n");
					sb.append("4 "+(2*n-1)+"\n");
					ans+=8;
					for(int i=0;i<3;i++){
						ans++;
						sb.append((i+2)+" -1"+"\n");
					}
					for(int i=-1;i<=2*n-1;i++){
						sb.append("5 "+i+"\n");
						ans++;
					}
				}
				sb1.append(ans+"\n");
				sb1.append(sb.toString());
			}
		}
		System.out.print(sb1.toString());
	}
	static InputReader in=new InputReader(System.in);
	static OutputWriter out=new OutputWriter(System.out);
	static ArrayList<ArrayList<Integer>> graph;
	static int mod=1000000007;
	static class Pair{
		int x;
		int y;
		Pair(int x,int y){
			this.x=x;
			this.y=y;
		}
		/*@Override
		public int hashCode()
		{
			final int temp = 14;
			int ans = 1;
			ans =x*31+y*13;
			return (int)ans;
		}
       @Override
        public boolean equals(Object o)
        {
            if (this == o) {
                return true;
            }
            if (o == null) {
                return false;
            }
            if (this.getClass() != o.getClass()) {
                return false;
            }
            Pair other = (Pair)o;
            if (this.x != other.x || this.y!=other.y) {
                return false;
            }
            return true;
        }*/
	}
	public static int[] sort(int[] a){
		int n=a.length;
		ArrayList<Integer> ar=new ArrayList<>();
		for(int i=0;i<a.length;i++){
			ar.add(a[i]);
		}
		Collections.sort(ar);
		for(int i=0;i<n;i++){
			a[i]=ar.get(i);
		}
		return a;
	}
	public static long pow(long a, long b){
        long result=1;
        while(b>0){
            if (b % 2 != 0){
                result=(result*a);
                b--;
            }
            a=(a*a);
            b /= 2;
        }
        return result;
    }
	public static long gcd(long a, long b){
        if (a == 0){
            return b;
		}
        return gcd(b%a, a);
    }
	public static long lcm(long a, long b){
		return a*(b/gcd(a,b));
	}
	public static long l(){
		String s=in.String();
		return Long.parseLong(s);
	}
	public static void pln(String value){
		System.out.println(value);
	}
	public static int i(){
		return in.Int();
	}
	public static String s(){
		return in.String();
	}
}
class InputReader
{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;
	public InputReader(InputStream stream) {
		this.stream = stream;
	}
	public int read() {
		if (numChars== -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}
	public int Int() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	public String String() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
	public String next() {
		return String();
	}
	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}
class OutputWriter {
	private final PrintWriter writer;
	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}
	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}
	public void print(Object...objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}
	public void printLine(Object...objects) {
		print(objects);
		writer.println();
	}
	public void close() {
		writer.close();
	}
	public void flush() {
		writer.flush();
	}
 }
class IOUtils {
	public static int[] readIntArray(InputReader in, int size) {
		int[] array = new int[size];
		for (int i = 0; i < size; i++)
			array[i] = in.Int();
		return array;
	}
}


import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.io.*;
import java.math.*;
public class Main7{
	static public void main(String args[])throws IOException{
		int tt=1;
		StringBuilder sb1=new StringBuilder();
		for(int ttt=1;ttt<=tt;ttt++){
			int n=i();
			StringBuilder sb=new StringBuilder();
			if(n==1){
				sb.append("7\n");
				sb.append("0 0\n");
				sb.append("0 1\n");
				sb.append("1 1\n");
				sb.append("1 2\n");
				sb.append("2 1\n");
				sb.append("2 2\n");
				sb.append("1 0\n");
				sb1.append(sb.toString());
			}else{
				int ans=0;
				for(int i=0;i<n;i++){
					sb.append("0 "+i+"\n");
					sb.append("1 "+i+"\n");
					sb.append("2 "+i+"\n");
					ans+=3;
				}
				sb.append("1 "+n+"\n");
				sb.append("1 "+(n+1)+"\n");
				sb.append("1 -1\n");
				sb.append("1 -2\n");
				ans+=4;
				for(int i=-2;i<=n+1;i++){
					sb.append("4 "+i+"\n");
					ans++;
				}
				sb.append("2 -2\n");
				sb.append("3 -2\n");
				sb.append("2 "+(n+1)+"\n");
				sb.append("3 "+(n+1)+"\n");
				ans+=4;
				sb1.append(ans+"\n");
				sb1.append(sb.toString());
			}
		}
		System.out.print(sb1.toString());
	}
	static InputReader in=new InputReader(System.in);
	static OutputWriter out=new OutputWriter(System.out);
	static ArrayList<ArrayList<Integer>> graph;
	static int mod=1000000007;
	static class Pair{
		int x;
		int y;
		Pair(int x,int y){
			this.x=x;
			this.y=y;
		}
		/*@Override
		public int hashCode()
		{
			final int temp = 14;
			int ans = 1;
			ans =x*31+y*13;
			return (int)ans;
		}
       @Override
        public boolean equals(Object o)
        {
            if (this == o) {
                return true;
            }
            if (o == null) {
                return false;
            }
            if (this.getClass() != o.getClass()) {
                return false;
            }
            Pair other = (Pair)o;
            if (this.x != other.x || this.y!=other.y) {
                return false;
            }
            return true;
        }*/
	}
	public static int[] sort(int[] a){
		int n=a.length;
		ArrayList<Integer> ar=new ArrayList<>();
		for(int i=0;i<a.length;i++){
			ar.add(a[i]);
		}
		Collections.sort(ar);
		for(int i=0;i<n;i++){
			a[i]=ar.get(i);
		}
		return a;
	}
	public static long pow(long a, long b){
        long result=1;
        while(b>0){
            if (b % 2 != 0){
                result=(result*a);
                b--;
            }
            a=(a*a);
            b /= 2;
        }
        return result;
    }
	public static long gcd(long a, long b){
        if (a == 0){
            return b;
		}
        return gcd(b%a, a);
    }
	public static long lcm(long a, long b){
		return a*(b/gcd(a,b));
	}
	public static long l(){
		String s=in.String();
		return Long.parseLong(s);
	}
	public static void pln(String value){
		System.out.println(value);
	}
	public static int i(){
		return in.Int();
	}
	public static String s(){
		return in.String();
	}
}
class InputReader
{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;
	public InputReader(InputStream stream) {
		this.stream = stream;
	}
	public int read() {
		if (numChars== -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}
	public int Int() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	public String String() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
	public String next() {
		return String();
	}
	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}
class OutputWriter {
	private final PrintWriter writer;
	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}
	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}
	public void print(Object...objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}
	public void printLine(Object...objects) {
		print(objects);
		writer.println();
	}
	public void close() {
		writer.close();
	}
	public void flush() {
		writer.flush();
	}
 }
class IOUtils {
	public static int[] readIntArray(InputReader in, int size) {
		int[] array = new int[size];
		for (int i = 0; i < size; i++)
			array[i] = in.Int();
		return array;
	}
}


import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.io.*;
import java.math.*;
public class Main7{
	static public void main(String args[])throws IOException{
		int tt=1;
		StringBuilder sb1=new StringBuilder();
		for(int ttt=1;ttt<=tt;ttt++){
			int n=i();
			StringBuilder sb=new StringBuilder();
			if(n==1){
				sb.append("7\n");
				sb.append("0 0\n");
				sb.append("0 1\n");
				sb.append("1 1\n");
				sb.append("1 2\n");
				sb.append("2 1\n");
				sb.append("2 2\n");
				sb.append("1 0\n");
				sb1.append(sb.toString());
			}else{
				int ans=0;
				for(int i=0;i<n*2+1;i++){
					sb.append("1 "+i+"\n");
					ans++;
				}
				for(int i=1;i<n*2+1;i+=2){
					sb.append("0 "+i+"\n");
					ans++;
				}
				for(int i=1;i<n*2+1;i+=2){
					sb.append("2 "+i+"\n");
					ans++;
				}
				if(n%2==0){
					for(int i=1;i<2*n+1;i+=4){
						sb.append("-1 "+(i)+"\n");
						sb.append("-1 "+(i+1)+"\n");
						sb.append("-1 "+(i+2)+"\n");
						sb.append("3 "+(i)+"\n");
						sb.append("3 "+(i+1)+"\n");
						sb.append("3 "+(i+2)+"\n");
						ans+=6;
					}
					sb.append("1 -1\n");
					sb.append("1 "+(2*n+1)+"\n");
					ans+=2;
					for(int i=0;i<4;i++){
						sb.append((i+2)+" -1\n");
						sb.append((i+2)+" "+(2*n+1)+"\n");
						ans+=2;
					}
					for(int i=-1;i<=2*n+1;i++){
						sb.append("5 "+i+"\n");
						ans++;
					}
				}else{
					for(int i=1;i<2*n+1;i+=4){
						if(i+4>=2*n+1){
							break;
						}
						sb.append("-1 "+(i)+"\n");
						sb.append("-1 "+(i+1)+"\n");
						sb.append("-1 "+(i+2)+"\n");
						sb.append("3 "+(i)+"\n");
						sb.append("3 "+(i+1)+"\n");
						sb.append("3 "+(i+2)+"\n");
						ans+=6;
					}
					sb.append("1 -1\n");
					sb.append("1 "+(2*n+1)+"\n");
					sb.append("0 "+(2*n+1)+"\n");
					sb.append("-1 "+(2*n+1)+"\n");
					sb.append("-1 "+(2*n)+"\n");
					sb.append("-1 "+(2*n-1)+"\n");
					sb.append("3 "+(2*n-1)+"\n");
					sb.append("4 "+(2*n-1)+"\n");
					ans+=8;
					for(int i=0;i<3;i++){
						ans++;
						sb.append((i+2)+" -1"+"\n");
					}
					for(int i=-1;i<=2*n-1;i++){
						sb.append("5 "+i+"\n");
						ans++;
					}
				}
				sb1.append(ans+"\n");
				sb1.append(sb.toString());
			}
		}
		System.out.print(sb1.toString());
	}
	static InputReader in=new InputReader(System.in);
	static OutputWriter out=new OutputWriter(System.out);
	static ArrayList<ArrayList<Integer>> graph;
	static int mod=1000000007;
	static class Pair{
		int x;
		int y;
		Pair(int x,int y){
			this.x=x;
			this.y=y;
		}
		/*@Override
		public int hashCode()
		{
			final int temp = 14;
			int ans = 1;
			ans =x*31+y*13;
			return (int)ans;
		}
       @Override
        public boolean equals(Object o)
        {
            if (this == o) {
                return true;
            }
            if (o == null) {
                return false;
            }
            if (this.getClass() != o.getClass()) {
                return false;
            }
            Pair other = (Pair)o;
            if (this.x != other.x || this.y!=other.y) {
                return false;
            }
            return true;
        }*/
	}
	public static int[] sort(int[] a){
		int n=a.length;
		ArrayList<Integer> ar=new ArrayList<>();
		for(int i=0;i<a.length;i++){
			ar.add(a[i]);
		}
		Collections.sort(ar);
		for(int i=0;i<n;i++){
			a[i]=ar.get(i);
		}
		return a;
	}
	public static long pow(long a, long b){
        long result=1;
        while(b>0){
            if (b % 2 != 0){
                result=(result*a);
                b--;
            }
            a=(a*a);
            b /= 2;
        }
        return result;
    }
	public static long gcd(long a, long b){
        if (a == 0){
            return b;
		}
        return gcd(b%a, a);
    }
	public static long lcm(long a, long b){
		return a*(b/gcd(a,b));
	}
	public static long l(){
		String s=in.String();
		return Long.parseLong(s);
	}
	public static void pln(String value){
		System.out.println(value);
	}
	public static int i(){
		return in.Int();
	}
	public static String s(){
		return in.String();
	}
}
class InputReader
{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;
	public InputReader(InputStream stream) {
		this.stream = stream;
	}
	public int read() {
		if (numChars== -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}
	public int Int() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	public String String() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
	public String next() {
		return String();
	}
	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}
class OutputWriter {
	private final PrintWriter writer;
	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}
	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}
	public void print(Object...objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}
	public void printLine(Object...objects) {
		print(objects);
		writer.println();
	}
	public void close() {
		writer.close();
	}
	public void flush() {
		writer.flush();
	}
 }
class IOUtils {
	public static int[] readIntArray(InputReader in, int size) {
		int[] array = new int[size];
		for (int i = 0; i < size; i++)
			array[i] = in.Int();
		return array;
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

/**
 * @project: CodeforcesGlobal8
 * @author: izhanatuly
 * @date: 18/06/2020
 */
public class C {
    static Scanner scanner;

    public static void main(String[] args) {
        scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
            runTestCase();
    }

    public static void runTestCase() {
        int n = scanner.nextInt();
        List<int[]> points = new ArrayList<>();
        points.add(new int[]{0, 0});
        points.add(new int[]{0, 1});
        points.add(new int[]{0+1, 0});
        points.add(new int[]{0+1, 1});
        points.add(new int[]{0+1, 2});
        points.add(new int[]{0+2, 1});
        points.add(new int[]{0+2, 2});
        for(int i=2; i<=n; i++) {
            points.add(new int[]{i, i+1});
            points.add(new int[]{i+1, i});
            points.add(new int[]{i+1, i+1});
        }
        System.out.println(points.size());
        for(int[] point : points) {
            System.out.println(point[0] + " " + point[1]);
        }
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

/**
 * @project: CodeforcesGlobal8
 * @author: izhanatuly
 * @date: 18/06/2020
 */
public class C {
    static Scanner scanner;

    public static void main(String[] args) {
        scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
            runTestCase();
    }

    public static void runTestCase() {
        int n = scanner.nextInt();
        List<int[]> points = new ArrayList<>();
        for(int i=0; i<n; i++) {
            int a = i*4;
            points.add(new int[]{a, -1});
            points.add(new int[]{a, 0});
            points.add(new int[]{a+1, -1});
            points.add(new int[]{a+1, 0});
            points.add(new int[]{a+1, 1});
            points.add(new int[]{a+2, 0});
            points.add(new int[]{a+2, 1});
        }
        System.out.println(points.size());
        for(int[] point : points) {
            System.out.println(point[0] + " " + point[1]);
        }
    }
}


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize ("unroll-loops")

#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define isz(x) (int)(x).size()
#define reunique(x) (x).erase(std::unique(all(x)), (x).end())
#define lowpos(x, y) int(std::lower_bound(all(x), (y)) - (x).begin())
#define watch(x) std::cerr << std::setw(12) << #x << " = " << std::setw(12) << x
#define watchln(x) watch(x) << std::endl
#define cerr cerr && debug && std::cerr

namespace FastIO {
    struct Reader {
        private:
            FILE* file; std::vector<char> buffer; int pos;
            void read();
            bool was;
        public:
            Reader(FILE* file_ = stdin, const int size_ = 1 << 16)
                : file(file_), buffer(size_, '\0'), pos(size_), was(true) { }
            operator bool() const { return was; }
            char getChar();
            std::string getStr();
            std::string getLine();
            template<typename T> T getInt();
            template<typename T> T getReal();
    };

    Reader& operator>>(Reader& reader, char& c) { return c = reader.getChar(), reader; }

    Reader& operator>>(Reader& reader, std::string& s) { return s = reader.getStr(), reader; }

    template<class T> typename std::enable_if<std::is_floating_point<T>::value, Reader&>::type
    operator>>(Reader& reader, T& t) { return t = reader.getReal<T>(), reader; }

    template<class T> typename std::enable_if<std::is_integral<T>::value, Reader&>::type
    operator>>(Reader& reader, T& t) { return t = reader.getInt<T>(), reader; }

    template<class T> Reader& operator>>(Reader& reader, std::vector<T>& vec) {
        for (auto &it : vec) { reader >> it; }
        return reader;
    }

    struct Writer {
        private:
            FILE* file; std::vector<char> buffer; int pos;
            int defaultPrecision, defaultWidth; char defaultFill;
        public:
            Writer(FILE* file_ = stdout, const int size_ = 1 << 16)
                : file(file_), buffer(size_, '\0'), pos(0), defaultPrecision(6), defaultWidth(0), defaultFill(' ') { }
            ~Writer() { flush(); }
            void flush() { putChar(EOF); }
            void setprecision(int precision) { defaultPrecision = precision; }
            void setw(int width) { defaultWidth = width; }
            void setfill(char fill) { defaultFill = fill; }
            int getPrecision() const { return defaultPrecision; }
            int getWidth() const { return defaultWidth; }
            char getFill() const { return defaultFill; }
            void putChar(char c);
            void putStr(const std::string&);
            template<typename T> void putInt(T value, int width = 0, char fill = ' ');
            template<typename T> void putReal(T value, int precision = 6, int width = 0, char fill = ' ');
    };

    Writer& operator<<(Writer& writer, const char c) { return writer.putChar(c), writer; }

    Writer& operator<<(Writer& writer, const std::string& s) { return writer.putStr(s), writer; }

    template<class T> typename std::enable_if<std::is_floating_point<T>::value, Writer&>::type
    operator<<(Writer& writer, const T& t) {
        writer.putReal(t, writer.getPrecision(), writer.getWidth(), writer.getFill());
        return writer;
    }

    template<class T> typename std::enable_if<std::is_integral<T>::value, Writer&>::type
    operator<<(Writer& writer, const T& t) {
        writer.putInt(t, writer.getWidth(), writer.getFill());
        return writer;
    }
}

typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<vi> vvi;
typedef std::vector<std::string> vs;
typedef std::vector<ll> vl;
typedef std::vector<vl> vvl;

bool debug = 0;

int main() {
    FastIO::Reader cin;
    FastIO::Writer cout;

    alignas(32) int arr[100001];
    int n = 100000, q = 100000;
    cin >> n >> q;
    for (int i = 0, x = 1; i < n; ++i) { cin >> x; arr[i] = int(x); }
    char oper[100001];
    int what[100001];
    std::string s;
    for (int i = q-1; i >= 0; --i) {
        cin >> s >> what[i];
        oper[i] = s[0];
    }
    const int gsize = 1024;
    int last = 0;
    for (int g = 0; g + gsize <= n; g += gsize) {
        for (int id = q-1; id >= 0; --id) {
            const char op = oper[id];
            const int x = what[id];
            if (op == '>') {
                for (int i = g; i < g + gsize; ++i) {
                    arr[i] = arr[i] > x ? -arr[i] : arr[i];
                }
            } else {
                for (int i = g; i < g + gsize; ++i) {
                    arr[i] = arr[i] < x ? -arr[i] : arr[i];
                }
            }
        }
        last = g + gsize;
    }
    for (int id = q-1; id >= 0; --id) {
        const char op = oper[id];
        const int x = what[id];
        if (op == '>') {
            for (int i = last; i < n; ++i) {
                arr[i] = arr[i] > x ? -arr[i] : arr[i];
            }
        } else {
            for (int i = last; i < n; ++i) {
                arr[i] = arr[i] < x ? -arr[i] : arr[i];
            }
        }
    }
    for (int i = 0; i < n; ++i) { cout << int(arr[i]) << ' '; }
    cout << "\n";
    return 0;
}

namespace FastIO {

    void Reader::read() {
        if (!buffer.empty()) {
            buffer.resize(fread(&buffer[0], 1, (int)buffer.size(), file)); pos = 0;
        }
    }

    char Reader::getChar() {
        if (pos == (int)buffer.size()) { read(); }
        if (pos == (int)buffer.size()) { was = false; return EOF; }
        else { was = true; return buffer[pos++]; }
    }

    std::string Reader::getStr() {
        char c = ' ';
        while (std::isspace(c)) { c = getChar(); }
        std::string answ;
        while (c != EOF && !std::isspace(c)) { answ.push_back(c); c = getChar(); }
        was = !answ.empty();
        return answ;
    }

    std::string Reader::getLine() {
        char c = '\n';
        while (c == '\n') { c = getChar(); }
        std::string answ;
        while (c != '\n' && c != EOF) { answ.push_back(c); c = getChar(); }
        was = !answ.empty();
        return answ;
    }

    template<typename T>
    T Reader::getInt() {
        char c = '?';
        while (!(c == '-' || ('0' <= c && c <= '9') || c == EOF)) { c = getChar(); }
        bool positive = true;
        if (c == '-') { positive = false; c = getChar(); }
        T answ(0);
        bool flag = false;
        while ('0' <= c && c <= '9') { flag = true; (answ *= 10) += (c - '0'); c = getChar(); }
        was = flag;
        return positive ? answ : -answ;
    }

    template<typename T>
    T Reader::getReal() {
        bool flag = false;
        char c = '?';
        while (!(c == '-' || ('0' <= c && c <= '9') || c == EOF)) { c = getChar(); }
        bool positive = (c != '-');
        if (c == '-') { c = getChar(); }
        long long first = 0;
        while ('0' <= c && c <= '9') { flag = true; (first *= 10) += (c - '0'); c = getChar(); }
        was = flag;
        if (c != '.') { return T(positive ? first : -first); }
        c = getChar();
        long long second = 0, pow = 1;
        while ('0' <= c && c <= '9') { (second *= 10) += (c - '0'); c = getChar(); pow *= 10; }
        T answ = first + (T)second / (T)pow;
        return positive ? answ : -answ;
    }

    void Writer::putChar(char c) {
        if (pos == (int)buffer.size() || c == EOF) {
            fwrite(&buffer[0], 1, pos, file); pos = 0;
        }
        if (c != EOF) { buffer[pos++] = c; }
    }

    void Writer::putStr(const std::string& s) {
        for (auto it : s) {
            putChar(it);
        }
    }

    template<typename T>
    void Writer::putInt(T value, int width, char fill) {
        bool positive = !(value < 0);
        if (value < 0) { value = -value; }
        char buf[24]; int p = 0;
        do { buf[p++] = char(value % 10 + '0'); value /= 10; } while (value > 0);
        if (!positive) { buf[p++] = '-'; }
        while (p < width) buf[p++] = fill;
        while (p > 0) putChar(buf[--p]);
    }

    template<typename T>
    void Writer::putReal(T value, int precision, int width, char fill) {
        putInt((long long)value, width - precision - 1, fill);
        value = std::abs(value-(long long)value);
        if (precision == 0) { return; }
        putChar('.');
        #define PRINT_PART(cnt, pow) \
            while (precision >= cnt) { \
                value *= pow; \
                putInt((int)value, cnt, '0'); \
                value -= (int)value; \
                precision -= cnt; \
            }
        PRINT_PART(6,1000000)
        PRINT_PART(3,1000)
        PRINT_PART(1,10)
        #undef PRINT_PART
    }
}


#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define infL (1LL<<60)
#define inf (1<<30)
#define inf9 (1000000000)
#define MOD  998244353//1000000007
#define EPS 1e-9
#define Gr 9.8
#define PI acos(-1)
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REQ(i,n) for(int (i)=1;(i)<=(int)(n);(i)++)
#define lch (rt<<1)
#define rch (rt<<1|1)
#define readmp(n) for(int i=0,u,v;i<n;i++) {scanf("%d%d",&u,&v); mp[u].push_back(v); mp[v].push_back(u);}
typedef  long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef ll ValType;
template<typename  T> void maxtt(T& t1, T t2) {
    t1=max(t1,t2);
}
template<typename  T> void mintt(T& t1, T t2) {
    t1=min(t1,t2);
}
#define MAX 200135

bool debug = 0;
int n,m,k;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
string direc="URDL";//"RDLU";
ll ln, lk, lm;
void etp(bool f = 0) {
    puts(f ?"YES" : "NO");
    exit(0);
}
void addmod(int &x, int y, int mod = MOD) {
    assert(y>=0);
    x+=y; if (x>=mod) x-=mod;
    assert(x>=0 && x<mod);
}
void et(int x=-1) {
    printf("%d\n", x); exit(0);
}
ll fastPow(ll x, ll y, int mod=MOD) {
    ll ans = 1;
    while(y>0) {
        if(y&1) ans = (x * ans)%mod;
        x = x*x%mod;
        y>>=1;
    }
    return ans;
}
ll gcd1(ll x, ll y) {
    return y?gcd1(y,x%y):x;
}

int N=100000 + 1;
int T[MAX*4], lz[MAX*4];
int a[MAX];
void Up(int rt, int l, int r){
    T[rt]=T[lch]+T[rch];
}
void Down(int rt, int l, int r) {
//    if(l+1==r) return;
    int mid=(l+r)/2;
    if(l+1<r) {
        Down(lch,l,mid);
        Down(rch,mid,r);
    }
    if(lz[rt]!=0) {
        if (lz[rt]==1) {//all 0
            T[lch]=0; T[rch]=0;
        } else if(lz[rt]==2){
            T[lch] = mid-l; T[rch]=r-mid;
        } else {
            T[lch] = mid-l - T[lch]; T[rch]=r-mid - T[rch];
        }
        lz[lch]=lz[rt]; lz[rch]=lz[rt];
        lz[rt]=0;
    }
}
void upt(int rt, int l, int r, int L, int R, int val) {
    if (R<=l||r<=L) return;
    Down(rt,l,r);
    if (L<=l && r<=R) {
        assert(lz[rt]==0);
        if (val==1) T[rt]=0;
        else if(val==2) T[rt]=r-l;
        else T[rt]=r-l-T[rt];
        lz[rt]=val;
        return;
    }
    int mid = (l+r)/2;
    upt(lch,l,mid,L,R,val);
    upt(rch,mid,r,L,R,val);
    Up(rt,l,r);
}

int Ans[MAX];
void qy(int rt, int l, int r) {
    if (l+1==r) {
        Ans[r]=T[rt];
        return;
    }
    Down(rt,l,r);
    int mid = (l+r)/2;
    qy(lch,l,mid);
    qy(rch,mid,r);
}

void fmain(int tid) {
    scanf("%d%d", &n, &m);
    REQ(i,n) scanf("%d", a+i);
    char ope[3];
    int x;
    int nn = N+N-1;
    REQ(i,m) {
        scanf("%s%d",ope,&x);
        if (x>=0) {
            if(ope[0]=='>') {
                upt(1, 0, nn, N+x, nn, 2);
                upt(1, 0, nn, 0, N-x-1, 1);
            } else {
                upt(1,0,nn,0,N-x,2);
                upt(1,0,nn,N-x,N+x-1,3);
                upt(1,0,nn,N+x-1,nn,1);
            }
        } else {
            x*=-1;
            if(ope[0]=='<') {
                upt(1,0,nn,0,N-x-1,2);
                upt(1,0,nn,N+x,nn,1);
            } else {
                upt(1,0,nn,0,N-x,1);
                upt(1,0,nn,N-x,N+x-1,3);
                upt(1,0,nn,N+x-1,nn,2);
            }
        }

//        qy(1,0,nn);cout<<Ans[N+5]<<endl;
    }
    qy(1,0,nn);
    REQ(i,n) {
        int z=Ans[N+a[i]] == 1 ? -1 : 1;
        printf("%d ",a[i]*z);
    }
}
int main() {
    int t=1;
//    scanf("%d", &t);
    REQ(i,t) {
        fmain(i);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define infL (1LL<<60)
#define inf (1<<30)
#define inf9 (1000000000)
#define MOD  998244353//1000000007
#define EPS 1e-9
#define Gr 9.8
#define PI acos(-1)
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REQ(i,n) for(int (i)=1;(i)<=(int)(n);(i)++)
#define lch (rt<<1)
#define rch (rt<<1|1)
#define readmp(n) for(int i=0,u,v;i<n;i++) {scanf("%d%d",&u,&v); mp[u].push_back(v); mp[v].push_back(u);}
typedef  long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef ll ValType;
template<typename  T> void maxtt(T& t1, T t2) {
    t1=max(t1,t2);
}
template<typename  T> void mintt(T& t1, T t2) {
    t1=min(t1,t2);
}
#define MAX 200135

bool debug = 0;
int n,m,k;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
string direc="URDL";//"RDLU";
ll ln, lk, lm;
void etp(bool f = 0) {
    puts(f ?"YES" : "NO");
    exit(0);
}
void addmod(int &x, int y, int mod = MOD) {
    assert(y>=0);
    x+=y; if (x>=mod) x-=mod;
    assert(x>=0 && x<mod);
}
void et(int x=-1) {
    printf("%d\n", x); exit(0);
}
ll fastPow(ll x, ll y, int mod=MOD) {
    ll ans = 1;
    while(y>0) {
        if(y&1) ans = (x * ans)%mod;
        x = x*x%mod;
        y>>=1;
    }
    return ans;
}
ll gcd1(ll x, ll y) {
    return y?gcd1(y,x%y):x;
}

int N=100000 + 1;
int T[MAX*4], lz[MAX*4];
int a[MAX];
void Up(int rt, int l, int r){
    T[rt]=T[lch]+T[rch];
}
int addp(int a, int b) {
    //1: 1->0, 2:0->1
    if(a==0||b==0) return a^b;
    if(a==1&&b==1) return 1;
    if(a==2&&b==2) return 2;
    if(a==3&&b==3) return 0;
    if(a==1&&b==2) return 2;
    if(a==1&&b==3) return 2;
    if(a==2&&b==1) return 1;
    if(a==2&&b==3) return 1;

    if(a==3&&b==1) return 1;
    if(a==3&&b==2) return 2;
    throw -1;
}
void Down(int rt, int l, int r) {
    if(l+1==r) return;
    int mid=(l+r)/2;
    if(lz[rt]!=0) {
        if (lz[rt]==1) {//all 0
            T[lch]=0; T[rch]=0;
        } else if(lz[rt]==2){
            T[lch] = mid-l; T[rch]=r-mid;
        } else {
            T[lch] = mid-l - T[lch]; T[rch]=r-mid - T[rch];
        }
        lz[lch]=addp(lz[lch], lz[rt]); lz[rch]=addp(lz[rch],lz[rt]);
        lz[rt]=0;
    }
}
void upt(int rt, int l, int r, int L, int R, int val) {
    if (R<=l||r<=L) return;
    Down(rt,l,r);
    if (L<=l && r<=R) {
//        assert(lz[rt]==0);
        if (val==1) T[rt]=0;
        else if(val==2) T[rt]=r-l;
        else T[rt]=r-l-T[rt];
        lz[rt]=addp(lz[rt], val);
        return;
    }
    int mid = (l+r)/2;
    upt(lch,l,mid,L,R,val);
    upt(rch,mid,r,L,R,val);
    Up(rt,l,r);
}

int Ans[MAX];
void qy(int rt, int l, int r) {
    if (l+1==r) {
        Ans[r]=T[rt];
        return;
    }
    Down(rt,l,r);
    int mid = (l+r)/2;
    qy(lch,l,mid);
    qy(rch,mid,r);
}

void fmain(int tid) {
    scanf("%d%d", &n, &m);
    REQ(i,n) scanf("%d", a+i);
    char ope[3];
    int x;
    int nn = N+N-1;
    REQ(i,m) {
        scanf("%s%d",ope,&x);
        if (x>=0) {
            if(ope[0]=='>') {
                upt(1, 0, nn, N+x, nn, 2);
                upt(1, 0, nn, 0, N-x-1, 1);
            } else {
                upt(1,0,nn,0,N-x,2);
                upt(1,0,nn,N-x,N+x-1,3);
                upt(1,0,nn,N+x-1,nn,1);
            }
        } else {
            x*=-1;
            if(ope[0]=='<') {
                upt(1,0,nn,0,N-x-1,2);
                upt(1,0,nn,N+x,nn,1);
            } else {
                upt(1,0,nn,0,N-x,1);
                upt(1,0,nn,N-x,N+x-1,3);
                upt(1,0,nn,N+x-1,nn,2);
            }
        }

//        qy(1,0,nn);cout<<Ans[N+5]<<endl;
    }
    qy(1,0,nn);
    REQ(i,n) {
        int z=Ans[N+a[i]] == 1 ? -1 : 1;
        printf("%d ",a[i]*z);
    }
}
int main() {
    int t=1;
//    scanf("%d", &t);
    REQ(i,t) {
        fmain(i);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define infL (1LL<<60)
#define inf (1<<30)
#define inf9 (1000000000)
#define MOD  998244353//1000000007
#define EPS 1e-9
#define Gr 9.8
#define PI acos(-1)
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REQ(i,n) for(int (i)=1;(i)<=(int)(n);(i)++)
#define lch (rt<<1)
#define rch (rt<<1|1)
#define readmp(n) for(int i=0,u,v;i<n;i++) {scanf("%d%d",&u,&v); mp[u].push_back(v); mp[v].push_back(u);}
typedef  long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef ll ValType;
template<typename  T> void maxtt(T& t1, T t2) {
    t1=max(t1,t2);
}
template<typename  T> void mintt(T& t1, T t2) {
    t1=min(t1,t2);
}
#define MAX 200135

bool debug = 0;
int n,m,k;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
string direc="URDL";//"RDLU";
ll ln, lk, lm;
void etp(bool f = 0) {
    puts(f ?"YES" : "NO");
    exit(0);
}
void addmod(int &x, int y, int mod = MOD) {
    assert(y>=0);
    x+=y; if (x>=mod) x-=mod;
    assert(x>=0 && x<mod);
}
void et(int x=-1) {
    printf("%d\n", x); exit(0);
}
ll fastPow(ll x, ll y, int mod=MOD) {
    ll ans = 1;
    while(y>0) {
        if(y&1) ans = (x * ans)%mod;
        x = x*x%mod;
        y>>=1;
    }
    return ans;
}
ll gcd1(ll x, ll y) {
    return y?gcd1(y,x%y):x;
}

int N=100000 + 1;
int T[MAX*8], lz[MAX*8];
int a[MAX];
void Up(int rt, int l, int r){
    T[rt]=T[lch]+T[rch];
}
void Down(int rt, int l, int r) {
//    if(l+1==r) return;
    int mid=(l+r)/2;
    if(l+1<r) {
        Down(lch,l,mid);
        Down(rch,mid,r);
    }
    if(lz[rt]!=0) {
        if (lz[rt]==1) {//all 0
            T[lch]=0; T[rch]=0;
        } else if(lz[rt]==2){
            T[lch] = mid-l; T[rch]=r-mid;
        } else {
            T[lch] = mid-l - T[lch]; T[rch]=r-mid - T[rch];
        }
        lz[lch]=lz[rt]; lz[rch]=lz[rt];
        lz[rt]=0;
    }
}
void upt(int rt, int l, int r, int L, int R, int val) {
    if (R<=l||r<=L) return;
    Down(rt,l,r);
    if (L<=l && r<=R) {
        assert(lz[rt]==0);
        if (val==1) T[rt]=0;
        else if(val==2) T[rt]=r-l;
        else T[rt]=r-l-T[rt];
        lz[rt]=val;
        return;
    }
    int mid = (l+r)/2;
    upt(lch,l,mid,L,R,val);
    upt(rch,mid,r,L,R,val);
    Up(rt,l,r);
}

int Ans[MAX];
void qy(int rt, int l, int r) {
    if (l+1==r) {
        Ans[r]=T[rt];
        return;
    }
    Down(rt,l,r);
    int mid = (l+r)/2;
    qy(lch,l,mid);
    qy(rch,mid,r);
}

void fmain(int tid) {
    scanf("%d%d", &n, &m);
    REQ(i,n) scanf("%d", a+i);
    char ope[3];
    int x;
    int nn = N+N-1;
    REQ(i,m) {
        scanf("%s%d",ope,&x);
        if (x>=0) {
            if(ope[0]=='>') {
                upt(1, 0, nn, N+x, nn, 2);
                upt(1, 0, nn, 0, N-x-1, 1);
            } else {
                upt(1,0,nn,0,N-x,2);
                upt(1,0,nn,N-x,N+x-1,3);
                upt(1,0,nn,N+x-1,nn,1);
            }
        } else {
            x*=-1;
            if(ope[0]=='<') {
                upt(1,0,nn,0,N-x-1,2);
                upt(1,0,nn,N+x,nn,1);
            } else {
                upt(1,0,nn,0,N-x,1);
                upt(1,0,nn,N-x,N+x-1,3);
                upt(1,0,nn,N+x-1,nn,2);
            }
        }
    }
    qy(1,0,nn);
    REQ(i,n) {
        int z=Ans[N+a[i]] == 1 ? -1 : 1;
        printf("%d ",a[i]*z);
    }
}
int main() {
    int t=1;
//    scanf("%d", &t);
    REQ(i,t) {
        fmain(i);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10,ad=1e5+2;
int val[N*4],f1[N*4],f2[N*4];
int a[N];
void push_down(int root){
    if(f1[root]){
        val[root<<1]*=-1;
        val[root<<1|1]*=-1;
        f1[root<<1]^=1;
        f1[root<<1|1]^=1;
        f2[root<<1]*=-1;
        f2[root<<1|1]*=-1;
        f1[root]=0;
    }
    if(f2[root]){
        val[root<<1]=val[root<<1|1]=f2[root];
        f1[root<<1]=f1[root<<1|1]=0;
        f2[root<<1]=f2[root<<1|1]=f2[root];
        f2[root]=0;
    }
}
void update(int l,int r,int root,int ql,int qr,int op,int v){
    if(l>=ql&&r<=qr){
        if(op==1)
            val[root]*=-1,f1[root]^=1,f2[root]*=-1;
        else
            val[root]=v,f2[root]=v,f1[root]=0;
        return ;
    }
    int mid=l+r>>1;
    push_down(root);
    if(mid>=ql)
        update(l,mid,root<<1,ql,qr,op,v);
    if(mid<qr)
        update(mid+1,r,root<<1|1,ql,qr,op,v);
}
int query(int l,int r,int root,int p){
    if(l==r)
        return val[root];
    int mid=l+r>>1;
    push_down(root);
    if(mid>=p)
        return query(l,mid,root<<1,p);
    else
        return query(mid+1,r,root<<1|1,p);
}
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=ad*2*4;i++)
        val[i]=1;
    while(k--){
        char s[2];
        int x;
        scanf("%s%d",s,&x);
        if(s[0]=='>'){
            if(x>=0){
                update(1,2*ad,1,x+1+ad,2*ad,2,-1);
                update(1,2*ad,1,1,ad-x-1,2,1);
                //printf("%d\n",query(1,2*ad,1,2+ad));
            }
            else{
                update(1,2*ad,1,ad+x+1,ad-x-1,1,1);
                update(1,2*ad,1,1,ad+x,2,1);
                update(1,2*ad,1,ad-x,2*ad,2,-1);
            }
        }
        else{
            if(x>0){
                update(1,2*ad,1,ad-x+1,ad+x-1,1,1);
                update(1,2*ad,1,1,ad-x,2,-1);
                update(1,2*ad,1,ad+x,2*ad,2,1);
            }
            else{
                update(1,2*ad,1,1,ad+x-1,2,-1);
                update(1,2*ad,1,ad-x+1,2*ad,2,1);
            }
        }
    }
    for(int i=1;i<=n;i++)
        printf("%d%c",a[i]*query(1,2*ad,1,ad+a[i])," \n"[i==n]);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10,ad=1e5+2;
int val[N*4],f1[N*4],f2[N*4];
int a[N];
void push_down(int root){
    if(f1[root]){
        val[root<<1]*=-1;
        val[root<<1|1]*=-1;
        if(f2[root<<1])
            f2[root<<1]*=-1;
        else
            f1[root<<1]^=1;
        if(f2[root<<1|1])
            f2[root<<1|1]*=-1;
        else
            f1[root<<1|1]^=1;

        f1[root]=0;
    }
    if(f2[root]){
        val[root<<1]=val[root<<1|1]=f2[root];
        f1[root<<1]=f1[root<<1|1]=0;
        f2[root<<1]=f2[root<<1|1]=f2[root];
        f2[root]=0;
    }
}
void update(int l,int r,int root,int ql,int qr,int op,int v){
    if(l>=ql&&r<=qr){
        if(op==1)
            val[root]*=-1,f1[root]^=1;
        else
            val[root]=v,f2[root]=v;
        return ;
    }
    int mid=l+r>>1;
    push_down(root);
    if(mid>=ql)
        update(l,mid,root<<1,ql,qr,op,v);
    if(mid<qr)
        update(mid+1,r,root<<1|1,ql,qr,op,v);
}
int query(int l,int r,int root,int p){
    if(l==r)
        return val[root];
    int mid=l+r>>1;
    push_down(root);
    if(mid>=p)
        return query(l,mid,root<<1,p);
    else
        return query(mid+1,r,root<<1|1,p);
}
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=ad*2*4;i++)
        val[i]=1;
    while(k--){
        char s[2];
        int x;
        scanf("%s%d",s,&x);
        if(s[0]=='>'){
            if(x>=0){
                update(1,2*ad,1,x+1+ad,2*ad,2,-1);
                update(1,2*ad,1,1,ad-x-1,2,1);
                //printf("%d\n",query(1,2*ad,1,2+ad));
            }
            else{
                update(1,2*ad,1,ad+x+1,ad-x-1,1,1);
                update(1,2*ad,1,1,ad+x,2,1);
                update(1,2*ad,1,ad-x,2*ad,2,-1);
            }
        }
        else{
            if(x>0){
                update(1,2*ad,1,ad-x+1,ad+x-1,1,1);
                update(1,2*ad,1,1,ad-x,2,-1);
                update(1,2*ad,1,ad+x,2*ad,2,1);
            }
            else{
                update(1,2*ad,1,1,ad+x-1,2,-1);
                update(1,2*ad,1,ad-x+1,2*ad,2,1);
            }
        }
    }
    for(int i=1;i<=n;i++)
        printf("%d%c",a[i]*query(1,2*ad,1,ad+a[i])," \n"[i==n]);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10,ad=1e5+2;
int val[N*4],f1[N*4],f2[N*4];
int a[N];
void push_down(int root){
    if(f1[root]){
        val[root<<1]*=-1;
        val[root<<1|1]*=-1;
        f1[root<<1]^=1;
        f1[root<<1|1]^=1;
        f2[root<<1]*=-1;
        f2[root<<1|1]*=-1;
        f1[root]=0;
    }
    if(f2[root]){
        val[root<<1]=val[root<<1|1]=f2[root];
        f1[root<<1]=f1[root<<1|1]=0;
        f2[root<<1]=f2[root<<1|1]=f2[root];
        f2[root]=0;
    }
}
void update(int l,int r,int root,int ql,int qr,int op,int v){
    if(l>=ql&&r<=qr){
        if(op==1)
            val[root]*=-1,f1[root]^=1;
        else
            val[root]=v,f2[root]=v;
        return ;
    }
    int mid=l+r>>1;
    push_down(root);
    if(mid>=ql)
        update(l,mid,root<<1,ql,qr,op,v);
    if(mid<qr)
        update(mid+1,r,root<<1|1,ql,qr,op,v);
}
int query(int l,int r,int root,int p){
    if(l==r)
        return val[root];
    int mid=l+r>>1;
    push_down(root);
    if(mid>=p)
        return query(l,mid,root<<1,p);
    else
        return query(mid+1,r,root<<1|1,p);
}
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=ad*2*4;i++)
        val[i]=1;
    while(k--){
        char s[2];
        int x;
        scanf("%s%d",s,&x);
        if(s[0]=='>'){
            if(x>=0){
                update(1,2*ad,1,x+1+ad,2*ad,2,-1);
                update(1,2*ad,1,1,ad-x-1,2,1);
                //printf("%d\n",query(1,2*ad,1,2+ad));
            }
            else{
                update(1,2*ad,1,ad+x+1,ad-x-1,1,1);
                update(1,2*ad,1,1,ad+x,2,1);
                update(1,2*ad,1,ad-x,2*ad,2,-1);
            }
        }
        else{
            if(x>0){
                update(1,2*ad,1,ad-x+1,ad+x-1,1,1);
                update(1,2*ad,1,1,ad-x,2,-1);
                update(1,2*ad,1,ad+x,2*ad,2,1);
            }
            else{
                update(1,2*ad,1,1,ad+x-1,2,-1);
                update(1,2*ad,1,ad-x+1,2*ad,2,1);
            }
        }
    }
    for(int i=1;i<=n;i++)
        printf("%d%c",a[i]*query(1,2*ad,1,ad+a[i])," \n"[i==n]);
    return 0;
}


#include<bits/stdc++.h>

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}
const int N=100005;
struct node{
    int a=0;
    int real=0;
    node (int val=0){
        a=val;
    }
    void merge(node &n1,node &n2){
    	 if(n1.real)this->a=n1.a;
    	 else this->a=n2.a;
    	 this->real=1;
    }
}nul;
struct update{
  int val=0;
  update(int t=0){
     val=t;
  }
  void combine(update &par,int tl,int tr){
      if(par.val==1 || par.val==0)val^=par.val;
      else val=par.val;
  }
  void apply(node &node){
      if(val==1 || val==0)node.a^=val;
      else node.a=val;
      val=0;
  }
};
template<typename node,typename update>
struct segtree{
  node t[4*N];
  bool lazy[4*N];
  update zaker[4*N];
  int tl[4*N];
  int tr[4*N];
  inline void pushdown(int v){
     if(lazy[v]){
       apply(zaker[v],v);
       lazy[v]=0;
       zaker[v].apply(t[v]);
     }
  }
  inline void apply(update &u,int v){
      if(tl[v]!=tr[v]){
          lazy[2*v]=lazy[2*v+1]=1;
          zaker[2*v].combine(u,tl[2*v],tr[2*v]);
          zaker[2*v+1].combine(u,tl[2*v+1],tr[2*v+1]);
      }
  }
  void build(int v,int start,int end){
      tl[v]=start;
      tr[v]=end;
      if(start==end){
          t[v].a=0;
          t[v].real=1;
      }
      else{
          int m=(start+end)/2;
          build(2*v,start,m);
          build(2*v+1,m+1,end);
          t[v].merge(t[2*v],t[2*v+1]);
     }
  }
  void zeno(int v,int l,int r,update val){
  	  if(l>r)return;
      pushdown(v);
      if(tr[v]<l || tl[v]>r)return;
      if(l<=tl[v] && tr[v]<=r){
            if(val.val==1)t[v].a^=1;
            else t[v].a=val.val;
            apply(val,v);
            return;
      }
      zeno(2*v,l,r,val);
      zeno(2*v+1,l,r,val);
      t[v].merge(t[2*v],t[2*v+1]);
  }
  node query(int v,int l,int r){
      if(tr[v]<l || tl[v]>r)return nul;
      pushdown(v);
      if(l<=tl[v] && tr[v]<=r){
         return t[v];
      }
      node a=query(2*v,l,r);
      node b=query(2*v+1,l,r);
      node ans;
      ans.merge(a,b);
      return ans;
  }
public:
  node query(int l,int r){
      return query(1,l,r);
  }
  void upd(int l,int r,update val){
      return zeno(1,l,r,val);
  }
};
segtree<node,update>seg;
int solve(){
 int n,m;cin>>n>>m;
 vector<int>vec(n+1);
 rep3(n)cin>>vec[i+1];
 update upd;
 seg.build(1,1,N);
 rep3(m){
 	char c;int x;cin>>c>>x;
 	if(c=='>'){
 		if(x>=0){
           upd.val=3;
           seg.upd(x+1,N,upd);
 		}
 		else{
 			x=abs(x);
 			upd.val=1;
 			seg.upd(1,x-1,upd);
 			upd.val=3;
 			seg.upd(x,N,upd);
 		}
 	}
 	else{
 		if(x>0){
           upd.val=2;
           seg.upd(x,N,upd);
           upd.val=1;
           seg.upd(1,x-1,upd);
 		}
 		else{
 		    x=abs(x);
 			upd.val=2;
 			seg.upd(x+1,N,upd);
 		}
 	}
 }
 for(int i=1;i<=n;i++){
 	if(vec[i]==0)cout<<vec[i]<<" ";
 	else{
 		auto s=seg.query(abs(vec[i]),abs(vec[i]));
        if(s.a==0)cout<<vec[i]<<" ";
        if(s.a==1)cout<<-1*vec[i]<<" ";
        if(s.a==2)cout<<abs(vec[i])<<" ";
        if(s.a==3)cout<<-abs(vec[i])<<" ";
 	}
 }
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    nul.real=0;
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}
const int N=100005;
struct node{
    int a=0;
    int real=0;
    node (int val=0){
        a=val;
    }
    void merge(node &n1,node &n2){
    	 if(n1.real)this->a=n1.a;
    	 else this->a=n2.a;
    	 this->real=1;
    }
}nul;
struct update{
  int val=0;
  update(int t=0){
     val=t;
  }
  void combine(update &par,int tl,int tr){
      if(par.val==1)val^=1;
      else val=par.val;
  }
  void apply(node &node){
      if(val==1)node.a^=1;
      else if(val)node.a=val;
      val=0;
  }
};
template<typename node,typename update>
struct segtree{
  node t[4*N];
  bool lazy[4*N];
  update zaker[4*N];
  int tl[4*N];
  int tr[4*N];
  inline void pushdown(int v){
     if(lazy[v]){
       apply(zaker[v],v);
       lazy[v]=0;
       zaker[v].apply(t[v]);
     }
  }
  inline void apply(update &u,int v){
      if(tl[v]!=tr[v]){
          lazy[2*v]=lazy[2*v+1]=1;
          zaker[2*v].combine(u,tl[2*v],tr[2*v]);
          zaker[2*v+1].combine(u,tl[2*v+1],tr[2*v+1]);
      }
  }
  void build(int v,int start,int end){
      tl[v]=start;
      tr[v]=end;
      if(start==end){
          t[v].a=0;
          t[v].real=1;
      }
      else{
          int m=(start+end)/2;
          build(2*v,start,m);
          build(2*v+1,m+1,end);
          t[v].merge(t[2*v],t[2*v+1]);
     }
  }
  void zeno(int v,int l,int r,update val){
      pushdown(v);
      if(tr[v]<l || tl[v]>r)return;
      if(l<=tl[v] && tr[v]<=r){
            if(val.val==1)t[v].a^=1;
            else t[v].a=val.val;
            apply(val,v);
            return;
      }
      zeno(2*v,l,r,val);
      zeno(2*v+1,l,r,val);
      t[v].merge(t[2*v],t[2*v+1]);
  }
  node query(int v,int l,int r){
      if(tr[v]<l || tl[v]>r)return nul;
      pushdown(v);
      if(l<=tl[v] && tr[v]<=r){
         return t[v];
      }
      node a=query(2*v,l,r);
      node b=query(2*v+1,l,r);
      node ans;
      ans.merge(a,b);
      return ans;
  }
public:
  node query(int l,int r){
      return query(1,l,r);
  }
  void upd(int l,int r,update val){
      return zeno(1,l,r,val);
  }
};
segtree<node,update>seg;
int solve(){
 int n,m;cin>>n>>m;
 vector<int>vec(n+1);
 rep3(n)cin>>vec[i+1];
 update upd;
 seg.build(1,1,N);
 rep3(m){
 	char c;int x;cin>>c>>x;
 	if(c=='>'){
 		if(x>0){
           upd.val=3;
           seg.upd(x+1,N,upd);
 		}
 		else{
 			x=abs(x);
 			upd.val=1;
 			seg.upd(1,x-1,upd);
 			upd.val=3;
 			seg.upd(x,N,upd);
 		}
 	}
 	else{
 		if(x>0){
           upd.val=2;
           seg.upd(x,N,upd);
           upd.val=1;
           seg.upd(1,x-1,upd);
 		}
 		else{
 			x=abs(x);
 			upd.val=2;
 			seg.upd(x+1,N,upd);
 		}
 	}
 }
 for(int i=1;i<=n;i++){
 	if(vec[i]==0)cout<<vec[i]<<" ";
 	else{
 		auto s=seg.query(abs(vec[i]),abs(vec[i]));
        if(s.a==0)cout<<vec[i]<<" ";
        if(s.a==1)cout<<-1*vec[i]<<" ";
        if(s.a==2)cout<<abs(vec[i])<<" ";
        if(s.a==3)cout<<-abs(vec[i])<<" ";
 	}
 }
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    nul.real=0;
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}
const int N=100005;
struct node{
    int a=0;
    int real=0;
    node (int val=0){
        a=val;
    }
    void merge(node &n1,node &n2){
    	 if(n1.real)this->a=n1.a;
    	 else this->a=n2.a;
    	 this->real=1;
    }
}nul;
struct update{
  int val=0;
  update(int t=0){
     val=t;
  }
  void combine(update &par,int tl,int tr){
      if(par.val==1)val^=1;
      else val=par.val;
  }
  void apply(node &node){
      if(val==1)node.a^=1;
      else if(val)node.a=val;
      val=0;
  }
};
template<typename node,typename update>
struct segtree{
  node t[4*N];
  bool lazy[4*N];
  update zaker[4*N];
  int tl[4*N];
  int tr[4*N];
  inline void pushdown(int v){
     if(lazy[v]){
       apply(zaker[v],v);
       lazy[v]=0;
       zaker[v].apply(t[v]);
     }
  }
  inline void apply(update &u,int v){
      if(tl[v]!=tr[v]){
          lazy[2*v]=lazy[2*v+1]=1;
          zaker[2*v].combine(u,tl[2*v],tr[2*v]);
          zaker[2*v+1].combine(u,tl[2*v+1],tr[2*v+1]);
      }
  }
  void build(int v,int start,int end){
      tl[v]=start;
      tr[v]=end;
      if(start==end){
          t[v].a=0;
          t[v].real=1;
      }
      else{
          int m=(start+end)/2;
          build(2*v,start,m);
          build(2*v+1,m+1,end);
          t[v].merge(t[2*v],t[2*v+1]);
     }
  }
  void zeno(int v,int l,int r,update val){
  	  if(l>r)return;
      pushdown(v);
      if(tr[v]<l || tl[v]>r)return;
      if(l<=tl[v] && tr[v]<=r){
            if(val.val==1)t[v].a^=1;
            else t[v].a=val.val;
            apply(val,v);
            return;
      }
      zeno(2*v,l,r,val);
      zeno(2*v+1,l,r,val);
      t[v].merge(t[2*v],t[2*v+1]);
  }
  node query(int v,int l,int r){
      if(tr[v]<l || tl[v]>r)return nul;
      pushdown(v);
      if(l<=tl[v] && tr[v]<=r){
         return t[v];
      }
      node a=query(2*v,l,r);
      node b=query(2*v+1,l,r);
      node ans;
      ans.merge(a,b);
      return ans;
  }
public:
  node query(int l,int r){
      return query(1,l,r);
  }
  void upd(int l,int r,update val){
      return zeno(1,l,r,val);
  }
};
segtree<node,update>seg;
int solve(){
 int n,m;cin>>n>>m;
 vector<int>vec(n+1);
 rep3(n)cin>>vec[i+1];
 update upd;
 seg.build(1,1,N);
 rep3(m){
 	char c;int x;cin>>c>>x;
 	if(c=='>'){
 		if(x>=0){
           upd.val=3;
           seg.upd(x+1,N,upd);
 		}
 		else{
 			x=abs(x);
 			upd.val=1;
 			seg.upd(1,x-1,upd);
 			upd.val=3;
 			seg.upd(x,N,upd);
 		}
 	}
 	else{
 		if(x>=0){
           upd.val=2;
           seg.upd(x,N,upd);
           upd.val=1;
           seg.upd(1,x-1,upd);
 		}
 		else{
 			x=abs(x);
 			upd.val=2;
 			seg.upd(x+1,N,upd);
 		}
 	}
 }
 for(int i=1;i<=n;i++){
 	if(vec[i]==0)cout<<vec[i]<<" ";
 	else{
 		auto s=seg.query(abs(vec[i]),abs(vec[i]));
        if(s.a==0)cout<<vec[i]<<" ";
        if(s.a==1)cout<<-1*vec[i]<<" ";
        if(s.a==2)cout<<abs(vec[i])<<" ";
        if(s.a==3)cout<<-abs(vec[i])<<" ";
 	}
 }
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    nul.real=0;
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <cstdint>
#include <cassert>
#include <complex>

#define all(x) (x).begin(), (x).end()
#define fori(i, n) for(int i = 0; i < n; i++)
#define rep(i, s, e) for(int i = (s); i <= (e); ++i)
#define repr(i, s, e) for(int i = (s); i >= (e); --i)
#define ll long long int
#define pb push_back

namespace io{
class input_reader{
std::istream∈
void throw_error(){throw std::runtime_error("No more inputs while reading number");}
template<typename T>
inline void readIntegerValue(T&f){bool positive=true;f=0;char c;
if(!in.get(c))throw_error();
while(c<'0'||c>'9'){if(c=='-')positive=false;if(!in.get(c))throw_error();}
while(c>='0'&&c<='9'){f=(f<<3)+(f<<1)+(c&15);if(!in.get(c))break;}
if(!positive)f*=-1;}
public:
explicit input_reader(std::istream&in):in(in){}
inline void read(int&f){readIntegerValue(f);}
inline void read(short&f){readIntegerValue(f);}
inline void read(long int&f){readIntegerValue(f);}
inline void read(long long int&f){readIntegerValue(f);}
inline void read(unsigned int&f){readIntegerValue(f);}
inline void read(unsigned short&f){readIntegerValue(f);}
inline void read(unsigned long int&f){readIntegerValue(f);}
inline void read(unsigned long long int&f){readIntegerValue(f);}
template<typename T>inline void read(std::vector<T>&f){for(auto&i:f)read(i);}
template<typename T,int N>inline void read(std::array<T,N>&res){for(auto&i:res)read(i);}
template<typename T1,typename T2>inline void read(std::pair<T1,T2>&p){in.read(p.first,p.second);}
template<typename T>inline void read(T&f){in>>f;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t),read(args...);}
template<typename T>inline void readArray(int n,T*res){while(n--)read(*(res++));}
template<typename T>inline input_reader&operator>>(T&t){return read(t),*this;}
};
}

namespace io{
class output_writer{
std::ostream&out;
template<typename T>inline void printIntegerHelper(T x){if(x>=10)printIntegerHelper(x/10);out.put(x%10+48);}
template<typename T>inline void printInteger(T x){if(x<0)out.put('-'),x=-x;printIntegerHelper(x);}
template<typename T>inline void printArray(T&ar){bool first=true;for(auto&t:ar)print((first)? first=false,"":" ",t);}
public:
explicit output_writer(std::ostream&out):out(out){}
inline void flush(){out.flush();}
inline void print(){}
inline void print(char x){out.put(x);}
inline void print(short x){printInteger(x);}
inline void print(int x){printInteger(x);}
inline void print(long int x){printInteger(x);}
inline void print(long long int x){printInteger(x);}
inline void print(unsigned short x){printInteger(x);}
inline void print(unsigned int x){printInteger(x);}
inline void print(unsigned long int x){printInteger(x);}
inline void print(unsigned long long int x){printInteger(x);}
template<typename T1>inline void print(const T1&t1){out<<t1;}
template<typename T1>inline void print(const std::vector<T1>&t1){printArray(t1);}
template<typename T1,int N>inline void print(const std::array<T1,N>&t1){printArray(t1);}
template<typename T1,int N,int M>inline void print(const std::array<std::array<T1,M>,N>&t1){for(auto&t:t1)println(t);}
template<typename T1>inline void print(const std::vector<std::vector<T1>>&t1){for(auto&t:t1)println(t);}
template<typename T,typename...Args>inline void print(const T&t,Args...args){print(t),print(args...);}
template<typename...Args>inline void println(Args...args){print(args...),print('\n');}
template<typename T>output_writer&operator<<(const T&t){return print(t),*this;}
};
}

inline ll pow_mod(const ll a, const ll b, const ll MOD) {
	if (b == 0) return 1;
	if (b == 1) return a % MOD;
	ll res = pow_mod(a * a % MOD, b >> 1, MOD);
	if (b & 1) res = res * a % MOD;
	return res % MOD;
}

inline ll mod_inv(const ll a, const ll MOD) {
	return pow_mod(a, MOD - 2, MOD);
}

template<typename T>
T gcd(const T &a, const T &b) {
	if (*a == 0)
		return b;
	return gcd(b % a, a);
}

template<typename T>
T lcm(const T &a, const T &b) {
	assert(a != 0 && b != 0);
	return a / gcd(a, b) * b;
}

using namespace std;

class EHotIsCold {
	class Solver {
		io::input_reader in;
		io::output_writer out;

	public:
		Solver(std::istream &in, std::ostream &out) : in(in), out(out) {}

		class RangeNode {
		public:

			int v = 1;
			int l, r, m;
			RangeNode *left = nullptr, *right;

			~RangeNode() {
				if (left != nullptr) {
					delete left;
					delete right;
				}
			}

			RangeNode(int l1, int r1) {
				l = l1;
				r = r1;
				m = (l + r) / 2;
				if (l == r)
					return;
				left = new RangeNode(l, m);
				right = new RangeNode(m + 1, r);
			}

			int get(int i) {
				if (i == l && i == r) return v;
				down();
				if (i <= m) return left->get(i);
				else return right->get(i);
			}

			void down() {
				if (v != 1) {
					left->op(l, m, v);
					right->op(m + 1, r, v);
					v = 1;
				}
			}

			void op(int l1, int r1, int op) {
				if (l1 == l && r1 == r) {
					if (abs(op) == 1) v *= op;
					else v = op;
				} else {
					down();
					if (r1 <= m) left->op(l1, r1, op);
					else if (l1 > m) right->op(l1, r1, op);
					else {
						left->op(l1, m, op);
						right->op(m + 1, r1, op);
					}
				}
			}
		};

		void solve() {
			int n, q;
			in.read(n, q);
			vector<int> a(n);
			in >> a;
			int maxv = 0;
			maxv = 100100;
			auto *rn = new RangeNode(0, maxv);
			while (q--) {
				int x;
				string s;
				in >> s >> x;

				if (s[0] == '<') {
					if (x > 0) {
						rn->op(0, x - 1, -1);
						rn->op(x, maxv, 2);
					} else {
						x = -x;
						rn->op(x + 1, maxv, 2);
					}
				} else {
					if (x >= 0) {
						rn->op(x + 1, maxv, -2);
					} else {
						x = -x;
						rn->op(x, maxv, -2);
						rn->op(0, x - 1, -1);
					}
				}
			}
			fori(i, n) {
				int r = rn->get(abs(a[i]));
				if (abs(r) == 2) {
					if (r == 2) a[i] = abs(a[i]);
					else a[i] = -abs(a[i]);
				} else {
					a[i] *= r;
				}
			}
			out << a;
		}
	};

public:
	void solve(std::istream &in, std::ostream &out) {
		Solver(in, out).solve();
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	EHotIsCold solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <cstdint>
#include <cassert>
#include <complex>

#define all(x) (x).begin(), (x).end()
#define fori(i, n) for(int i = 0; i < n; i++)
#define rep(i, s, e) for(int i = (s); i <= (e); ++i)
#define repr(i, s, e) for(int i = (s); i >= (e); --i)
#define ll long long int
#define pb push_back

namespace io{
class input_reader{
std::istream∈
void throw_error(){throw std::runtime_error("No more inputs while reading number");}
template<typename T>
inline void readIntegerValue(T&f){bool positive=true;f=0;char c;
if(!in.get(c))throw_error();
while(c<'0'||c>'9'){if(c=='-')positive=false;if(!in.get(c))throw_error();}
while(c>='0'&&c<='9'){f=(f<<3)+(f<<1)+(c&15);if(!in.get(c))break;}
if(!positive)f*=-1;}
public:
explicit input_reader(std::istream&in):in(in){}
inline void read(int&f){readIntegerValue(f);}
inline void read(short&f){readIntegerValue(f);}
inline void read(long int&f){readIntegerValue(f);}
inline void read(long long int&f){readIntegerValue(f);}
inline void read(unsigned int&f){readIntegerValue(f);}
inline void read(unsigned short&f){readIntegerValue(f);}
inline void read(unsigned long int&f){readIntegerValue(f);}
inline void read(unsigned long long int&f){readIntegerValue(f);}
template<typename T>inline void read(std::vector<T>&f){for(auto&i:f)read(i);}
template<typename T,int N>inline void read(std::array<T,N>&res){for(auto&i:res)read(i);}
template<typename T1,typename T2>inline void read(std::pair<T1,T2>&p){in.read(p.first,p.second);}
template<typename T>inline void read(T&f){in>>f;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t),read(args...);}
template<typename T>inline void readArray(int n,T*res){while(n--)read(*(res++));}
template<typename T>inline input_reader&operator>>(T&t){return read(t),*this;}
};
}

namespace io{
class output_writer{
std::ostream&out;
template<typename T>inline void printIntegerHelper(T x){if(x>=10)printIntegerHelper(x/10);out.put(x%10+48);}
template<typename T>inline void printInteger(T x){if(x<0)out.put('-'),x=-x;printIntegerHelper(x);}
template<typename T>inline void printArray(T&ar){bool first=true;for(auto&t:ar)print((first)? first=false,"":" ",t);}
public:
explicit output_writer(std::ostream&out):out(out){}
inline void flush(){out.flush();}
inline void print(){}
inline void print(char x){out.put(x);}
inline void print(short x){printInteger(x);}
inline void print(int x){printInteger(x);}
inline void print(long int x){printInteger(x);}
inline void print(long long int x){printInteger(x);}
inline void print(unsigned short x){printInteger(x);}
inline void print(unsigned int x){printInteger(x);}
inline void print(unsigned long int x){printInteger(x);}
inline void print(unsigned long long int x){printInteger(x);}
template<typename T1>inline void print(const T1&t1){out<<t1;}
template<typename T1>inline void print(const std::vector<T1>&t1){printArray(t1);}
template<typename T1,int N>inline void print(const std::array<T1,N>&t1){printArray(t1);}
template<typename T1,int N,int M>inline void print(const std::array<std::array<T1,M>,N>&t1){for(auto&t:t1)println(t);}
template<typename T1>inline void print(const std::vector<std::vector<T1>>&t1){for(auto&t:t1)println(t);}
template<typename T,typename...Args>inline void print(const T&t,Args...args){print(t),print(args...);}
template<typename...Args>inline void println(Args...args){print(args...),print('\n');}
template<typename T>output_writer&operator<<(const T&t){return print(t),*this;}
};
}

inline ll pow_mod(ll a,ll b,const ll MOD){ll res=1;for(ll i=1;b;b^=b&i,i<<=1,a=(a*a)%MOD)if(b&i)res=(res*a)%MOD;return res;}
inline ll mod_inv(const ll a,const ll MOD){return pow_mod(a,MOD-2,MOD);}
template<typename T>inline T gcd(T a,T b){T t;while(a!=0)t=a,a=b%a,b=t;return b;}
template<typename T>T lcm(const T &a,const T &b) {assert(a!=0&&b!=0);return a/gcd(a,b)*b;}

namespace range_update {

	/*
	 * op : T(T previous, T current)
	 * */
	template<typename T, typename Operator>
	class ranges_array {
		struct T_in_use {
			T t;
			bool in_use = false;
		};
		const Operator op;
		std::vector<T_in_use> vec;
		const int n;

		void update_index(int index, const T &val) {
			if (vec[index].in_use) {
				vec[index].t = op(vec[index].t, val);
			} else vec[index].t = val;
			vec[index].in_use = true;
		}

		void update_index_down(int index) {
			if (vec[index].in_use) {
				update_index(index * 2, vec[index].t);
				update_index(index * 2 + 1, vec[index].t);
				vec[index].in_use = false;
			}
		}

		void update_range(int index, int index_l, int index_r, int l, int r, const T &val) {
			if (l == index_l && r == index_r) {
				update_index(index, val);
			} else {
				update_index_down(index);
				int index_m = (index_l + index_r) / 2;
				if (l <= index_m)
					update_range(index * 2, index_l, index_m, l, std::min(r, index_m), val);
				if (r > index_m)
					update_range(index * 2 + 1, index_m + 1, index_r, std::max(l, index_m + 1), r, val);
			}
		}

		static int calc_vec_size(int index, int l, int r) {
			if (l == r) return index;
			return std::max(calc_vec_size(index * 2, l, (l + r) / 2),
							calc_vec_size(index * 2 + 1, 1 + (l + r) / 2, r));
		}

		void set_values(const std::vector<T> &v, int index, int l, int r) {
			if (l == r)
				vec[index] = {v[l], true};
			else {
				set_values(v, index * 2, l, (l + r) / 2);
				set_values(v, index * 2 + 1, 1 + (l + r) / 2, r);
			}
		}

	public:

		ranges_array(int n, Operator op) : n(n), op(op) {
			vec.resize(calc_vec_size(1, 0, n - 1));
		}

		explicit ranges_array(int n) : ranges_array(n, Operator()) {}

		ranges_array(const std::vector<T> &v, Operator op) : ranges_array(v.size(), op) {
			set_values(v, 1, 0, n - 1);
		}

		explicit ranges_array(const std::vector<T> &v) : ranges_array(v, Operator()) {}

		void update_range(int l, int r, const T &val) {
			update_range(1, 0, n - 1, l, r, val);
		}

		T operator[](int i) {
			int index = 1;
			int l1 = 0;
			int r1 = n - 1;
			while (i != l1 || i != r1) {
				update_index_down(index);
				int m = (l1 + r1) / 2;
				if (i <= m)
					index *= 2, r1 = m;
				else
					index = index * 2 + 1, l1 = m + 1;
			}
			return vec[index].t;
		}
	};

	template<typename T>
	class sum_range_update : public ranges_array<T, std::function<T(T, T)>> {
	public:
		explicit sum_range_update(const std::vector<T> &v) :
				ranges_array<T, std::function<T(T, T)>>(v, [](const T &u, const T &v) { return u + v; }) {}
	};

	template<typename T>
	class set_range_update : public ranges_array<T, std::function<T(T, T)>> {
	public:
		explicit set_range_update(const std::vector<T> &v) :
				ranges_array<T, std::function<T(T, T)>>(v, [](const T &u, const T &v) { return v; }) {}
	};
}

using namespace std;

class EHotIsCold {
	class Solver {
		io::input_reader in;
		io::output_writer out;

	public:
		Solver(std::istream &in, std::ostream &out) : in(in), out(out) {}

		struct state {
			int v;

			friend state operator+(const state &l, const state &r) {
				if (abs(r.v) == 1)
					return {r.v * l.v};
				else
					return {r.v};
			}
		};

		void solve() {
			int n, q;
			in.read(n, q);
			vector<int> a(n);
			in >> a;
			int maxv = 7;
//			int maxv = 100100;
			vector<state> start_state(maxv + 1, {1});
			range_update::sum_range_update sru(start_state);

			while (q--) {
				int x;
				string s;
				in >> s >> x;

				if (s[0] == '<') {
					if (x > 0) {
						sru.update_range(0, x - 1, {-1});
						sru.update_range(x, maxv, {2});
					} else {
						x = -x;
						sru.update_range(x + 1, maxv, {2});
					}
				} else {
					if (x >= 0) {
						sru.update_range(x + 1, maxv, {-2});
					} else {
						x = -x;
						sru.update_range(x, maxv, {-2});
						sru.update_range(0, x - 1, {-1});
					}
				}
			}
			fori(i, n) {
				int r = sru[abs(a[i])].v;
				if (abs(r) == 2) {
					if (r == 2) a[i] = abs(a[i]);
					else a[i] = -abs(a[i]);
				} else {
					a[i] *= r;
				}
			}
			out << a;
		}
	};

public:
	void solve(std::istream &in, std::ostream &out) {
		Solver(in, out).solve();
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	EHotIsCold solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <cstdint>
#include <cassert>
#include <complex>

#define all(x) (x).begin(), (x).end()
#define fori(i, n) for(int i = 0; i < n; i++)
#define rep(i, s, e) for(int i = (s); i <= (e); ++i)
#define repr(i, s, e) for(int i = (s); i >= (e); --i)
#define ll long long int
#define pb push_back

namespace io{
class input_reader{
std::istream∈
void throw_error(){throw std::runtime_error("No more inputs while reading number");}
template<typename T>
inline void readIntegerValue(T&f){bool positive=true;f=0;char c;
if(!in.get(c))throw_error();
while(c<'0'||c>'9'){if(c=='-')positive=false;if(!in.get(c))throw_error();}
while(c>='0'&&c<='9'){f=(f<<3)+(f<<1)+(c&15);if(!in.get(c))break;}
if(!positive)f*=-1;}
public:
explicit input_reader(std::istream&in):in(in){}
inline void read(int&f){readIntegerValue(f);}
inline void read(short&f){readIntegerValue(f);}
inline void read(long int&f){readIntegerValue(f);}
inline void read(long long int&f){readIntegerValue(f);}
inline void read(unsigned int&f){readIntegerValue(f);}
inline void read(unsigned short&f){readIntegerValue(f);}
inline void read(unsigned long int&f){readIntegerValue(f);}
inline void read(unsigned long long int&f){readIntegerValue(f);}
template<typename T>inline void read(std::vector<T>&f){for(auto&i:f)read(i);}
template<typename T,int N>inline void read(std::array<T,N>&res){for(auto&i:res)read(i);}
template<typename T1,typename T2>inline void read(std::pair<T1,T2>&p){in.read(p.first,p.second);}
template<typename T>inline void read(T&f){in>>f;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t),read(args...);}
template<typename T>inline void readArray(int n,T*res){while(n--)read(*(res++));}
template<typename T>inline input_reader&operator>>(T&t){return read(t),*this;}
};
}

namespace io{
class output_writer{
std::ostream&out;
template<typename T>inline void printIntegerHelper(T x){if(x>=10)printIntegerHelper(x/10);out.put(x%10+48);}
template<typename T>inline void printInteger(T x){if(x<0)out.put('-'),x=-x;printIntegerHelper(x);}
template<typename T>inline void printArray(T&ar){bool first=true;for(auto&t:ar)print((first)? first=false,"":" ",t);}
public:
explicit output_writer(std::ostream&out):out(out){}
inline void flush(){out.flush();}
inline void print(){}
inline void print(char x){out.put(x);}
inline void print(short x){printInteger(x);}
inline void print(int x){printInteger(x);}
inline void print(long int x){printInteger(x);}
inline void print(long long int x){printInteger(x);}
inline void print(unsigned short x){printInteger(x);}
inline void print(unsigned int x){printInteger(x);}
inline void print(unsigned long int x){printInteger(x);}
inline void print(unsigned long long int x){printInteger(x);}
template<typename T1>inline void print(const T1&t1){out<<t1;}
template<typename T1>inline void print(const std::vector<T1>&t1){printArray(t1);}
template<typename T1,int N>inline void print(const std::array<T1,N>&t1){printArray(t1);}
template<typename T1,int N,int M>inline void print(const std::array<std::array<T1,M>,N>&t1){for(auto&t:t1)println(t);}
template<typename T1>inline void print(const std::vector<std::vector<T1>>&t1){for(auto&t:t1)println(t);}
template<typename T,typename...Args>inline void print(const T&t,Args...args){print(t),print(args...);}
template<typename...Args>inline void println(Args...args){print(args...),print('\n');}
template<typename T>output_writer&operator<<(const T&t){return print(t),*this;}
};
}

inline ll pow_mod(const ll a, const ll b, const ll MOD) {
	if (b == 0) return 1;
	if (b == 1) return a % MOD;
	ll res = pow_mod(a * a % MOD, b >> 1, MOD);
	if (b & 1) res = res * a % MOD;
	return res % MOD;
}

inline ll mod_inv(const ll a, const ll MOD) {
	return pow_mod(a, MOD - 2, MOD);
}

template<typename T>
T gcd(const T &a, const T &b) {
	if (*a == 0)
		return b;
	return gcd(b % a, a);
}

template<typename T>
T lcm(const T &a, const T &b) {
	assert(a != 0 && b != 0);
	return a / gcd(a, b) * b;
}

using namespace std;

class EHotIsCold {
	class Solver {
		io::input_reader in;
		io::output_writer out;

	public:
		Solver(std::istream &in, std::ostream &out) : in(in), out(out) {}

		class RangeNode {
		public:

			int v = 1;
			int l, r, m;
			RangeNode *left = nullptr, *right;

			~RangeNode() {
				if (left != nullptr) {
					delete left;
					delete right;
				}
			}

			RangeNode(int l1, int r1) {
				l = l1;
				r = r1;
				m = (l + r) / 2;
				if (l == r)
					return;
				left = new RangeNode(l, m);
				right = new RangeNode(m + 1, r);
			}

			int get(int i) {
				if (i == l && i == r) return v;
				down();
				if (i <= m) return left->get(i);
				else return right->get(i);
			}

			void down() {
				if (v != 1) {
					left->op(l, m, v);
					right->op(m + 1, r, v);
					v = 1;
				}
			}

			void op(int l1, int r1, int op) {
				if (l1 == l && r1 == r) {
					if (abs(op) == 1) v *= op;
					else v = op;
				} else {
					down();
					if (r1 <= m) left->op(l1, r1, op);
					else if (l1 > m) right->op(l1, r1, op);
					else {
						left->op(l1, m, op);
						right->op(m + 1, r1, op);
					}
				}
			}
		};

		void solve() {
			int n, q;
			in.read(n, q);
			vector<int> a(n);
			in >> a;
			int maxv = 0;
			maxv = 100100;
			auto *rn = new RangeNode(0, maxv);
			while (q--) {
				int x;
				string s;
				in >> s >> x;

				if (s[0] == '<') {
					rn->op(abs(x) + 1, maxv, 2);
					if (x > 0) {
						rn->op(0, x - 1, -1);
					}
				} else {
					rn->op(abs(x) + 1, maxv, -2);
					if (x < 0) {
						rn->op(0, abs(x) - 1, -1);
					}
				}
			}
			fori(i, n) {
				int r = rn->get(abs(a[i]));
				if (abs(r) == 2) {
					if (r == 2) a[i] = abs(a[i]);
					else a[i] = -abs(a[i]);
				} else {
					a[i] *= r;
				}
			}
			out << a;
		}
	};

public:
	void solve(std::istream &in, std::ostream &out) {
		Solver(in, out).solve();
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	EHotIsCold solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <cstdint>
#include <cassert>
#include <complex>

#define all(x) (x).begin(), (x).end()
#define fori(i, n) for(int i = 0; i < n; i++)
#define rep(i, s, e) for(int i = (s); i <= (e); ++i)
#define repr(i, s, e) for(int i = (s); i >= (e); --i)
#define ll long long int
#define pb push_back

namespace io{
class input_reader{
std::istream∈
void throw_error(){throw std::runtime_error("No more inputs while reading number");}
template<typename T>
inline void readIntegerValue(T&f){bool positive=true;f=0;char c;
if(!in.get(c))throw_error();
while(c<'0'||c>'9'){if(c=='-')positive=false;if(!in.get(c))throw_error();}
while(c>='0'&&c<='9'){f=(f<<3)+(f<<1)+(c&15);if(!in.get(c))break;}
if(!positive)f*=-1;}
public:
explicit input_reader(std::istream&in):in(in){}
inline void read(int&f){readIntegerValue(f);}
inline void read(short&f){readIntegerValue(f);}
inline void read(long int&f){readIntegerValue(f);}
inline void read(long long int&f){readIntegerValue(f);}
inline void read(unsigned int&f){readIntegerValue(f);}
inline void read(unsigned short&f){readIntegerValue(f);}
inline void read(unsigned long int&f){readIntegerValue(f);}
inline void read(unsigned long long int&f){readIntegerValue(f);}
template<typename T>inline void read(std::vector<T>&f){for(auto&i:f)read(i);}
template<typename T,int N>inline void read(std::array<T,N>&res){for(auto&i:res)read(i);}
template<typename T1,typename T2>inline void read(std::pair<T1,T2>&p){in.read(p.first,p.second);}
template<typename T>inline void read(T&f){in>>f;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t),read(args...);}
template<typename T>inline void readArray(int n,T*res){while(n--)read(*(res++));}
template<typename T>inline input_reader&operator>>(T&t){return read(t),*this;}
};
}

namespace io{
class output_writer{
std::ostream&out;
template<typename T>inline void printIntegerHelper(T x){if(x>=10)printIntegerHelper(x/10);out.put(x%10+48);}
template<typename T>inline void printInteger(T x){if(x<0)out.put('-'),x=-x;printIntegerHelper(x);}
template<typename T>inline void printArray(T&ar){bool first=true;for(auto&t:ar)print((first)? first=false,"":" ",t);}
public:
explicit output_writer(std::ostream&out):out(out){}
inline void flush(){out.flush();}
inline void print(){}
inline void print(char x){out.put(x);}
inline void print(short x){printInteger(x);}
inline void print(int x){printInteger(x);}
inline void print(long int x){printInteger(x);}
inline void print(long long int x){printInteger(x);}
inline void print(unsigned short x){printInteger(x);}
inline void print(unsigned int x){printInteger(x);}
inline void print(unsigned long int x){printInteger(x);}
inline void print(unsigned long long int x){printInteger(x);}
template<typename T1>inline void print(const T1&t1){out<<t1;}
template<typename T1>inline void print(const std::vector<T1>&t1){printArray(t1);}
template<typename T1,int N>inline void print(const std::array<T1,N>&t1){printArray(t1);}
template<typename T1,int N,int M>inline void print(const std::array<std::array<T1,M>,N>&t1){for(auto&t:t1)println(t);}
template<typename T1>inline void print(const std::vector<std::vector<T1>>&t1){for(auto&t:t1)println(t);}
template<typename T,typename...Args>inline void print(const T&t,Args...args){print(t),print(args...);}
template<typename...Args>inline void println(Args...args){print(args...),print('\n');}
template<typename T>output_writer&operator<<(const T&t){return print(t),*this;}
};
}

inline ll pow_mod(const ll a, const ll b, const ll MOD) {
	if (b == 0) return 1;
	if (b == 1) return a % MOD;
	ll res = pow_mod(a * a % MOD, b >> 1, MOD);
	if (b & 1) res = res * a % MOD;
	return res % MOD;
}

inline ll mod_inv(const ll a, const ll MOD) {
	return pow_mod(a, MOD - 2, MOD);
}

template<typename T>
T gcd(const T &a, const T &b) {
	if (*a == 0)
		return b;
	return gcd(b % a, a);
}

template<typename T>
T lcm(const T &a, const T &b) {
	assert(a != 0 && b != 0);
	return a / gcd(a, b) * b;
}

using namespace std;

class EHotIsCold {
	class Solver {
		io::input_reader in;
		io::output_writer out;

	public:
		Solver(std::istream &in, std::ostream &out) : in(in), out(out) {}

		class RangeNode {
		public:

			int v = 1;
			int l, r, m;
			RangeNode *left = nullptr, *right;

			~RangeNode() {
				if (left != nullptr) {
					delete left;
					delete right;
				}
			}

			RangeNode(int l1, int r1) {
				l = l1;
				r = r1;
				m = (l + r) / 2;
				if (l == r)
					return;
				left = new RangeNode(l, m);
				right = new RangeNode(m + 1, r);
			}

			int get(int i) {
				int res = 0;
				if (i == l && i == r) res = 1;
				else if (i <= m) res = left->get(i);
				else res = right->get(i);
				if (v == 1) return res;
				if (v == -1) return -res;
				if (v == 2) return 2;
				if (v == -2) return -2;
				return 0;
			}

			void down() {
				if (v != 1) {
					left->op(l, m, v);
					right->op(m + 1, r, v);
					v = 1;
				}
			}

			void op(int l1, int r1, int op) {
				if (l1 == l && r1 == r) {
					if (op == -1) v *= -1;
					else v = op;
				} else {
					down();
					if (r1 <= m) left->op(l1, r1, op);
					else if (l1 > m) right->op(l1, r1, op);
					else {
						left->op(l1, m, op);
						right->op(m + 1, r1, op);
					}
				}
			}
		};

		void solve() {
			int n, q;
			in.read(n, q);
			vector<int> a(n);
			in >> a;
			int maxv = 0;
			maxv = 100100;
			auto *rn = new RangeNode(0, maxv);
			while (q--) {
				int x;
				string s;
				in >> s >> x;

				if (s[0] == '<') {
					if (x <= 0) {
						rn->op(abs(x) + 1, maxv, 2);
					} else {
						rn->op(0, x - 1, -1);
						rn->op(x + 1, maxv, 2);
					}
				} else {
					if (x >= 0) {
						rn->op(x + 1, maxv, -2);
					} else {
						rn->op(abs(x) + 1, maxv, -1);
						rn->op(0, abs(x) - 1, -1);
					}
				}
			}
			fori(i, n) {
				int r = rn->get(abs(a[i]));
				if (abs(r) == 2) {
					if (r == 2) a[i] = abs(a[i]);
					else a[i] = -abs(a[i]);
				} else {
					a[i] *= r;
				}
			}
			out << a;
		}
	};

public:
	void solve(std::istream &in, std::ostream &out) {
		Solver(in, out).solve();
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	EHotIsCold solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <cstdint>
#include <cassert>
#include <complex>

#define all(x) (x).begin(), (x).end()
#define fori(i, n) for(int i = 0; i < n; i++)
#define rep(i, s, e) for(int i = (s); i <= (e); ++i)
#define repr(i, s, e) for(int i = (s); i >= (e); --i)
#define ll long long int
#define pb push_back

namespace io{
class input_reader{
std::istream∈
void throw_error(){throw std::runtime_error("No more inputs while reading number");}
template<typename T>
inline void readIntegerValue(T&f){bool positive=true;f=0;char c;
if(!in.get(c))throw_error();
while(c<'0'||c>'9'){if(c=='-')positive=false;if(!in.get(c))throw_error();}
while(c>='0'&&c<='9'){f=(f<<3)+(f<<1)+(c&15);if(!in.get(c))break;}
if(!positive)f*=-1;}
public:
explicit input_reader(std::istream&in):in(in){}
inline void read(int&f){readIntegerValue(f);}
inline void read(short&f){readIntegerValue(f);}
inline void read(long int&f){readIntegerValue(f);}
inline void read(long long int&f){readIntegerValue(f);}
inline void read(unsigned int&f){readIntegerValue(f);}
inline void read(unsigned short&f){readIntegerValue(f);}
inline void read(unsigned long int&f){readIntegerValue(f);}
inline void read(unsigned long long int&f){readIntegerValue(f);}
template<typename T>inline void read(std::vector<T>&f){for(auto&i:f)read(i);}
template<typename T,int N>inline void read(std::array<T,N>&res){for(auto&i:res)read(i);}
template<typename T1,typename T2>inline void read(std::pair<T1,T2>&p){in.read(p.first,p.second);}
template<typename T>inline void read(T&f){in>>f;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t),read(args...);}
template<typename T>inline void readArray(int n,T*res){while(n--)read(*(res++));}
template<typename T>inline input_reader&operator>>(T&t){return read(t),*this;}
};
}

namespace io{
class output_writer{
std::ostream&out;
template<typename T>inline void printIntegerHelper(T x){if(x>=10)printIntegerHelper(x/10);out.put(x%10+48);}
template<typename T>inline void printInteger(T x){if(x<0)out.put('-'),x=-x;printIntegerHelper(x);}
template<typename T>inline void printArray(T&ar){bool first=true;for(auto&t:ar)print((first)? first=false,"":" ",t);}
public:
explicit output_writer(std::ostream&out):out(out){}
inline void flush(){out.flush();}
inline void print(){}
inline void print(char x){out.put(x);}
inline void print(short x){printInteger(x);}
inline void print(int x){printInteger(x);}
inline void print(long int x){printInteger(x);}
inline void print(long long int x){printInteger(x);}
inline void print(unsigned short x){printInteger(x);}
inline void print(unsigned int x){printInteger(x);}
inline void print(unsigned long int x){printInteger(x);}
inline void print(unsigned long long int x){printInteger(x);}
template<typename T1>inline void print(const T1&t1){out<<t1;}
template<typename T1>inline void print(const std::vector<T1>&t1){printArray(t1);}
template<typename T1,int N>inline void print(const std::array<T1,N>&t1){printArray(t1);}
template<typename T1,int N,int M>inline void print(const std::array<std::array<T1,M>,N>&t1){for(auto&t:t1)println(t);}
template<typename T1>inline void print(const std::vector<std::vector<T1>>&t1){for(auto&t:t1)println(t);}
template<typename T,typename...Args>inline void print(const T&t,Args...args){print(t),print(args...);}
template<typename...Args>inline void println(Args...args){print(args...),print('\n');}
template<typename T>output_writer&operator<<(const T&t){return print(t),*this;}
};
}

inline ll pow_mod(const ll a, const ll b, const ll MOD) {
	if (b == 0) return 1;
	if (b == 1) return a % MOD;
	ll res = pow_mod(a * a % MOD, b >> 1, MOD);
	if (b & 1) res = res * a % MOD;
	return res % MOD;
}

inline ll mod_inv(const ll a, const ll MOD) {
	return pow_mod(a, MOD - 2, MOD);
}

template<typename T>
T gcd(const T &a, const T &b) {
	if (*a == 0)
		return b;
	return gcd(b % a, a);
}

template<typename T>
T lcm(const T &a, const T &b) {
	assert(a != 0 && b != 0);
	return a / gcd(a, b) * b;
}

using namespace std;

class EHotIsCold {
	class Solver {
		io::input_reader in;
		io::output_writer out;

	public:
		Solver(std::istream &in, std::ostream &out) : in(in), out(out) {}

		class RangeNode {
		public:

			int v = 1;
			int l, r, m;
			RangeNode *left = nullptr, *right;

			~RangeNode() {
				if (left != nullptr) {
					delete left;
					delete right;
				}
			}

			RangeNode(int l1, int r1) {
				l = l1;
				r = r1;
				m = (l + r) / 2;
				if (l == r)
					return;
				left = new RangeNode(l, m);
				right = new RangeNode(m + 1, r);
			}

			int get(int i) {
				if (i == l && i == r) return v;
				down();
				if (i <= m) return left->get(i);
				else return right->get(i);
			}

			void down() {
				if (v != 1) {
					left->op(l, m, v);
					right->op(m + 1, r, v);
					v = 1;
				}
			}

			void op(int l1, int r1, int op) {
				if (l1 == l && r1 == r) {
					if (abs(op) == 1) v *= op;
					else v = op;
				} else {
					down();
					if (r1 <= m) left->op(l1, r1, op);
					else if (l1 > m) right->op(l1, r1, op);
					else {
						left->op(l1, m, op);
						right->op(m + 1, r1, op);
					}
				}
			}
		};

		void solve() {
			int n, q;
			in.read(n, q);
			vector<int> a(n);
			in >> a;
			int maxv = 0;
			maxv = 100100;
			auto *rn = new RangeNode(0, maxv);
			while (q--) {
				int x;
				string s;
				in >> s >> x;

				if (s[0] == '<') {
					if (x <= 0) {
						rn->op(abs(x) + 1, maxv, 2);
					} else {
						rn->op(0, x - 1, -1);
						rn->op(x + 1, maxv, 2);
					}
				} else {
					if (x >= 0) {
						rn->op(x + 1, maxv, -2);
					} else {
						rn->op(abs(x) + 1, maxv, -1);
						rn->op(0, abs(x) - 1, -1);
					}
				}
			}
			fori(i, n) {
				int r = rn->get(abs(a[i]));
				if (abs(r) == 2) {
					if (r == 2) a[i] = abs(a[i]);
					else a[i] = -abs(a[i]);
				} else {
					a[i] *= r;
				}
			}
			out << a;
		}
	};

public:
	void solve(std::istream &in, std::ostream &out) {
		Solver(in, out).solve();
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	EHotIsCold solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}