import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.*;
import java.util.*;
import java.util.LinkedList;
import java.math.*;
import java.lang.*;
import java.util.PriorityQueue;
import static java.lang.Math.*;
@SuppressWarnings("unchecked")
public class solution implements Runnable {
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        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 String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            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 long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long 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 double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            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 readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
	public static int min(int a,int b)
	{
		if(a>b)
		{
			return b;
		}
		return a;
	}
	public static long max(long a,long b)
	{
		if(a>b)
		{
			return a;
		}
		return b;
	}
	static class pair implements Comparable<pair>
	{
		int x;
		int y;
		pair(int x,int y)
		{
			this.x = x;
			this.y = y;
		}
		public int compareTo(pair p)
		{
			if(this.x>p.x)
			{
				return 1;
			}
			else if(this.x<p.x)
			{
				return -1;
			}
			else
			{
				return this.y-p.y;
			}
		}
	}
	public static void main(String args[]) throws Exception {
        new Thread(null, new solution(),"Main",1<<26).start();
    }
	public void run() {
        InputReader sc  = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int t1 = 1;
		while(t1-->0)
		{
			int n = sc.nextInt();
			int[][] arr = new int[2][n];
			for(int j=0;j<2;j++)
			{
				for(int i=0;i<n;i++)
				{
					arr[j][i] = sc.nextInt();
				}
			}
			long[][] suffix1 = new long[2][n+1];
			long[][] suffix2 = new long[2][n+1];
			long[][] sum = new long[2][n+1];
			for(int i=n-1;i>=0;i--)
			{
				suffix1[0][i] = suffix1[0][i+1]+(i+1)*arr[0][i];
				suffix1[1][i] = suffix1[1][i+1]+(i+1)*arr[1][i];
				suffix2[0][i] = suffix2[0][i+1]+(n-i)*arr[0][i];
				suffix2[1][i] = suffix2[1][i+1]+(n-i)*arr[1][i];
				sum[0][i] = sum[0][i+1]+arr[0][i];
				sum[1][i] = sum[1][i+1]+arr[1][i];
			}
			long res = 0;
			long sm = 0;
			int j = 0;
			for(int i=0;i<n;i++)
			{
				long curr = sm;
				curr+=suffix1[j][i]+i*sum[j][i];
				curr+=suffix2[j^1][i]+(i+n)*sum[j^1][i];
				res = max(res,curr);
				sm+=arr[j][i]*(2*i+1);
				sm+=arr[j^1][i]*(2*i+2);
				j = j^1;
			}
			for(int i=0;i<n;i++)
			{
				res-=arr[0][i]+arr[1][i];
			}
			out.println(res);
		}
		out.close();
    }
}


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.*;
import java.util.*;
import java.util.LinkedList;
import java.math.*;
import java.lang.*;
import java.util.PriorityQueue;
import static java.lang.Math.*;
@SuppressWarnings("unchecked")
public class solution implements Runnable {
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        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 String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            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 long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long 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 double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            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 readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
	public static int min(int a,int b)
	{
		if(a>b)
		{
			return b;
		}
		return a;
	}
	public static long max(long a,long b)
	{
		if(a>b)
		{
			return a;
		}
		return b;
	}
	static class pair implements Comparable<pair>
	{
		int x;
		int y;
		pair(int x,int y)
		{
			this.x = x;
			this.y = y;
		}
		public int compareTo(pair p)
		{
			if(this.x>p.x)
			{
				return 1;
			}
			else if(this.x<p.x)
			{
				return -1;
			}
			else
			{
				return this.y-p.y;
			}
		}
	}
	public static void main(String args[]) throws Exception {
        new Thread(null, new solution(),"Main",1<<26).start();
    }
	public void run() {
        InputReader sc  = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int t1 = 1;
		while(t1-->0)
		{
			int n = sc.nextInt();
			long[][] arr = new long[2][n];
			for(int j=0;j<2;j++)
			{
				for(int i=0;i<n;i++)
				{
					arr[j][i] = sc.nextInt();
				}
			}
			long[][] suffix1 = new long[2][n+1];
			long[][] suffix2 = new long[2][n+1];
			long[][] sum = new long[2][n+1];
			for(int i=n-1;i>=0;i--)
			{
				suffix1[0][i] = suffix1[0][i+1]+(i+1)*arr[0][i];
				suffix1[1][i] = suffix1[1][i+1]+(i+1)*arr[1][i];
				suffix2[0][i] = suffix2[0][i+1]+(n-i)*arr[0][i];
				suffix2[1][i] = suffix2[1][i+1]+(n-i)*arr[1][i];
				sum[0][i] = sum[0][i+1]+arr[0][i];
				sum[1][i] = sum[1][i+1]+arr[1][i];
			}
			long res = 0;
			long sm = 0;
			int j = 0;
			for(int i=0;i<n;i++)
			{
				long curr = sm;
				curr+=suffix1[j][i]+i*sum[j][i];
				curr+=suffix2[j^1][i]+(i+n)*sum[j^1][i];
				res = max(res,curr);
				sm+=arr[j][i]*(2*i+1);
				sm+=arr[j^1][i]*(2*i+2);
				j = j^1;
			}
			for(int i=0;i<n;i++)
			{
				res-=arr[0][i]+arr[1][i];
			}
			out.println(res);
		}
		out.close();
    }
}


import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * Created by timur on 28.03.15.
 */

public class TaskA {
    boolean eof;
    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;

    public static void main(String[] args) throws IOException {
        new TaskA().run();
    }

    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "-1";
            }
        }
        return st.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() {
        return Long.parseLong(nextToken());
    }

    double nextDouble() {
        return Double.parseDouble(nextToken());
    }

    String nextLine() throws IOException {
        return br.readLine();
    }

    void run() throws IOException {
        InputStream input = System.in;
        PrintStream output = System.out;
        try {
            File f = new File("a.in");
            if (f.exists() && f.canRead()) {
                input = new FileInputStream(f);
                output = new PrintStream("a.out");
            }
        } catch (Throwable e) {
        }
        br = new BufferedReader(new InputStreamReader(input));
        out = new PrintWriter(output);
        solve();
        br.close();
        out.close();
    }

    static int[] getZFunction(String s) {
        int[] z = new int[s.length()];
        z[0] = 0;
        int l = 0;
        int r = 0;
        for (int i = 1; i < s.length(); i++) {
            z[i] = i >= r ? 0 : Math.min(z[i - l], r - i);
            while (z[i] + i < s.length()
                && s.charAt(z[i]) == s.charAt(i + z[i])) {
                z[i]++;
            }
            if (i + z[i] > r) {
                r = i + z[i];
                l = i;
            }
        }
        return z;
    }
    static int[] getPrefixFunction(String s) {
        int k = -1;
        int[] p = new int[s.length()];
        p[0] = -1;
        for (int i = 1; i < s.length(); i++) {
            while (k > -1 && s.charAt(i) != s.charAt(k + 1)) {
                k = p[k];
            }
            if (s.charAt(i) == s.charAt(k + 1)) {
                k++;
            }
            p[i] = k;
        }
        return p;
    }

    static int[] getZFunctionDumb(String s) {
        int[] z = new int[s.length()];
        z[0] = 0;
        for (int i = 1; i < s.length(); i++) {
            while (z[i] + i < s.length()
                && s.charAt(z[i]) == s.charAt(i + z[i])) {
                z[i]++;
            }
        }
        return z;
    }

    void solve() {
        int n = nextInt();
        long[] a = new long[n], b = new long[n], se = new long[n], st = new long[n], sb = new long[n];
        for (int i = 0; i< n; i++) {
            a[i] = nextLong();
        }
        for (int i = 0; i< n; i++) {
            b[i] = nextLong();
        }
        long cv = 0;

        se[n - 1] = a[n - 1] + b[ n - 1];
        for (int i = n - 2; i > -1; i--) {
            se[i] = a[i] + b[i] + se[i + 1];
        }

        st[n - 1] = b[n - 1];
        for (int i = n - 2; i > -1; i--) {
            long t = n - i;
            st[i] = st[i + 1] + se[i + 1] + b[i] * (t * 2 - 1);
        }

        sb[n - 1] = a[n - 1];
        for (int i = n - 2; i > -1; i--) {
            long t = n - i;
            sb[i] = sb[i + 1] + se[i + 1] + a[i] * (t * 2 - 1);
        }

        long maxAns = st[0];
        long ll = 0, ts = 0;
        for (int i = 1; i < n; i++) {
            ll += a[i - 1] * ts;
            ll += b[i - 1] * ts;
            if (i % 2 == 0) {
                ll += a[i - 1];
            } else {
                ll += b[i - 1];
            }
            ts += 2;
            if (i % 2 == 0) {
                //top
                maxAns = Math.max(maxAns, st[i] + ll + se[i] * ts);
            } else {
                //bot
                maxAns = Math.max(maxAns, sb[i] + ll + se[i] * ts);
            }

        }
        out.print(maxAns);
    }
}


import java.util.Scanner;

public class Mushroom {

    public static void main(String[] args) {
        /*
        1 2 3 4 5
        6 7 8 9 10

        [
         */

        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[][] grid = new int[2][n];
        for (int row = 0; row < 2; row++) {
            for (int i = 0; i < n; i++) {
                grid[row][i] = in.nextInt();
            }
        }

        long[][] sum = new long[2][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                sum[row][i] += grid[row][i] + sum[row][i + 1];
            }
        }

        long[][] l2r = new long[2][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                l2r[row][i] += l2r[row][i + 1] + sum[row][i + 1];
            }
        }

        long[][] r2l = new long[2][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                r2l[row][i] += grid[row][i] * (n - 1 - i) + r2l[row][i + 1];
            }
        }

        long best = 0;
        long zigZag = 0;
        for (int col = 0; col < n; col++) {
            long score = 0;
            if (col % 2 == 0) { // top to bottom
                long topSeg = l2r[0][col];
                long botSeg = (n - col) * sum[1][col] + r2l[1][col];
                score = zigZag + col * 2 * (sum[0][col] + sum[1][col]) + (topSeg + botSeg);
                zigZag += grid[0][col] * col * 2 + grid[1][col] * (col * 2 + 1);
            } else { // bottom to top
                long botSeg = l2r[1][col];
                long topSeg = (n - col) * sum[0][col] + r2l[0][col];
                score = zigZag + col * 2 * (sum[0][col] + sum[1][col]) + (topSeg + botSeg);
                zigZag += grid[1][col] * (col * 2) + grid[0][col] * (col * 2 + 1);
            }

            best = Math.max(best, score);
        }

        System.out.println(best);
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class Mushroom {

    static void pa(long[][] a) {
        System.out.println(Arrays.deepToString(a));
    }
    public static void main(String[] args) {
        /*
        1 2 3 4 5
        6 7 8 9 10

        [
         */

        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long[][] grid = new long[2][n];
        for (int row = 0; row < 2; row++) {
            for (int i = 0; i < n; i++) {
                grid[row][i] = in.nextInt();
            }
        }

        //pa(grid);

        long[][] sum = new long[2][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                sum[row][i] += grid[row][i] + sum[row][i + 1];
            }
        }

        //pa(sum);
        long[][] l2r = new long[2][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                l2r[row][i] += l2r[row][i + 1] + sum[row][i + 1];
            }
        }

        long[][] r2l = new long[2][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                r2l[row][i] += grid[row][i] * (n - 1 - i) + r2l[row][i + 1];
            }
        }
        //pa(l2r);
        //pa(r2l);
        long best = 0L;
        long zigZag = 0L;
        for (int col = 0; col < n; col++) {
            long score = 0L;
            if (col % 2 == 0) { // top to bottom
                long topSeg = l2r[0][col];
                long botSeg = 1L * (n - col) * sum[1][col] + r2l[1][col];
                score = zigZag + col * 2 * (sum[0][col] + sum[1][col]) + (topSeg + botSeg);
                zigZag += grid[0][col] * col * 2 + grid[1][col] * (col * 2 + 1);
            } else { // bottom to top
                long botSeg = l2r[1][col];
                long topSeg = 1L * (n - col) * sum[0][col] + r2l[0][col];
                score = zigZag + 1L * col * 2 * (sum[0][col] + sum[1][col]) + (topSeg + botSeg);
                zigZag += 1L * grid[1][col] * (col * 2) + 1L * grid[0][col] * (col * 2 + 1);
            }

            best = Math.max(best, score);
        }
        best = Math.max(best, zigZag);
        System.out.println(best);
    }
}


import java.util.Scanner;

public class Mushroom {

    public static void main(String[] args) {
        /*
        1 2 3 4 5
        6 7 8 9 10

        [
         */

        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[][] grid = new int[n][n];
        for (int row = 0; row < 2; row++) {
            for (int i = 0; i < n; i++) {
                grid[row][i] = in.nextInt();
            }
        }

        int[][] sum = new int[n + 1][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                sum[row][i] += grid[row][i] + sum[row][i + 1];
            }
        }

        long[][] l2r = new long[n + 1][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                l2r[row][i] += l2r[row][i + 1] + sum[row][i + 1];
            }
        }

        long[][] r2l = new long[n + 1][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                r2l[row][i] += grid[row][i] * (n - 1 - i) + r2l[row][i + 1];
            }
        }

        long best = 0;
        long zigZag = 0;
        for (int col = 0; col < n; col++) {
            long score = 0;
            if (col % 2 == 0) { // top to bottom
                long topSeg = l2r[0][col];
                long botSeg = (n - col) * sum[1][col] + r2l[1][col];
                score = zigZag + col * 2 * (sum[0][col] + sum[1][col]) + (topSeg + botSeg);
                zigZag += grid[0][col] * col * 2 + grid[1][col] * (col * 2 + 1);
            } else { // bottom to top
                long botSeg = l2r[1][col];
                long topSeg = (n - col) * sum[0][col] + r2l[0][col];
                score = zigZag + col * 2 * (sum[0][col] + sum[1][col]) + (topSeg + botSeg);
                zigZag += grid[1][col] * (col * 2) + grid[0][col] * (col * 2 + 1);
            }

            best = Math.max(best, score);
        }

        System.out.println(best);
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class Mushroom {

    static void pa(long[][] a) {
        System.out.println(Arrays.deepToString(a));
    }
    public static void main(String[] args) {
        /*
        1 2 3 4 5
        6 7 8 9 10

        [
         */

        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long[][] grid = new long[2][n];
        for (int row = 0; row < 2; row++) {
            for (int i = 0; i < n; i++) {
                grid[row][i] = in.nextInt();
            }
        }

        //pa(grid);

        long[][] sum = new long[2][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                sum[row][i] += grid[row][i] + sum[row][i + 1];
            }
        }

        //pa(sum);
        long[][] l2r = new long[2][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                l2r[row][i] += l2r[row][i + 1] + sum[row][i + 1];
            }
        }

        long[][] r2l = new long[2][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                r2l[row][i] += grid[row][i] * (n - 1 - i) + r2l[row][i + 1];
            }
        }
        //pa(l2r);
        //pa(r2l);
        long best = 0L;
        long zigZag = 0L;
        for (int col = 0; col < n; col++) {
            long score = 0L;
            if (col % 2 == 0) { // top to bottom
                long topSeg = l2r[0][col];
                long botSeg = 1L * (n - col) * sum[1][col] + r2l[1][col];
                score = zigZag + col * 2 * (sum[0][col] + sum[1][col]) + (topSeg + botSeg);
                zigZag += grid[0][col] * col * 2 + grid[1][col] * (col * 2 + 1);
            } else { // bottom to top
                long botSeg = l2r[1][col];
                long topSeg = 1L * (n - col) * sum[0][col] + r2l[0][col];
                score = zigZag + 1L * col * 2 * (sum[0][col] + sum[1][col]) + (topSeg + botSeg);
                zigZag += 1L * grid[1][col] * (col * 2) + 1L * grid[0][col] * (col * 2 + 1);
            }

            best = Math.max(best, score);
        }
        System.out.println(best);
    }
}


import java.util.Scanner;

public class Mushroom {

    public static void main(String[] args) {
        /*
        1 2 3 4 5
        6 7 8 9 10

        [
         */

        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[][] grid = new int[2][n];
        for (int row = 0; row < 2; row++) {
            for (int i = 0; i < n; i++) {
                grid[row][i] = in.nextInt();
            }
        }

        int[][] sum = new int[n + 1][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                sum[row][i] += grid[row][i] + sum[row][i + 1];
            }
        }

        long[][] l2r = new long[n + 1][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                l2r[row][i] += l2r[row][i + 1] + sum[row][i + 1];
            }
        }

        long[][] r2l = new long[n + 1][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                r2l[row][i] += grid[row][i] * (n - 1 - i) + r2l[row][i + 1];
            }
        }

        long best = 0;
        long zigZag = 0;
        for (int col = 0; col < n; col++) {
            long score = 0;
            if (col % 2 == 0) { // top to bottom
                long topSeg = l2r[0][col];
                long botSeg = (n - col) * sum[1][col] + r2l[1][col];
                score = zigZag + col * 2 * (sum[0][col] + sum[1][col]) + (topSeg + botSeg);
                zigZag += grid[0][col] * col * 2 + grid[1][col] * (col * 2 + 1);
            } else { // bottom to top
                long botSeg = l2r[1][col];
                long topSeg = (n - col) * sum[0][col] + r2l[0][col];
                score = zigZag + col * 2 * (sum[0][col] + sum[1][col]) + (topSeg + botSeg);
                zigZag += grid[1][col] * (col * 2) + grid[0][col] * (col * 2 + 1);
            }

            best = Math.max(best, score);
        }

        System.out.println(best);
    }
}


import java.util.Scanner;

public class Mushroom {

    public static void main(String[] args) {
        /*
        1 2 3 4 5
        6 7 8 9 10

        [
         */

        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[][] grid = new int[2][n];
        for (int row = 0; row < 2; row++) {
            for (int i = 0; i < n; i++) {
                grid[row][i] = in.nextInt();
            }
        }

        int[][] sum = new int[2][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                sum[row][i] += grid[row][i] + sum[row][i + 1];
            }
        }

        long[][] l2r = new long[2][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                l2r[row][i] += l2r[row][i + 1] + sum[row][i + 1];
            }
        }

        long[][] r2l = new long[2][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int row = 0; row < 2; row++) {
                r2l[row][i] += grid[row][i] * (n - 1 - i) + r2l[row][i + 1];
            }
        }

        long best = 0;
        long zigZag = 0;
        for (int col = 0; col < n; col++) {
            long score = 0;
            if (col % 2 == 0) { // top to bottom
                long topSeg = l2r[0][col];
                long botSeg = (n - col) * sum[1][col] + r2l[1][col];
                score = zigZag + col * 2 * (sum[0][col] + sum[1][col]) + (topSeg + botSeg);
                zigZag += grid[0][col] * col * 2 + grid[1][col] * (col * 2 + 1);
            } else { // bottom to top
                long botSeg = l2r[1][col];
                long topSeg = (n - col) * sum[0][col] + r2l[0][col];
                score = zigZag + col * 2 * (sum[0][col] + sum[1][col]) + (topSeg + botSeg);
                zigZag += grid[1][col] * (col * 2) + grid[0][col] * (col * 2 + 1);
            }

            best = Math.max(best, score);
        }

        System.out.println(best);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class VasyaAndMushshroom {

	//UPSOLVE
	final static int max = 300010;

	public static void main(String[] args) throws IOException {

		long a[] = new long[max];
		long b[] = new long[max];
		long suf[] = new long[max];
		long f1[] = new long[max];
		long f2[] = new long[max];
		int n;
		long ans = 0;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		n = Integer.parseInt(st.nextToken());

		StringTokenizer st1 = new StringTokenizer(br.readLine());
		for (int i = 1; i <= n; ++ i) {
			a[i] = Long.parseLong(st1.nextToken());
		}

		StringTokenizer st2 = new StringTokenizer(br.readLine());
		for (int i = 1; i <= n; ++ i) {
			b[i] = Long.parseLong(st2.nextToken());
		}

		for (int i = n; i >= 1; -- i) {
			suf[i] = suf[i + 1] + a[i] + b[i];
		}
		f1[n] = (a[n] * (2 * n -1) + b[n] * 2 * n);
		f2[n] = (a[n] * (2L * n)) + b[n] * (2L * n - 1);

		for (int i = n - 1; i >= 1; -- i) {
			f1[i] = f1[i + 1] - suf[i + 1] + 2l * n * b[i] + (2L * i - 1L) * a[i];
			f2[i] = f2[i + 1] - suf[i + 1] + 2L * n * a[i] + (2L * i - 1L) * b[i];
		}

		long ret = 0;
		for (int i = 1; i <= n + 1; ++ i) {
			if ((i & 1) == 1) {
				ans = Math.max(ans, ret + f1[i]);
			} else {
				ans = Math.max(ans, ret + f2[i]);
			}
			ret += ((i & 1) == 1) ? (2L * i - 1) * a[i] + (2L * i) * b[i] : (2L * i - 1) * b[i] + (2L * i) * a[i];
		}
		System.out.println(ans - suf[1]);

	}

}


import java.util.*;
import java.io.*;

		public class codeforces
		{
			public static void main(String[] args)
			{
				InputReader in = new InputReader(System.in);
				PrintWriter pw = new PrintWriter(System.out);

				int n = in.nextInt();
				long[] a = new long[n];
				long[] b = new long[n];

				for(int i=0;i<n;i++)
					a[i] = in.nextLong();

				for(int i=0;i<n;i++)
					b[i] = in.nextLong();

				long[] T = new long[2*n];
				long[] B = new long[2*n-2];
				long[] Z = new long[2*n];
				long[] Tsum = new long[2*n];
				long[] Bsum = new long[2*n-2];
				int j = 0;
				long max = Long.MIN_VALUE, sum = 0;

				if(n == 1)
					max = b[0];
				else
				{
					for(int i=0;i<2*n;i++)
					{
						if(i<n)
							T[i] = a[i];
						else
							T[i] = b[2*n-i-1];

						if(i>0 && i<2*n-1)
						{
							if(i<n)
								B[i-1] = b[i];
							else
								B[i-1] = a[2*n-i-1];
						}

						if(i%4==0)
							Z[i] = a[j];
						else if(i%4==1)
						{
							Z[i] = b[j];
							j++;
						}
						else if(i%4==2)
							Z[i] = b[j];
						else
						{
							Z[i] = a[j];
							j++;
						}
					}

					Tsum = Arrays.copyOf(T, 2*n);
					Bsum = Arrays.copyOf(B, 2*n-2);

					for(int i=0;i<2*n;i++)
					{
						if(i==0)
						{
							T[i] = 0;
							Z[i] = 0;
							B[i] = 0;
						}
						else
						{
							Tsum[i] += Tsum[i-1];
							T[i] = i*T[i] + T[i-1];
							Z[i] = i*Z[i] + Z[i-1];

							if(i<2*n-2)
							{
								Bsum[i] += Bsum[i-1];
								B[i] = i*B[i] + B[i-1];
							}
						}
					}

					for(int i=0;i<n+1;i++)
					{
						if(i==0)
						{
							sum = T[2*n-1];
						}
						else if(i==1)
						{
							sum = Z[i] + B[2*n-3] + (i+1)*Bsum[2*n-3];
						}
						else
						{
							sum = Z[2*i-1];

							if(i%2!=0)
							{
								sum += B[2*n-i-2] - B[i-2] + (i+1)*(Bsum[2*n-i-2] - Bsum[i-2]);
							}
							else
							{
								sum += T[2*n-i-1] - T[i-1] + i*(Tsum[2*n-i-1] - Tsum[i-1]);
							}
						}
						//pw.println(sum);
						max = Math.max(max, sum);
						sum = 0;

					}
				}

				pw.println(max);
				/*for(int i=0;i<2*n;i++)
					pw.print(T[i]+" ");

pw.println();
				for(int i=0;i<2*n-2;i++)
					pw.print(Bsum[i]+" ");

pw.println();
				for(int i=0;i<2*n;i++)
					pw.print(Z[i]+" ");*/

				pw.flush();
				pw.close();
			}

			static class pair implements Comparable<pair>
			{
				Integer x, y;
				pair(int x,int y)
				{
					this.x=x;
					this.y=y;
				}

				public int compareTo(pair o) {
					int result = x.compareTo(o.x);
					if(result==0)
						result = y.compareTo(o.y);

					return result;
				}

				public String toString()
				{
					return x+" "+y;
				}

				public boolean equals(Object o)
				{
					if (o instanceof pair)
				    {
						pair p = (pair)o;
						return p.x == x && p.y == y ;
					}
					return false;
				}

				public int hashCode()
				{
					return new Long(x).hashCode()*31 + new Long(y).hashCode();
				}
			}

			static class InputReader
			{

				private final InputStream stream;
				private final byte[] buf = new byte[8192];
				private int curChar, snumChars;
				private SpaceCharFilter filter;

				public InputReader(InputStream stream)
				{
					this.stream = stream;
				}

				public int snext()
				{
					if (snumChars == -1)
						throw new InputMismatchException();
					if (curChar >= snumChars)
					{
						curChar = 0;
						try
						{
							snumChars = stream.read(buf);
						}
						catch (IOException e)
						{
							throw new InputMismatchException();
						}
						if (snumChars <= 0)
							return -1;
					}
					return buf[curChar++];
				}

				public int nextInt()
			    {
					int c = snext();
					while (isSpaceChar(c))
					{
						c = snext();
					}
					int sgn = 1;
					if (c == '-')
				    {
						sgn = -1;
						c = snext();
					}
					int res = 0;
					do
					{
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						res *= 10;
						res += c - '0';
						c = snext();
					} while (!isSpaceChar(c));
					return res * sgn;
				}

				public long nextLong()
			    {
					int c = snext();
					while (isSpaceChar(c))
					{
						c = snext();
					}
					int sgn = 1;
					if (c == '-')
					{
						sgn = -1;
						c = snext();
					}
					long res = 0;
					do
					{
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						res *= 10;
						res += c - '0';
						c = snext();
					} while (!isSpaceChar(c));
					return res * sgn;
				}

				public int[] nextIntArray(int n)
				{
					int a[] = new int[n];
					for (int i = 0; i < n; i++)
					{
						a[i] = nextInt();
					}
					return a;
				}

				public String readString()
			    {
					int c = snext();
					while (isSpaceChar(c))
					{
						c = snext();
					}
					StringBuilder res = new StringBuilder();
					do
					{
						res.appendCodePoint(c);
						c = snext();
					} while (!isSpaceChar(c));
					return res.toString();
				}

				public String nextLine()
				{
					int c = snext();
					while (isSpaceChar(c))
						c = snext();
					StringBuilder res = new StringBuilder();
					do
					{
						res.appendCodePoint(c);
						c = snext();
					} while (!isEndOfLine(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;
				}

				private boolean isEndOfLine(int c)
				{
					return c == '\n' || c == '\r' || c == -1;
				}

				public interface SpaceCharFilter
			    {
					public boolean isSpaceChar(int ch);
				}
			}

			static class CodeX {
	        public static void sort(long arr[]) {
	            merge_sort(arr, 0, arr.length - 1);
	        }

	        private static void merge_sort(long A[], long start, long end) {
	            if (start < end) {
	                long mid = (start + end) / 2;
	                merge_sort(A, start, mid);
	                merge_sort(A, mid + 1, end);
	                merge(A, start, mid, end);
	            }

	        }

	        private static void merge(long A[], long start,long mid, long end) {
	            long p = start, q = mid + 1;
	            long Arr[] = new long[(int)(end - start + 1)];
	            long k = 0;

	            for (int i = (int)start; i <= end; i++) {
	                if (p > mid)
	                    Arr[(int)k++] = A[(int)q++];

	                else if (q > end)
	                    Arr[(int)k++] = A[(int)p++];

	                else if (A[(int)p] < A[(int)q])
	                    Arr[(int)k++] = A[(int)p++];

	                else
	                    Arr[(int)k++] = A[(int)q++];
	            }
	            for (int i = 0; i < k; i++) {
	                A[(int)start++] = Arr[i];
	            }

	        }

	    }
		}


import java.util.*;
import java.io.*;

		public class codeforces
		{
			public static void main(String[] args)
			{
				InputReader in = new InputReader(System.in);
				PrintWriter pw = new PrintWriter(System.out);

				int n = in.nextInt();
				long[] a = new long[n];
				long[] b = new long[n];

				for(int i=0;i<n;i++)
					a[i] = in.nextLong();

				for(int i=0;i<n;i++)
					b[i] = in.nextLong();

				long[] T = new long[2*n];
				long[] B = new long[2*n-2];
				long[] Z = new long[2*n];
				long[] Tsum = new long[2*n];
				long[] Bsum = new long[2*n-2];
				int j = 0;
				long max = Long.MIN_VALUE, sum = 0;

				for(int i=0;i<2*n;i++)
				{
					if(i<n)
						T[i] = a[i];
					else
						T[i] = b[2*n-i-1];

					if(i>0 && i<2*n-1)
					{
						if(i<n)
							B[i-1] = b[i];
						else
							B[i-1] = a[2*n-i-1];
					}

					if(i%4==0)
						Z[i] = a[j];
					else if(i%4==1)
					{
						Z[i] = b[j];
						j++;
					}
					else if(i%4==2)
						Z[i] = b[j];
					else
					{
						Z[i] = a[j];
						j++;
					}
				}

				Tsum = Arrays.copyOf(T, 2*n);
				Bsum = Arrays.copyOf(B, 2*n-2);

				for(int i=0;i<2*n;i++)
				{
					if(i==0)
					{
						T[i] = 0;
						Z[i] = 0;
						B[i] = 0;
					}
					else
					{
						Tsum[i] += Tsum[i-1];
						T[i] = i*T[i] + T[i-1];
						Z[i] = i*Z[i] + Z[i-1];

						if(i<2*n-2)
						{
							Bsum[i] += Bsum[i-1];
							B[i] = i*B[i] + B[i-1];
						}
					}
				}

				for(int i=0;i<n+1;i++)
				{
					if(i==0)
					{
						sum = T[2*n-1];
					}
					else if(i==1)
					{
						sum = Z[i] + B[2*n-3] + (i+1)*Bsum[2*n-3];
					}
					else
					{
						sum = Z[2*i-1];

						if(i%2!=0)
						{
							sum += B[2*n-i-2] - B[i-2] + (i+1)*(Bsum[2*n-i-2] - Bsum[i-2]);
						}
						else
						{
							sum += T[2*n-i-1] - T[i-1] + i*(Tsum[2*n-i-1] - Tsum[i-1]);
						}
					}
					//pw.println(sum);
					max = Math.max(max, sum);
					sum = 0;

				}

				pw.println(max);
				/*for(int i=0;i<2*n;i++)
					pw.print(T[i]+" ");

pw.println();
				for(int i=0;i<2*n-2;i++)
					pw.print(Bsum[i]+" ");

pw.println();
				for(int i=0;i<2*n;i++)
					pw.print(Z[i]+" ");*/

				pw.flush();
				pw.close();
			}

			static class pair implements Comparable<pair>
			{
				Integer x, y;
				pair(int x,int y)
				{
					this.x=x;
					this.y=y;
				}

				public int compareTo(pair o) {
					int result = x.compareTo(o.x);
					if(result==0)
						result = y.compareTo(o.y);

					return result;
				}

				public String toString()
				{
					return x+" "+y;
				}

				public boolean equals(Object o)
				{
					if (o instanceof pair)
				    {
						pair p = (pair)o;
						return p.x == x && p.y == y ;
					}
					return false;
				}

				public int hashCode()
				{
					return new Long(x).hashCode()*31 + new Long(y).hashCode();
				}
			}

			static class InputReader
			{

				private final InputStream stream;
				private final byte[] buf = new byte[8192];
				private int curChar, snumChars;
				private SpaceCharFilter filter;

				public InputReader(InputStream stream)
				{
					this.stream = stream;
				}

				public int snext()
				{
					if (snumChars == -1)
						throw new InputMismatchException();
					if (curChar >= snumChars)
					{
						curChar = 0;
						try
						{
							snumChars = stream.read(buf);
						}
						catch (IOException e)
						{
							throw new InputMismatchException();
						}
						if (snumChars <= 0)
							return -1;
					}
					return buf[curChar++];
				}

				public int nextInt()
			    {
					int c = snext();
					while (isSpaceChar(c))
					{
						c = snext();
					}
					int sgn = 1;
					if (c == '-')
				    {
						sgn = -1;
						c = snext();
					}
					int res = 0;
					do
					{
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						res *= 10;
						res += c - '0';
						c = snext();
					} while (!isSpaceChar(c));
					return res * sgn;
				}

				public long nextLong()
			    {
					int c = snext();
					while (isSpaceChar(c))
					{
						c = snext();
					}
					int sgn = 1;
					if (c == '-')
					{
						sgn = -1;
						c = snext();
					}
					long res = 0;
					do
					{
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						res *= 10;
						res += c - '0';
						c = snext();
					} while (!isSpaceChar(c));
					return res * sgn;
				}

				public int[] nextIntArray(int n)
				{
					int a[] = new int[n];
					for (int i = 0; i < n; i++)
					{
						a[i] = nextInt();
					}
					return a;
				}

				public String readString()
			    {
					int c = snext();
					while (isSpaceChar(c))
					{
						c = snext();
					}
					StringBuilder res = new StringBuilder();
					do
					{
						res.appendCodePoint(c);
						c = snext();
					} while (!isSpaceChar(c));
					return res.toString();
				}

				public String nextLine()
				{
					int c = snext();
					while (isSpaceChar(c))
						c = snext();
					StringBuilder res = new StringBuilder();
					do
					{
						res.appendCodePoint(c);
						c = snext();
					} while (!isEndOfLine(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;
				}

				private boolean isEndOfLine(int c)
				{
					return c == '\n' || c == '\r' || c == -1;
				}

				public interface SpaceCharFilter
			    {
					public boolean isSpaceChar(int ch);
				}
			}

			static class CodeX {
	        public static void sort(long arr[]) {
	            merge_sort(arr, 0, arr.length - 1);
	        }

	        private static void merge_sort(long A[], long start, long end) {
	            if (start < end) {
	                long mid = (start + end) / 2;
	                merge_sort(A, start, mid);
	                merge_sort(A, mid + 1, end);
	                merge(A, start, mid, end);
	            }

	        }

	        private static void merge(long A[], long start,long mid, long end) {
	            long p = start, q = mid + 1;
	            long Arr[] = new long[(int)(end - start + 1)];
	            long k = 0;

	            for (int i = (int)start; i <= end; i++) {
	                if (p > mid)
	                    Arr[(int)k++] = A[(int)q++];

	                else if (q > end)
	                    Arr[(int)k++] = A[(int)p++];

	                else if (A[(int)p] < A[(int)q])
	                    Arr[(int)k++] = A[(int)p++];

	                else
	                    Arr[(int)k++] = A[(int)q++];
	            }
	            for (int i = 0; i < k; i++) {
	                A[(int)start++] = Arr[i];
	            }

	        }

	    }
		}


#include <iostream>
#include <math.h>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
const long double q = 1.618033989;
using namespace std;
int main(){
	char X[111111], Y[111111];
	long long p = 0;
	long double x = 0, y = 0;
	cin >> X;
	cin >> Y;
	for (long long i = strlen(X)-1; i >= 0; i--)
	{
		x = x + ((X[i]-'0') * pow(q, p));
		p++;
		//cout << long double(x) <<" "<<"x"<< endl;
	}
	p = 0;
	for (long long i = strlen(Y) - 1; i >= 0; i--)
	{
		y = y + ((Y[i] - '0') * pow(q, p));
		p++;
		//cout << long double(y)<<" "<<"y"<< endl;
	}
	if (ceil(x) == ceil(y))
	{
		cout << '=' << endl;
	}
	else if (ceil(x) > ceil(y))
	{
		cout << '>' << endl;
	}
	else if (ceil(x) < ceil(y))
	{
		cout << '<' << endl;
	}

	return 0;
}


#include <iostream>
#include <math.h>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
const long double q = 1.618033989;
using namespace std;
int main(){
	char X[7], Y[7];
	short int p = 0;
	long double x = 0, y = 0;
	cin >> X;
	cin >> Y;
	for (short int i = strlen(X)-1; i >= 0; i--)
	{
		x = x + ((X[i]-'0') * pow(q, p));
		p++;
		//cout << long double(x) <<" "<<"x"<< endl;
	}
	p = 0;
	for (short int i = strlen(Y) - 1; i >= 0; i--)
	{
		y = y + ((Y[i] - '0') * pow(q, p));
		p++;
		//cout << long double(y)<<" "<<"y"<< endl;
	}
	if (ceil(x) == ceil(y))
	{
		cout << '=' << endl;
	}
	else if (ceil(x) > ceil(y))
	{
		cout << '>' << endl;
	}
	else if (ceil(x) < ceil(y))
	{
		cout << '<' << endl;
	}

	return 0;
}


#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <string.h>
#include <algorithm>
#include <stdio.h>
using namespace std;
const long double q(1.618033989);
int main()
{
	string X, Y;
	long double Res1 = 0.0, Res2 = 0.0;
	long long j = 0;
	cin >> X >> Y;
	for (long long i = (X.size() - 1); i >= 0; i--)
	{
		if (X[j] == '1')
		{
			Res1 = Res1 + (pow(q, i));
		}
		j++;
	}
	j = 0;
	for (long long i = (Y.size() - 1); i >= 0; i--)
	{
		if (Y[j] == '1')
		{
			Res2 = Res2 + (pow(q, i));
		}
		j++;
	}
	//cout << Res1 << " " << Res2 << endl;
	//cout <<setiosflags<<(ios::fixed)<<(Res1 - Res2) << endl;
	if (int(Res1) == int(Res2))
	{
		cout << "=" << endl;
	}
	else
	{
		if (Res1 > Res2)
		{
			cout << ">" << endl;
		}
		else
		{
			cout << "<" << endl;
		}
	}

	return 0;
}


#include <iostream>
#include <math.h>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
const long double q = 1.618033989;
using namespace std;
int main(){
	char X[111111], Y[111111];
	short int p = 0;
	long double x = 0, y = 0;
	cin >> X;
	cin >> Y;
	for (long long i = strlen(X)-1; i >= 0; i--)
	{
		x = x + ((X[i]-'0') * pow(q, p));
		p++;
		//cout << long double(x) <<" "<<"x"<< endl;
	}
	p = 0;
	for (long long i = strlen(Y) - 1; i >= 0; i--)
	{
		y = y + ((Y[i] - '0') * pow(q, p));
		p++;
		//cout << long double(y)<<" "<<"y"<< endl;
	}
	if (ceil(x) == ceil(y))
	{
		cout << '=' << endl;
	}
	else if (ceil(x) > ceil(y))
	{
		cout << '>' << endl;
	}
	else if (ceil(x) < ceil(y))
	{
		cout << '<' << endl;
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;
const int maxn = 5e5 + 500;
list < int > a , b;
int ta[maxn] , tb[maxn];
char str[maxn];
const double eps = 1e-6;
void input(list < int > & x){
	scanf("%s",str);
	int len = strlen(str);
	for(int i = 0 ; i < len ; ++ i) x.push_back(str[i] - '0');
}

void init(){
	int dis = abs( (int)a.size() - (int)b.size() );
	list < int > * f;
	if((int)a.size() < (int)b.size()) f = &a;
	else f = &b;
	for(int i = 0 ; i < dis ; ++ i) f->push_front(0);
}

void read(list < int > & x , int * arr){
	list < int > :: iterator it = x.end();it--;
	int ptr = 0;
	while(1){
		int end = 0 ;
		if(it == x.begin()) end=1;
		arr[ptr++] = *it;
		if(end) break;
		else it--;
	}
}

int solve(){
	for(int i = 2e5 ; i >= 2 ; -- i){
		if(ta[i] == tb[i]) continue;
		int * big = &ta[i] , * small = &tb[i];
		if(ta[i] < tb[i]) swap( big , small );
		if(*big - *small >= 2){
			if( big == ta ) return 1;
			else return -1;
		}else{
			int loss = *big - *small;
			big -- , *big+=loss , big -- ,*big+=loss;
		}
	}
	double p = (1 + sqrt(5)) / 2.0;
	double up = ta[0] + ta[1] * p;
	double down = tb[0] + tb[1] * p;
	if(fabs(up - down) <= eps) return 0;
	else if(up > down) return 1;
	return -1;
}

int main(int argc,char *argv[]){
	input(a);input(b);
	init();
	read(a , ta);
	read(b , tb);
	int res = solve();
	if(res==1)printf(">\n");
	else if(res==0) printf("=\n");
	else printf("<\n");
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
const int maxn = 5e5 + 500;
list < int > a , b;
int ta[maxn] , tb[maxn];
char str[maxn];
const double eps = 1e-6;
void input(list < int > & x){
	scanf("%s",str);
	int len = strlen(str);
	for(int i = 0 ; i < len ; ++ i) x.push_back(str[i] - '0');
}

void init(){
	int dis = abs( (int)a.size() - (int)b.size() );
	list < int > * f;
	if((int)a.size() < (int)b.size()) f = &a;
	else f = &b;
	for(int i = 0 ; i < dis ; ++ i) f->push_front(0);
}

void read(list < int > & x , int * arr){
	list < int > :: iterator it = x.end();it--;
	int ptr = 0;
	while(1){
		int end = 0 ;
		if(it == x.begin()) end=1;
		arr[ptr++] = *it;
		if(end) break;
		else it--;
	}
}

int solve(){
	for(int i = 2e5 ; i >= 2 ; -- i){
		if(ta[i] == tb[i]) continue;
		int * big = &ta[i] , * small = &tb[i];
		if(ta[i] < tb[i]) swap( big , small );
		if(*big - *small >= 2){
			if( big == ta + i ) return 1;
			else return -1;
		}else{
			int loss = *big - *small;
			big -- , *big+=loss , big -- ,*big+=loss;
		}
	}
	double p = (1 + sqrt(5)) / 2.0;
	double up = ta[0] + ta[1] * p;
	double down = tb[0] + tb[1] * p;
	if(fabs(up - down) <= eps) return 0;
	else if(up > down) return 1;
	return -1;
}

int main(int argc,char *argv[]){
	input(a);input(b);
	init();
	read(a , ta);
	read(b , tb);
	int res = solve();
	if(res==1)printf(">\n");
	else if(res==0) printf("=\n");
	else printf("<\n");
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define sz(a) (int)a.size()

typedef long long ll;
typedef vector <int> vi;

const int inf = (int)1e9 + 7;
const int N = (int)2e5 + 20;
const int M = 5001;

int a[2][N];

int main() {
#ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
#endif
   string s[2];
   cin >> s[0] >> s[1];
   for (int i = 0; i < 2; ++i) {
      for (int j = sz(s[i]) - 1; j >= 0; --j) {
         a[i][sz(s[i]) - 1 - j] = s[i][j] - '0';
      }
   }
   for (int i = 0; i < 2; ++i) {
      for (int j = N - 20; j >= 0; --j) {
         if (a[i][j] == 1 && a[i][j + 1] == 1) {
            a[i][j]--;
            a[i][j + 1]--;
            a[i][j + 2]++;
            j += 3;
         }
      }
   }
   for (int i = N - 1; i >= 0; i--) {
      if (a[0][i] > a[1][i]) {
         cout << '>';
         return 0;
      }
      if (a[1][i] > a[0][i]) {
         cout << '<';
         return 0;
      }
   }
   cout << '=';
   return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define sz(a) (int)a.size()

typedef long long ll;
typedef vector <int> vi;

const int inf = (int)1e9 + 7;
const int N = (int)2e5 + 20;
const int M = 5001;

int a[2][N];

int main() {
#ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
#endif
   string s[2];
   cin >> s[0] >> s[1];
   for (int i = 0; i < 2; ++i) {
      for (int j = sz(s[i]) - 1; j >= 0; --j) {
         a[i][sz(s[i]) - 1 - j] = s[i][j] - '0';
      }
   }
   for (int i = 0; i < 2; ++i) {
      for (int j = N - 3; j >= 0; --j) {
         if (a[i][j] == 1 && a[i][j + 1] == 1) {
            a[i][j]--;
            a[i][j + 1]--;
            a[i][j + 2]++;
         }
      }
   }
   for (int i = N - 1; i >= 0; i--) {
      if (a[0][i] > a[1][i]) {
         cout << '>';
         return 0;
      }
      if (a[1][i] > a[0][i]) {
         cout << '<';
         return 0;
      }
   }
   cout << '=';
   return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define sz(a) (int)a.size()

typedef long long ll;
typedef vector <int> vi;

const int inf = (int)1e9 + 7;
const int N = (int)1e5 + 20;
const int M = 5001;

int a[2][N];

int main() {
#ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
#endif
   string s[2];
   cin >> s[0] >> s[1];
   for (int i = 0; i < 2; ++i) {
      reverse(s[i].begin(), s[i].end());
      for (int j = 1; j < sz(s[i]); ++j) {
         if (s[i][j] == '1' && s[i][j - 1] == '1') {
            if (j == sz(s[i]) - 1) {
               s[i].push_back('1');
            } else {
               s[i][j + 1]++;
            }
            s[i][j]--;
            s[i][j - 1]--;
         }
      }
      for (; sz(s[i]) > 1 && s[i][sz(s[i]) - 1] == '0';) {
         s[i].erase(sz(s[i]) - 1, 1);
      }
      reverse(s[i].begin(), s[i].end());
   }
   if (s[0] < s[1]) {
      cout << '<';
   }
   if (s[0] == s[1]) {
      cout << '=';
   }
   if (s[0] > s[1]) {
      cout << '>';
   }
   return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define sz(a) (int)a.size()

typedef long long ll;
typedef vector <int> vi;

const int inf = (int)1e9 + 7;
const int N = (int)1e5 + 20;
const int M = 5001;

int a[2][N];

int main() {
#ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
#endif
   string s[2];
   cin >> s[0] >> s[1];
   for (int i = 0; i < 2; ++i) {
      reverse(s[i].begin(), s[i].end());
      for (int j = 1; j < sz(s[i]); ++j) {
         if (s[i][j] == '1' && s[i][j - 1] == '1') {
            if (j == sz(s[i]) - 1) {
               s[i].push_back('1');
            } else {
               s[i][j + 1]++;
            }
            s[i][j]--;
            s[i][j - 1]--;
         }
      }
      for (; sz(s[i]) > 1 && s[i][sz(s[i]) - 1] == '0';) {
         s[i].erase(sz(s[i]) - 1, 1);
      }
   }
   for (int i = 0; i < 2; ++i) {
      for (; sz(s[i]) < sz(s[1 - i]); ) {
         s[i].push_back('0');
      }
   }
   for (int i = 0; i < 2; ++i) {
      reverse(s[i].begin(), s[i].end());
   }
   if (s[0] < s[1]) {
      cout << '<';
   }
   if (s[0] == s[1]) {
      cout << '=';
   }
   if (s[0] > s[1]) {
      cout << '>';
   }
   return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define sz(a) (int)a.size()

typedef long long ll;
typedef vector <int> vi;

const int inf = (int)1e9 + 7;
const int N = (int)1e5 + 20;
const int M = 5001;

int a[2][N];

int main() {
#ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
#endif
   string s[2];
   cin >> s[0] >> s[1];
   for (int i = 0; i < 2; ++i) {
      for (int j = 1; j < sz(s[i]); ++j) {
         if (s[i][j] == '1' && s[i][j - 1] == '1') {
            if (j == sz(s[i]) - 1) {
               s[i].push_back('1');
            } else {
               s[i][j + 1]++;
            }
            s[i][j]--;
            s[i][j - 1]--;
         }
      }
   }
   if (s[0] < s[1]) {
      cout << '<';
   }
   if (s[0] == s[1]) {
      cout << '=';
   }
   if (s[0] > s[1]) {
      cout << '>';
   }
   return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define sz(a) (int)a.size()

typedef long long ll;
typedef vector <int> vi;

const int inf = (int)1e9 + 7;
const int N = (int)1e5 + 20;
const int M = 5001;

int a[2][N];

int main() {
#ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
#endif
   string s[2];
   cin >> s[0] >> s[1];
   for (int i = 0; i < 2; ++i) {
      reverse(s[i].begin(), s[i].end());
      for (int j = 1; j < sz(s[i]); ++j) {
         if (s[i][j] == '1' && s[i][j - 1] == '1') {
            if (j == sz(s[i]) - 1) {
               s[i].push_back('1');
            } else {
               s[i][j + 1]++;
            }
            s[i][j]--;
            s[i][j - 1]--;
         }
      }
      reverse(s[i].begin(), s[i].end());
   }
   if (s[0] < s[1]) {
      cout << '<';
   }
   if (s[0] == s[1]) {
      cout << '=';
   }
   if (s[0] > s[1]) {
      cout << '>';
   }
   return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define sz(a) (int)a.size()

typedef long long ll;
typedef vector <int> vi;

const int inf = (int)1e9 + 7;
const int N = (int)1e5 + 20;
const int M = 5001;

int a[2][N];

int main() {
#ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
#endif
   string s[2];
   cin >> s[0] >> s[1];
   for (int i = 0; i < 2; ++i) {
      for (int j = sz(s[i]) - 1; j >= 0; --j) {
         a[i][sz(s[i]) - 1 - j] = s[i][j] - '0';
      }
   }
   for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < N - 2; ++j) {
         if (a[i][j] == 1 && a[i][j + 1] == 1) {
            a[i][j]--;
            a[i][j + 1]--;
            a[i][j + 2]++;
         }
      }
   }
   for (int i = N - 1; i >= 0; --i) {
      if (a[0][i] > a[1][i]) {
         cout << '>';
         return 0;
      }
      if (a[0][i] < a[1][i]) {
         cout << '<';
         return 0;
      }
   }
   cout << '=';
   return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define sz(a) (int)a.size()

typedef long long ll;
typedef vector <int> vi;

const int inf = (int)1e9 + 7;
const int N = (int)1e5 + 20;
const int M = 5001;

double a[2][N];

int main() {
#ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
#endif
   string s[2];
   cin >> s[0] >> s[1];
   for (int i = 0; i < 2; ++i) {
      for (int j = sz(s[i]) - 1; j >= 0; --j) {
         a[i][sz(s[i]) - 1 - j] = s[i][j] - '0';
      }
   }
   for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < N - 2; ++j) {
         if (a[i][j] == 2.0) {
            a[i][j + 1]++;
            a[i][j] = 0.5;
            continue;
         }
         if (a[i][j] == 1.0 && a[i][j + 1] == 1.0) {
            a[i][j]--;
            a[i][j + 1]--;
            a[i][j + 2]++;
         }
      }
   }
   for (int i = N - 1; i >= 0; --i) {
      if (a[0][i] > a[1][i]) {
         cout << '>';
         return 0;
      }
      if (a[0][i] < a[1][i]) {
         cout << '<';
         return 0;
      }
   }
   cout << '=';
   return 0;
}


#include <algorithm>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

const int maxN = 1e5+100;

int a[maxN], b[maxN];
string s, t;

char cmp(int len) {
	for(int i=len-1; i>=2; i--) {
		if (a[i]) {
			if ((!a[i-1]) && (!a[i-2])) {
				a[i] = 0;
				a[i-1] = 1;
				a[i-2] = 1;
			} else
				return '>';
		}
		if (b[i]) {
			if ((!b[i-1]) && (!b[i-2])) {
				b[i] = 0;
				b[i-1] = 1;
				b[i-2] = 1;
			} else
				return '<';
		}
		if (a[i-1] && b[i-1])
			a[i-1] = b[i-1] = 0;
		if (a[i-2] && b[i-2])
			a[i-2] = b[i-2] = 0;
	}
	for(int i=len-1; i>=0; i--)
		if (a[i])
			return '>';
		else if (b[i])
			return '<';
	return '=';
}

int main() {
	getline(cin, s);
	getline(cin, t);
	for(int i=0; i<s.length(); i++)
		a[i] = s[s.length()-1-i]-'0';
	for(int i=0; i<t.length(); i++)
		b[i] = t[t.length()-1-i]-'0';
	int len = max(s.length(), t.length());
	for(int i=0; i<len; i++) {
		int delta = min(a[i], b[i]);
		a[i] -= delta;
		b[i] -= delta;
	}
	for(int i=len-1; i>1; i--) {
		if (a[i] && b[i-1] && b[i-2]) {
			a[i] = 0;
			b[i-1] = 0;
			b[i-2] = 0;
		}
		if (b[i] && a[i-1] && a[i-2]) {
			b[i] = 0;
			a[i-1] = 0;
			a[i-2] = 0;
		}
	}
	cout << cmp(len);
}


#include <algorithm>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

const int maxN = 1e5+100;

int a[maxN], b[maxN];
string s, t;

char cmp(int len) {
	for(int i=len-1; i>=0; i--)
		if (a[i]) return '>';
		else if (b[i]) return '<';
	return '=';
}

int main() {
	getline(cin, s);
	getline(cin, t);
	for(int i=0; i<s.length(); i++)
		a[i] = s[s.length()-1-i]-'0';
	for(int i=0; i<t.length(); i++)
		b[i] = t[t.length()-1-i]-'0';
	int len = max(s.length(), t.length());
	for(int i=0; i<len; i++) {
		int delta = min(a[i], b[i]);
		a[i] -= delta;
		b[i] -= delta;
	}
	for(int i=len-1; i>1; i--) {
		if (a[i] && b[i-1] && b[i-2]) {
			a[i] = 0;
			b[i-1] = 0;
			b[i-2] = 0;
		}
		if (b[i] && a[i-1] && a[i-2]) {
			b[i] = 0;
			a[i-1] = 0;
			a[i-2] = 0;
		}
	}
	cout << cmp(len);
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=100005;
int main(){
	char str1[N];
	char str2[N];
	scanf("%s",str1);
	scanf("%s",str2);
	LL s1=0;
	LL s2=0;
	for(int i=strlen(str1)-1;i>=0;i--){
		if(str1[i]=='1'){
			s1+=(strlen(str1)-i);
		}
	}
	for(int i=strlen(str2)-1;i>=0;i--){
		if(str2[i]=='1'){
			s2+=(strlen(str2)-i);
		}
	}
	if(strlen(str1)>100)
		cout<<s1<<" "<<s2<<endl;
	if(s1==s2){
		puts("=");
	}
	else if(s1>s2){
		puts(">");
	}
	else{
		puts("<");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const double q=1.618033988;
const double inf=0.0000001;
const int N=100005;
double ABS(double a){
	return a>=0?a:-a;
}
double POW(int n){
	double t=1.0;
	while(n--){
		t*=q;
	}
	return t;
}
int main(){
	char str1[N];
	char str2[N];
	scanf("%s%s",str1,str2);
	double sum1=1.0;
	double sum2=1.0;
	for(int i=0;i<strlen(str1);i++){
		if(str1[i]=='1'){
			sum1+=POW(strlen(str1)-1-i);
		}
	}
	for(int i=0;i<strlen(str2);i++){
		if(str2[i]=='1'){
			sum2+=POW(strlen(str2)-1-i);
		}
	}
	if(ABS(sum1-sum2)<inf){
		puts("=");
	}
	else if(sum1>sum2){
		puts(">");
	}
	else{
		puts("<");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=100005;
int main(){
	char str1[N];
	char str2[N];
	scanf("%s",str1);
	scanf("%s",str2);
	LL s1=0;
	LL s2=0;
	for(int i=strlen(str1)-1;i>=0;i--){
		if(str1[i]=='1'){
			s1+=(strlen(str1)-i);
		}
	}
	for(int i=strlen(str2)-1;i>=0;i--){
		if(str2[i]=='1'){
			s2+=(strlen(str2)-i);
		}
	}
	//cout<<s1<<" "<<s2<<endl;
	if(s1==s2){
		puts("=");
	}
	else if(s1>s2){
		puts(">");
	}
	else{
		puts("<");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=100005;
int main(){
	char str1[N];
	char str2[N];
	char str11[N];
	char str22[N];
	scanf("%s",str1);
	scanf("%s",str2);
	LL s1=0;
	LL s2=0;
	for(int i=0;i<strlen(str1);i++){
		str11[i]=str1[strlen(str1)-i-1];
	}
	for(int i=0;i<strlen(str2);i++){
		str22[i]=str2[strlen(str2)-i-1];
	}
	for(int i=0;i<strlen(str1);i++){
		if(str11[i]=='1'){
			s1+=(i+1);
		}
	}
	for(int i=0;i<strlen(str2);i++){
		if(str22[i]=='1'){
			s2+=(i+1);
		}
	}
	if(s1==s2){
		puts("=");
	}
	else if(s1>s2){
		puts(">");
	}
	else{
		puts("<");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=100005;
const long double Q=1.618033988;
const long double inf=0.001;
pair<unsigned long long int,unsigned long long int> dp[N];
long double ABS(long double a){
	return a>=0?a:-a;
}
int main(){
	dp[0]=make_pair(0,1);
	dp[1]=make_pair(1,0);
	dp[2]=make_pair(1,1);
	for(int i=3;i<=N;i++){
		dp[i]=make_pair(dp[i-1].first+dp[i-2].first,dp[i-1].second+dp[i-2].second);
	}
	char str1[N];
	char str2[N];
	scanf("%s",str1);
	scanf("%s",str2);
	unsigned long long a1=0,b1=0,a2=0,b2=0;
	for(int i=0;i<strlen(str1);i++){
		if(str1[i]=='1'){
			a1+=dp[strlen(str1)-i-1].first;
			b1+=dp[strlen(str1)-i-1].second;
		}
	}
	for(int i=0;i<strlen(str2);i++){
		if(str2[i]=='1'){
			a2+=dp[strlen(str2)-i-1].first;
			b2+=dp[strlen(str2)-i-1].second;
		}
	}
	long double s1=a1*Q+b1*1.0;
	long double s2=a2*Q+b2*1.0;
	if(ABS(s1-s2)<inf){
		puts("=");
	}
	else if(s1>s2){
		puts(">");
	}
	else{
		puts("<");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=100005;
const double Q=1.618033988;
const double inf=0.001;
pair<int,int> dp[N];
double ABS(double a){
	return a>=0?a:-a;
}
int main(){
	dp[0]=make_pair(0,1);
	dp[1]=make_pair(1,0);
	dp[2]=make_pair(1,1);
	for(int i=3;i<=N;i++){
		dp[i]=make_pair(dp[i-1].first+dp[i-2].first,dp[i-1].second+dp[i-2].second);
	}
	char str1[N];
	char str2[N];
	scanf("%s",str1);
	scanf("%s",str2);
	int a1=0,b1=0,a2=0,b2=0;
	for(int i=0;i<strlen(str1);i++){
		if(str1[i]=='1'){
			a1+=dp[strlen(str1)-i-1].first;
			b1+=dp[strlen(str1)-i-1].second;
		}
	}
	for(int i=0;i<strlen(str2);i++){
		if(str2[i]=='1'){
			a2+=dp[strlen(str2)-i-1].first;
			b2+=dp[strlen(str2)-i-1].second;
		}
	}
	double s1=a1*Q+b1*1.0;
	double s2=a2*Q+b2*1.0;
	if(ABS(s1-s2)<inf){
		puts("=");
	}
	else if(s1>s2){
		puts(">");
	}
	else{
		puts("<");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=100005;
const double Q=1.618033988;
const double inf=0.001;
pair<int,int> dp[N];
double ABS(double a){
	return a>=0?a:-a;
}
int main(){
	dp[0]=make_pair(0,1);
	dp[1]=make_pair(1,0);
	dp[2]=make_pair(1,1);
	for(int i=3;i<=N;i++){
		dp[i]=make_pair(dp[i-1].first+dp[i-2].first,dp[i-1].second+dp[i-2].second);
	}
	char str1[N];
	char str2[N];
	char str11[N];
	char str22[N];
	scanf("%s",str1);
	scanf("%s",str2);
	for(int i=0;i<strlen(str1);i++)
		str11[i]=str1[strlen(str1)-i-1];
	for(int i=0;i<strlen(str2);i++)
		str22[i]=str2[strlen(str2)-i-1];
	int a1=0,b1=0,a2=0,b2=0;
	for(int i=0;i<strlen(str1);i++){
		if(str11[i]=='1'){
			a1+=dp[i].first;
			b1+=dp[i].second;
		}
	}
	for(int i=0;i<strlen(str2);i++){
		if(str22[i]=='1'){
			a2+=dp[i].first;
			b2+=dp[i].second;
		}
	}
	double s1=a1*Q+b1*1.0;
	double s2=a2*Q+b2*1.0;
	if(ABS(s1-s2)<inf){
		puts("=");
	}
	else if(s1>s2){
		puts(">");
	}
	else{
		puts("<");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const double q=1.618033988;
const double inf=0.001;
const int N=100005;
double ABS(double a){
	return a>=0?a:-a;
}
double POW(int n){
	double t=1.0;
	while(n--){
		t*=q;
	}
	return t;
}
int main(){
	char str1[N];
	char str2[N];
	scanf("%s%s",str1,str2);
	double sum1=1.0;
	double sum2=1.0;
	for(int i=0;i<strlen(str1);i++){
		if(str1[i]=='1'){
			sum1+=POW(strlen(str1)-1-i);
		}
	}
	for(int i=0;i<strlen(str2);i++){
		if(str2[i]=='1'){
			sum2+=POW(strlen(str2)-1-i);
		}
	}
	if(ABS(sum1-sum2)<inf){
		puts("=");
	}
	else if(sum1>sum2){
		puts(">");
	}
	else{
		puts("<");
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define q (sqrt(5.0)+1)/2
char str1[100005];
char str2[100005];
double absss(double x)
{
	return x>=0?x:-x;
}
int main()
{
	while(~scanf("%s",str1))
	{
		scanf("%s",str2);
		long double x=0.0,y=0.0;
		int n1=strlen(str1);
		for(int i=0;i<n1;i++)
		{
			x+=((str1[i]-'0')*pow(q,n1-i));
		}
		int n2=strlen(str2);
		for(int i=0;i<n2;i++)
		{
			y+=((str2[i]-'0')*pow(q,n2-i));
		}
		if(absss(x-y)<1e-10)
			printf("=\n");
		else if(x<y)
		{
			printf("<\n");
		}
		else
		{
			printf(">\n");
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define q (sqrt(5.0)+1)/2
char str1[100005];
char str2[100005];
double absss(double x)
{
	return x>=0?x:-x;
}
int main()
{
	while(~scanf("%s",str1))
	{
		scanf("%s",str2);
		double x=0.0,y=0.0;
		int n1=strlen(str1);
		for(int i=0;i<n1;i++)
		{
			x+=((str1[i]-'0')*pow(q,n1-i));
		}
		int n2=strlen(str2);
		for(int i=0;i<n2;i++)
		{
			y+=((str2[i]-'0')*pow(q,n2-i));
		}
		if(absss(x-y)<1e-10)
			printf("=\n");
		else if(x<y)
		{
			printf("<\n");
		}
		else
		{
			printf(">\n");
		}
	}
	return 0;
}


//lxrtxdy!
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int L = 100005;

char s[L], t[L];

void canonicalize(char s[L]) {
	int l = strlen(s);
	reverse(s, s + l);
	for (int i = l; i < L; ++i) {
		s[i] = '0';
	}
	for (int i = L - 1; i - 2 >= 0; --i) {
		if (s[i] == '0' && s[i - 1] == '1' && s[i - 2] == '1') {
			s[i] = '1';
			s[i - 1] = '0';
			s[i - 2] = '0';
			for (int j = i; s[j] == '1' && s[j + 1] == '1' && j + 2 < L; j += 2) {
				s[j + 2] = '1';
				s[j] = '0';
				s[j + 1] = '0';
			}
		}
	}
}

int main() {
	scanf("%s%s", s, t);
	canonicalize(s);
	canonicalize(t);
	int ret = 0;
	for (int i = L - 1; i >= 0; --i) {
		if (s[i] != t[i]) {
			ret = s[i] < t[i] ? -1 : 1;
			break;
		}
	}
	printf("%c\n", ret ? (ret < 0 ? '<' : '>') : '=');
	return 0;
}
//hello//hellobig_tq
//orzlxr!//hello


#include <iostream>
#include <cstdio>
#include <stack>
#include <cstring>
#include <queue>
#include <algorithm>
#include <cmath>
//#include <unordered_map>
#define N 100010
using namespace std;
typedef pair<int,int> PII;
const int INF=0x3f3f3f3f;
void Open()
{
    #ifndef ONLINE_JUDGE
        freopen("D:/in.txt","r",stdin);
        //freopen("D:/my.txt","w",stdout);
    #endif // ONLINE_JUDGE
}
char ts[N];
char tt[N];
int s[N];
int t[N];
int sta[N];
int tail=0;
int main()
{
    //Open();
    scanf("%s",ts);
    scanf("%s",tt);
    int slen=strlen(ts);
    int tlen=strlen(tt);
    for(int i=0;i<slen;i++)
        s[i]=ts[slen-i-1]-'0';
    for(int i=0;i<tlen;i++)
        t[i]=tt[tlen-i-1]-'0';

//    for(int i=0;i<slen;i++)
//        printf("%d",s[i]);
//    cout<<endl;
//    for(int i=0;i<tlen;i++)
//        printf("%d",t[i]);
//    cout<<endl;

    int limit = min(slen,tlen);
    for(int i=0;i<limit;i++)
        if(s[i] && t[i])
            s[i]=0,t[i]=0;

    for(int i=1;i<slen;i++)
    {
        if(s[i] && s[i-1])
            sta[tail++]=i;
    }
    while(tail>0)
    {
        int curi=sta[--tail];
        bool flag = s[curi] && s[curi-1];
        if(flag)
        {
            s[curi-1]=0,s[curi]=0;s[curi+1]=1;
            if(s[curi+1] && t[curi+1])
                s[curi+1]=0,t[curi+1]=0;
            else
                slen = max(slen,curi+2);
            curi+=2;
            if(s[curi] && s[curi-1])
                sta[tail++]=curi;
        }
    }

    for(int i=1;i<tlen;i++)
        if(t[i] && t[i-1])
            sta[tail++]=i;
    while(tail>0)
    {
        int curi = sta[--tail];
        //cout<<"curi:"<<curi<<endl;
        bool flag = t[curi] && t[curi-1];
        if(flag)
        {
            t[curi]=0,t[curi-1]=0,t[curi+1]=1;
            //cout<<"cccc"<<endl;
            if(s[curi+1] && t[curi+1])
                s[curi+1]=0,t[curi+1]=0;
            else
                tlen = max(tlen,curi+2);
            curi+=2;
            if(t[curi] && t[curi-1])
                sta[tail++]=curi;
        }
    }
//    cout<<"after:"<<endl;
//    for(int i=0;i<slen;i++)
//        printf("%d",s[i]);
//    cout<<endl;
//    for(int i=0;i<tlen;i++)
//        printf("%d",t[i]);
//    cout<<endl;

    limit = max(tlen,slen);
    for(int i=limit-1;i>=0;i--)
    {
        if(s[i]>t[i]){
            puts(">");
            return 0;
        }
        else if(s[i]<t[i]){
            puts("<");
            return 0;
        }
    }
    puts("=");
    return 0;
}


#include <iostream>
#include <cstdio>
#include <stack>
#include <cstring>
#include <queue>
#include <algorithm>
#include <cmath>
//#include <unordered_map>
#define N 100010
using namespace std;
typedef pair<int,int> PII;
const int INF=0x3f3f3f3f;
void Open()
{
    #ifndef ONLINE_JUDGE
        freopen("D:/in.txt","r",stdin);
        //freopen("D:/my.txt","w",stdout);
    #endif // ONLINE_JUDGE
}
char ts[N];
char tt[N];
int s[N];
int t[N];
int sta[N];
int tail=0;
int main()
{
    //Open();
    scanf("%s",ts);
    scanf("%s",tt);
    int slen=strlen(ts);
    int tlen=strlen(tt);
    for(int i=0;i<slen;i++)
        s[i]=ts[slen-i-1]-'0';
    for(int i=0;i<tlen;i++)
        t[i]=tt[tlen-i-1]-'0';

//    for(int i=0;i<slen;i++)
//        printf("%d",s[i]);
//    cout<<endl;
//    for(int i=0;i<tlen;i++)
//        printf("%d",t[i]);
//    cout<<endl;

    int limit = min(slen,tlen);
    for(int i=0;i<limit;i++)
        if(s[i] && t[i])
            s[i]=0,t[i]=0;

    for(int i=1;i<slen;i++)
    {
        if(s[i] && s[i-1])
            sta[tail++]=i;
    }
    while(tail>0)
    {
        int curi=sta[--tail];
        bool flag = s[curi] && s[curi-1];
        if(flag)
        {
            s[curi-1]=0,s[curi]=0;s[curi+1]=1;
            if(s[curi+1] && t[curi+1])
                s[curi+1]=0,t[curi+1]=0;
            else
                slen = max(slen,curi+1);
            curi+=2;
            if(s[curi] && s[curi-1])
                sta[tail++]=curi;
        }
    }

    for(int i=1;i<tlen;i++)
        if(t[i] && t[i-1])
            sta[tail++]=i;
    while(tail>0)
    {
        int curi = sta[--tail];
        //cout<<"curi:"<<curi<<endl;
        bool flag = t[curi] && t[curi-1];
        if(flag)
        {
            t[curi]=0,t[curi-1]=0,t[curi+1]=1;
            //cout<<"cccc"<<endl;
            if(s[curi+1] && t[curi+1])
                s[curi+1]=0,t[curi+1]=0;
            else
                tlen = max(tlen,curi+1);
            curi+=2;
            if(t[curi] && t[curi-1])
                sta[tail++]=curi;
        }
    }
//    cout<<"after:"<<endl;
//    for(int i=0;i<slen;i++)
//        printf("%d",s[i]);
//    cout<<endl;
//    for(int i=0;i<tlen;i++)
//        printf("%d",t[i]);
//    cout<<endl;

    limit = max(tlen,slen);
    for(int i=limit-1;i>=0;i--)
    {
        if(s[i]>t[i]){
            puts(">");
            return 0;
        }
        else if(s[i]<t[i]){
            puts("<");
            return 0;
        }
    }
    puts("=");
    return 0;
}


//lxrtxdy!
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int L = 100005;

char s[L], t[L];

void canonicalize(char s[L]) {
	int l = strlen(s);
	reverse(s, s + l);
	for (int i = l; i < L; ++i) {
		s[i] = '0';
	}
	for (int i = L - 1; i - 2 >= 0; --i) {
		if (s[i] == '0' && s[i - 1] == '1' && s[i - 2] == '1') {
			s[i] = '1';
			s[i - 1] = '0';
			s[i - 2] = '0';
			for (int j = i; s[j] == '1' && s[j + 1] == '1' && j + 2 < L; j += 2) {
				s[j + 2] = '1';
				s[j] = '0';
				s[j + 1] = '0';
			}
		}
	}
}

int main() {
	scanf("%s%s", s, t);
	canonicalize(s);
	canonicalize(t);
	int ret = 0;
	for (int i = L - 1; i >= 0; --i) {
		if (s[i] != t[i]) {
			ret = s[i] < t[i] ? -1 : 1;
			break;
		}
	}
	printf("%c\n", ret ? (ret < 0 ? '<' : '>') : '=');
	return 0;
}
//hello//hellobig_tq
//orzlxr!//hello//hello


#include <bits/stdc++.h>
#define ll long long

using namespace std;

const ll N = 200200;

void Fix(string& s)
{
    reverse(s.begin(),s.end());

    s.resize(N,'0');

    for(ll i=N-1;i>0;i--)
        while( i<N-1 && s[i]=='1' && s[i-1]=='1' )
            s[i] = s[i-1] = '0' , s[i+1] = '1' , i++ , i++ ;

    reverse(s.begin(),s.end());
}

int main()
{
    string s1;  cin>>s1;    Fix(s1);
    string s2;  cin>>s2;    Fix(s2);

    if(s1==s2)  cout<<"=";
    if(s1>s2)   cout<<">";
    if(s1<s2)   cout<<"<";
}


#include <bits/stdc++.h>
#define ll long long

using namespace std;

const ll N = 200200;

ll a[N];
ll b[N];

void Fix(string& s)
{
    reverse(s.begin(),s.end());

    s.resize(N,'0');

    for(ll i=N-1;i>0;i--)
        if(s[i]=='1'&&s[i-1]=='1')
            if(s[i] = s[i-1] = '0' , s[i+1] = '1' ,s[i+2]=='1')
                s[i+1] = s[i+2] ='0' , s[i+3] = '1';

    reverse(s.begin(),s.end());
}

int main()
{
    string s1,s2;   cin>>s1>>s2;

    Fix(s1);
    Fix(s2);

    if(s1==s2)  cout<<"=";
    if(s1>s2)   cout<<">";
    if(s1<s2)   cout<<"<";
}


#include <bits/stdc++.h>
#define ll long long

using namespace std;

const ll N = 50;

ll a[N];
ll b[N];

void Fix(string& s)
{
    reverse(s.begin(),s.end());

    s.resize(N,'0');

    for(ll i=N-1;i>0;i--)
        if(s[i]=='1'&&s[i-1]=='1')
            if(s[i] = s[i-1] = '0' , s[i+1] = '1' ,s[i+2]=='1')
                s[i+1] = s[i+2] ='0' , s[i+3] = '1';

    reverse(s.begin(),s.end());
}

int main()
{
    string s1,s2;   cin>>s1>>s2;

    Fix(s1);
    Fix(s2);

    if(s1==s2)  cout<<"=";
    if(s1>s2)   cout<<">";
    if(s1<s2)   cout<<"<";
}


//lxrtxdy!
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int L = 100005;

char s[L], t[L];

void canonicalize(char s[L]) {
	int l = strlen(s);
	reverse(s, s + l);
	for (int i = l; i < L; ++i) {
		s[i] = '0';
	}
	for (int i = L - 1; i - 2 >= 0; --i) {
		if (s[i] == '0' && s[i - 1] == '1' && s[i - 2] == '1') {
			s[i] = '1';
			s[i - 1] = '0';
			s[i - 2] = '0';
			for (int j = i; s[j] == '1' && s[j + 1] == '1' && j + 2 < L; j += 2) {
				s[j + 2] = '1';
				s[j] = '0';
				s[j + 1] = '0';
			}
		}
	}
}

int main() {
	scanf("%s%s", s, t);
	canonicalize(s);
	canonicalize(t);
	int ret = 0;
	for (int i = L - 1; i >= 0; --i) {
		if (s[i] != t[i]) {
			ret = s[i] < t[i] ? -1 : 1;
			break;
		}
	}
	printf("%c\n", ret ? (ret < 0 ? '<' : '>') : '=');
	return 0;
}
//hello//hellobig_tq
//orzlxr!


# include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5 + 100;

bool A[maxn + 100], B[maxn + 100];

int main(){
	string a, b;
	cin >> a >> b;

	for(int i=0 ; i<a.size() ; i++)
		A[i] = (a[a.size()-1-i] == '1');

	for(int i=0 ; i<b.size() ; i++)
		B[i] = (b[b.size()-1-i] == '1');

	int p = maxn;
	while(p >= 0){
		if(A[p] and A[p+1])
			A[p] = A[p+1] = false, A[p + 2] = true, p += 2;
		else
			p--;
	}

	p = maxn;
	while(p >= 0){
		if(B[p] and B[p+1])
			B[p] = B[p+1] = false, B[p + 2] = true, p += 2;
		else
			p--;
	}

	for(int i=maxn ; i>=0 ; i--){
		if(A[i] > B[i]){
			cout << ">" << endl;
			return 0;
		}
		if(B[i] > A[i]){
			cout << "<" << endl;
			return 0;
		}
	}

	cout << "=" << endl;

	return 0;
}


# include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5 + 100;

bool A[maxn + 100], B[maxn + 100];

int main(){
	string a, b;
	cin >> a >> b;

	for(int i=0 ; i<a.size() ; i++)
		A[i] = (a[a.size()-1-i] == '1');

	for(int i=0 ; i<b.size() ; i++)
		B[i] = (b[b.size()-1-i] == '1');

	for(int i=maxn ; i>=0 ; i--)
		if(A[i] and A[i+1] and !A[i+2])
			A[i] = A[i+1] = false, A[i+2] = true;

	for(int i=maxn ; i>=0 ; i--)
		if(B[i] and B[i+1] and !B[i+2])
			B[i] = B[i+1] = false, B[i+2] = true;

	for(int i=maxn ; i>=0 ; i--){
		if(A[i] > B[i]){
			cout << ">" << endl;
			return 0;
		}
		if(B[i] > A[i]){
			cout << "<" << endl;
			return 0;
		}
	}

	cout << "=" << endl;

	return 0;
}


# include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5 + 100;

bool A[maxn + 100], B[maxn + 100];

int main(){
	string a, b;
	cin >> a >> b;

	for(int i=0 ; i<a.size() ; i++)
		A[i] = (a[a.size()-1-i] == '1');

	for(int i=0 ; i<b.size() ; i++)
		B[i] = (b[b.size()-1-i] == '1');

	bool mark = true;
	while(mark){
		mark = false;
		for(int i=maxn ; i>=0 ; i--)
			if(A[i] and A[i+1] and !A[i+2])
				A[i] = A[i+1] = false, A[i+2] = mark = true;
	}

	mark = true;
	while(mark){
		mark = false;
		for(int i=maxn ; i>=0 ; i--)
			if(B[i] and B[i+1] and !B[i+2])
				B[i] = B[i+1] = false, B[i+2] = mark = true;
	}

	for(int i=maxn ; i>=0 ; i--){
		if(A[i] > B[i]){
			cout << ">" << endl;
			return 0;
		}
		if(B[i] > A[i]){
			cout << "<" << endl;
			return 0;
		}
	}

	cout << "=" << endl;

	return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int L = 100005;

char s[L], t[L];

void canonicalize(char s[L]) {
	int l = strlen(s);
	reverse(s, s + l);
	for (int i = l; i < L; ++i) {
		s[i] = '0';
	}
	for (int i = L - 1; i - 2 >= 0; --i) {
		if (s[i] == '0' && s[i - 1] == '1' && s[i - 2] == '1') {
			s[i] = '1';
			s[i - 1] = '0';
			s[i - 2] = '0';
			for (int j = i; s[j] == '1' && s[j + 1] == '1' && j + 2 < L; j += 2) {
				s[j + 2] = '1';
				s[j] = '0';
				s[j + 1] = '0';
			}
		}
	}
}

int main() {
	scanf("%s%s", s, t);
	canonicalize(s);
	canonicalize(t);
	int ret = 0;
	for (int i = L - 1; i >= 0; --i) {
		if (s[i] != t[i]) {
			ret = s[i] < t[i] ? -1 : 1;
			break;
		}
	}
	printf("%c\n", ret ? (ret < 0 ? '<' : '>') : '=');
	return 0;
}


#include <iostream>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <vector>

using namespace std;

void normalize_vector(vector<long long> &a)
{
    for (int i = 0; i + 2 < (int) a.size(); ++i) {
        int j = i;
        while (j >= 0 && a[j + 1] > 0 && a[j + 2] > 0) {
            long long x = min(a[j + 1], a[j + 2]);
            a[j] += x;
            a[j + 1] -= x;
            a[j + 2] -= x;
            --j;
        }
    }
}

ostream &operator << (ostream &out, vector<long long> const &a)
{
    for (auto x : a)
        out << x << ' ';
    return out;
}

int main()
{
/*
    freopen("input.txt", "w", stdout);

    int const MAX_N = 1e5;
    for (int i = 0; i < MAX_N; ++i)
        cout << '1';
    cout << endl;
    for (int i = 0; i < MAX_N; ++i)
        cout << '1';
    cout << endl;

    return 0;
*/

    // freopen("input.txt", "r", stdin);

    ios_base::sync_with_stdio(false);

    string s, t;

    cin >> s;
    cin >> t;

    vector<long long> a(2 * max(s.size(), t.size()) + 2, 0);
    vector<long long> b(2 * max(s.size(), t.size()) + 2, 0);

    for (int i = (int) s.size() - 1, j = (int) a.size() - 1; i >= 0; --i, --j)
        a[j] = s[i] - '0';
    for (int i = (int) t.size() - 1, j = (int) b.size() - 1; i >= 0; --i, --j)
        b[j] = t[i] - '0';

    normalize_vector(a);
    normalize_vector(b);

#ifdef LOCAL
    cout << "a: " << a << endl;
    cout << "b: " << b << endl;
#endif

    for (int i = 0; i < (int) a.size(); ++i) {
        if (a[i] < b[i]) {
            cout << '<' << endl;
            return 0;
        } else if (a[i] > b[i]) {
            cout << '>' << endl;
            return 0;
        }
    }

    cout << '=' << endl;

    return 0;
}


#include <iostream>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <vector>

using namespace std;

ostream &operator << (ostream &out, vector<long long> const &a)
{
    for (auto x : a)
        out << x << ' ';
    return out;
}

int main()
{
/*
    freopen("input.txt", "w", stdout);

    int const MAX_N = 1e5;
    for (int i = 0; i < MAX_N; ++i)
        cout << '1';
    cout << endl;
    for (int i = 0; i < MAX_N; ++i)
        cout << '1';
    cout << endl;

    return 0;
*/

    // freopen("input.txt", "r", stdin);

    ios_base::sync_with_stdio(false);

    string s, t;

    cin >> s;
    cin >> t;

    vector<long long> a(max(s.size(), t.size()) + 2, 0);
    vector<long long> b(max(s.size(), t.size()) + 2, 0);

    for (int i = (int) s.size() - 1, j = (int) a.size() - 1; i >= 0; --i, --j)
        a[j] = s[i] - '0';
    for (int i = (int) t.size() - 1, j = (int) b.size() - 1; i >= 0; --i, --j)
        b[j] = t[i] - '0';

    for (int i = 0; i + 2 < (int) a.size(); ++i) {
        if (a[i] >= b[i] + 2) {
            cout << '>' << endl;
            return 0;
        } else if (b[i] >= a[i] + 2) {
            cout << '<' << endl;
            return 0;
        } else if (a[i] > b[i]) {
            a[i] -= b[i];
            b[i] = 0;
            a[i + 1] += a[i];
            a[i + 2] += a[i];
            a[i] = 0;
        } else if (a[i] < b[i]) {
            b[i] -= a[i];
            a[i] = 0;
            b[i + 1] += b[i];
            b[i + 2] += b[i];
            b[i] = 0;
        }
#ifdef LOCAL
        cout << i << ":" << endl;
        cout << "  " << a << endl;
        cout << "  " << b << endl;
#endif
    }

    long long a1 = a[a.size() - 2], b1 = a[a.size() - 1];
    long long a2 = b[b.size() - 2], b2 = b[b.size() - 1];

    b1 = 2 * b1 + a1;
    b2 = 2 * b2 + a2;

    long long x = a1 - a2;
    long long y = b2 - b1;

    if (x == 0 && y == 0) {
        cout << '=' << endl;
    } else if (y == 0) {
        if (x < 0) {
            cout << '<' << endl;
        } else {
            cout << '>' << endl;
        }
    } else if (x == 0) {
        if (y < 0) {
            cout << '>' << endl;
        } else {
            cout << '<' << endl;
        }
    } else if (x > 0 && y > 0) {
        x = 5 * x * x;
        y = y * y;
        if (x == y) {
            cout << '=' << endl;
        } else if (x > y) {
            cout << '>' << endl;
        } else if (x < y) {
            cout << '<' << endl;
        }
    } else if (x < 0 && y < 0) {
        x = 5 * x * x;
        y = y * y;
        if (x == y) {
            cout << '=' << endl;
        } else if (x > y) {
            cout << '<' << endl;
        } else if (x < y) {
            cout << '>' << endl;
        }
    } else if (x > 0 && y < 0) {
        cout << '>' << endl;
    } else if (x < 0 && y > 0) {
        cout << '<' << endl;
    }

    return 0;
}


#include <iostream>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <vector>

using namespace std;

ostream &operator << (ostream &out, vector<long long> const &a)
{
    for (auto x : a)
        out << x << ' ';
    return out;
}

int main()
{
/*
    freopen("input.txt", "w", stdout);

    int const MAX_N = 1e5;
    for (int i = 0; i < MAX_N; ++i)
        cout << '1';
    cout << endl;
    for (int i = 0; i < MAX_N; ++i)
        cout << '1';
    cout << endl;

    return 0;
*/

    // freopen("input.txt", "r", stdin);

    ios_base::sync_with_stdio(false);

    string s, t;

    cin >> s;
    cin >> t;

    vector<long long> a(2 * max(s.size(), t.size()) + 2, 0);
    vector<long long> b(2 * max(s.size(), t.size()) + 2, 0);

    for (int i = (int) s.size() - 1, j = (int) a.size() - 1; i >= 0; --i, --j)
        a[j] = s[i] - '0';
    for (int i = (int) t.size() - 1, j = (int) b.size() - 1; i >= 0; --i, --j)
        b[j] = t[i] - '0';

    for (int i = 0; i + 2 < (int) a.size(); ++i) {
        if (a[i] == 1 && b[i] == 1) {
            a[i] -= b[i];
        } else if (a[i] == 1 && b[i] == 0) {
            a[i + 1]++;
            a[i + 2]++;
            --a[i];
        } else if (a[i] == 0 && b[i] == 1) {
            b[i + 1]++;
            b[i + 2]++;
            --b[i];
        } else if (a[i] == 2 && b[i] == 1) {
            a[i + 1]++;
            a[i + 2]++;
            a[i] = 0;
            b[i] = 0;
        } else if (a[i] == 1 && b[i] == 2) {
            b[i + 1]++;
            b[i + 2]++;
            a[i] = 0;
            b[i] = 0;
        } else if (a[i] == 2) {
            cout << '>' << endl;
        } else if (b[i] == 2) {
            cout << '<' << endl;
        }
    }

    long long a1 = a[a.size() - 2], b1 = a[a.size() - 1];
    long long a2 = b[b.size() - 2], b2 = b[b.size() - 1];

    b1 = 2 * b1 + a1;
    b2 = 2 * b2 + a2;

    long long x = a1 - a2;
    long long y = b2 - b1;

    if (x == 0 && y == 0) {
        cout << '=' << endl;
    } else if (y == 0) {
        if (x < 0) {
            cout << '<' << endl;
        } else {
            cout << '>' << endl;
        }
    } else if (x == 0) {
        if (y < 0) {
            cout << '>' << endl;
        } else {
            cout << '<' << endl;
        }
    } else if (x > 0 && y > 0) {
        x = 5 * x * x;
        y = y * y;
        if (x == y) {
            cout << '=' << endl;
        } else if (x > y) {
            cout << '>' << endl;
        } else if (x < y) {
            cout << '<' << endl;
        }
    } else if (x < 0 && y < 0) {
        x = 5 * x * x;
        y = y * y;
        if (x == y) {
            cout << '=' << endl;
        } else if (x > y) {
            cout << '<' << endl;
        } else if (x < y) {
            cout << '>' << endl;
        }
    } else if (x > 0 && y < 0) {
        cout << '>' << endl;
    } else if (x < 0 && y > 0) {
        cout << '<' << endl;
    }

    return 0;
}


#include <iostream>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);

    string s, t;

    cin >> s;
    cin >> t;

    vector<long long> a(max(s.size(), t.size()) + 2, 0);
    vector<long long> b(max(s.size(), t.size()) + 2, 0);

    for (int i = (int) s.size() - 1, j = (int) a.size() - 1; i >= 0; --i, --j)
        a[j] = s[i] - '0';
    for (int i = (int) t.size() - 1, j = (int) b.size() - 1; i >= 0; --i, --j)
        b[j] = t[i] - '0';

#ifdef LOCAL
    cout << "a: ";
    for (int x : a)
        cout << x << ' ';
    cout << endl;
    cout << "b: ";
    for (int x : b)
        cout << x << ' ';
    cout << endl;
#endif

    for (int i = 0; i + 2 < (int) a.size(); ++i) {
        a[i + 1] += a[i];
        a[i + 2] += a[i];
        a[i] = 0;
    }

    for (int i = 0; i + 2 < (int) b.size(); ++i) {
        b[i + 1] += b[i];
        b[i + 2] += b[i];
        b[i] = 0;
    }

#ifdef LOCAL
    cout << "a: ";
    for (int x : a)
        cout << x << ' ';
    cout << endl;
    cout << "b: ";
    for (int x : b)
        cout << x << ' ';
    cout << endl;
#endif

    long long a1 = a[a.size() - 2], b1 = a[a.size() - 1];
    long long a2 = b[b.size() - 2], b2 = b[b.size() - 1];

    b1 = 2 * b1 + a1;
    b2 = 2 * b2 + a2;

    long long x = a1 - a2;
    long long y = b2 - b1;

    if (x == 0 && y == 0) {
        cout << '=' << endl;
    } else {
        double d = sqrt(5.0) * x - 1.0 * y;
        if (d < 0) {
            cout << '<' << endl;
        } else {
            cout << '>' << endl;
        }
    }

    return 0;
}


#include <iostream>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);

    string s, t;

    cin >> s;
    cin >> t;

    vector<long long> a(max(s.size(), t.size()) + 2, 0);
    vector<long long> b(max(s.size(), t.size()) + 2, 0);

    for (int i = (int) s.size() - 1, j = (int) a.size() - 1; i >= 0; --i, --j)
        a[j] = s[i] - '0';
    for (int i = (int) t.size() - 1, j = (int) b.size() - 1; i >= 0; --i, --j)
        b[j] = t[i] - '0';

    for (int i = 0; i + 2 < (int) a.size(); ++i) {
        a[i + 1] += a[i];
        a[i + 2] += a[i];
        a[i] = 0;
    }

    for (int i = 0; i + 2 < (int) b.size(); ++i) {
        b[i + 1] += b[i];
        b[i + 2] += b[i];
        b[i] = 0;
    }

    long long a1 = a[a.size() - 2], b1 = a[a.size() - 1];
    long long a2 = b[b.size() - 2], b2 = b[b.size() - 2];

    b1 = 2 * b1 + a1;
    b2 = 2 * b2 + a2;

    long long x = a1 - a2;
    long long y = b2 - b1;

    if (x == 0 && y == 0) {
        cout << '=' << endl;
    } else {
        double d = sqrt(5.0) * x - 1.0 * y;
        if (d < 0) {
            cout << '<' << endl;
        } else {
            cout << '>' << endl;
        }
    }

    return 0;
}


#include <iostream>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <vector>

using namespace std;

void normalize_vector(vector<long long> &a)
{
    for (int i = 0; i + 2 < (int) a.size(); ++i) {
        int j = i;
        while (j >= 0 && a[j + 1] > 0 && a[j + 2] > 0) {
            long long x = min(a[j + 1], a[j + 2]);
            a[j] += x;
            a[j + 1] -= x;
            a[j + 2] -= x;
            --j;
        }
    }
}

ostream &operator << (ostream &out, vector<long long> const &a)
{
    for (auto x : a)
        out << x << ' ';
    return out;
}

int main()
{
/*
    freopen("input.txt", "w", stdout);

    int const MAX_N = 1e5;
    for (int i = 0; i < MAX_N; ++i)
        cout << '1';
    cout << endl;
    for (int i = 0; i < MAX_N; ++i)
        cout << '1';
    cout << endl;

    return 0;
*/

    // freopen("input.txt", "r", stdin);

    ios_base::sync_with_stdio(false);

    string s, t;

    cin >> s;
    cin >> t;

    vector<long long> a(2 * max(s.size(), t.size()) + 2, 0);
    vector<long long> b(2 * max(s.size(), t.size()) + 2, 0);

    for (int i = (int) s.size() - 1, j = (int) a.size() - 1; i >= 0; --i, --j)
        a[j] = s[i] - '0';
    for (int i = (int) t.size() - 1, j = (int) b.size() - 1; i >= 0; --i, --j)
        b[j] = t[i] - '0';

    normalize_vector(a);
    normalize_vector(b);

    cout << "a: " << a << endl;
    cout << "b: " << b << endl;

    for (int i = 0; i < (int) a.size(); ++i) {
        if (a[i] < b[i]) {
            cout << '<' << endl;
            return 0;
        } else if (a[i] > b[i]) {
            cout << '>' << endl;
            return 0;
        }
    }

    cout << '=' << endl;

    return 0;
}


#include <iostream>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);

    string s, t;

    cin >> s;
    cin >> t;

    vector<long long> a(max(s.size(), t.size()) + 2, 0);
    vector<long long> b(max(s.size(), t.size()) + 2, 0);

    for (int i = (int) s.size() - 1, j = (int) a.size() - 1; i >= 0; --i, --j)
        a[j] = s[i] - '0';
    for (int i = (int) t.size() - 1, j = (int) b.size() - 1; i >= 0; --i, --j)
        b[j] = t[i] - '0';

#ifdef LOCAL
    cout << "a: ";
    for (int x : a)
        cout << x << ' ';
    cout << endl;
    cout << "b: ";
    for (int x : b)
        cout << x << ' ';
    cout << endl;
#endif

    for (int i = 0; i + 2 < (int) a.size(); ++i) {
        a[i + 1] += a[i];
        a[i + 2] += a[i];
        a[i] = 0;
    }

    for (int i = 0; i + 2 < (int) b.size(); ++i) {
        b[i + 1] += b[i];
        b[i + 2] += b[i];
        b[i] = 0;
    }

#ifdef LOCAL
    cout << "a: ";
    for (int x : a)
        cout << x << ' ';
    cout << endl;
    cout << "b: ";
    for (int x : b)
        cout << x << ' ';
    cout << endl;
#endif

    long long a1 = a[a.size() - 2], b1 = a[a.size() - 1];
    long long a2 = b[b.size() - 2], b2 = b[b.size() - 1];

    b1 = 2 * b1 + a1;
    b2 = 2 * b2 + a2;

    long long x = a1 - a2;
    long long y = b2 - b1;

    if (x == 0 && y == 0) {
        cout << '=' << endl;
    } else if (y == 0) {
        if (x < 0) {
            cout << '<' << endl;
        } else {
            cout << '>' << endl;
        }
    } else if (x == 0) {
        if (y < 0) {
            cout << '>' << endl;
        } else {
            cout << '<' << endl;
        }
    } else if (x > 0 && y > 0) {
        x = 5 * x * x;
        y = y * y;
        if (x == y) {
            cout << '=' << endl;
        } else if (x > y) {
            cout << '>' << endl;
        } else if (x < y) {
            cout << '<' << endl;
        }
    } else if (x < 0 && y < 0) {
        x = 5 * x * x;
        y = y * y;
        if (x == y) {
            cout << '=' << endl;
        } else if (x > y) {
            cout << '<' << endl;
        } else if (x < y) {
            cout << '>' << endl;
        }
    } else if (x > 0 && y < 0) {
        cout << '>' << endl;
    } else if (x < 0 && y > 0) {
        cout << '<' << endl;
    }

    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int L = 100005;

char s[L], t[L];

void canonicalize(char s[L]) {
	int l = strlen(s);
	reverse(s, s + l);
	for (int i = l; i < L; ++i) {
		s[i] = '0';
	}
	for (int i = L - 1; i - 2 >= 0; --i) {
		if (s[i] == '0' && s[i - 1] == '1' && s[i - 2] == '1') {
			s[i] = '1';
			s[i - 1] = '0';
			s[i - 2] = '0';
			for (int j = i; s[j] == '1' && s[j + 1] == '1' && j + 2 < L; j += 2) {
				s[j + 2] = '1';
				s[j] = '0';
				s[j + 1] = '0';
			}
		}
	}
}

int main() {
	scanf("%s%s", s, t);
	canonicalize(s);
	canonicalize(t);
	int ret = 0;
	for (int i = L - 1; i >= 0; --i) {
		if (s[i] != t[i]) {
			ret = s[i] < t[i] ? -1 : 1;
			break;
		}
	}
	printf("%c\n", ret ? (ret < 0 ? '<' : '>') : '=');
	return 0;
}
//hello//hellobig_tq


//#include "stdafx.h"
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <string>
#include <vector>
#include <cmath>
#include <math.h>
#include <map>
#include <algorithm>
#include <set>
#include<complex>
#include <stdio.h>
#include <queue>
#include<stdint.h>
#include<iterator>
#include <cstdlib>
#include <fstream>
#define ll long long

#define forin for(fint i = 0; i < n; i++)
#define forkm for(fint k = 0; k < m; k++)
#define forjp for(fint j =0; j < p; j++)
#define all(x) x.begin(), x.end()
#define INF 99999999999
#define fint int_fast32_t
#define mp(x,y) make_pair(x,y)
#define cmp complex<double>

using namespace std;

const double PI = 3.14159265358979323846264338327;

int main()
{
	string a, b;
	cin >> a >> b;
	vector <int> a1(100020),b1(100020);
	for (int i = a.size()-1; i >= 0; i--)
		a1[a.size() - 1 - i] = a[i] - '0';
	for (int i = b.size() - 1; i >= 0; i--)
		b1[b.size() - 1 - i] = b[i] - '0';
	for (int i = 100010;i>=0;i--)
	{
		for (int j = i; a1[j] && a1[j + 1]; j += 2)
			a1[j] = a1[j + 1] = 0, a1[j+2] = 1;
		for (int j = i; b1[j] && b1[j + 1]; j += 2)
			b1[j] = b1[j + 1] = 0, b1[j+2] = 1;
	}
	for (int i = 100010; i >= 0; i--)
	{
		if (a1[i] < b1[i])
			return cout << '<' << endl, 0;
		if (a1[i] > b1[i])
			return cout << '>' << endl, 0;
	}
	cout << '=' << endl;
	return 0;
}
/* Fri Oct 13 2017 16:20:12 GMT+0300 (MSK) */


#include<iostream>
using namespace std;

bool isThere(string &str,int i)
{
    int ssz=str.size();
    if(i<ssz)
    {
        if(str[i]=='1')
            {
                str[i]='0';
                return true;
            }
       else if(i+1<ssz&&str[i+1]=='1')
        {
            str[i+1]='0';
            return (true&&isThere(str,i+2));
        }
            else
            return false;
    }
        else
        return false;
}
bool one(string s)
{
    for(int i=0;i<s.length();++i)
        if(s[i]=='1')
        return true;
    return false;
}
int main(){
string s1,s2,s3;
cin>>s1>>s2;
if(s1.find_first_of('1')>100000)
    s1="0";
else
s1=s1.substr(s1.find_first_of('1'));
if(s2.find_first_of('1')>100000)
    s2="0";
else
s2=s2.substr(s2.find_first_of('1'));
int n1=s1.length()-1,n2=s2.length()-1;
int t1=n1,t2=n2;
while(t1>-1&&t2>-1)
    {
     if(s1[t1]=='1'&&s2[t2]=='1')
    s1[t1]=s2[t2]='0';
    t1--;
    t2--;
    }
while(true)
{
if(!one(s1))
{
    if(!one(s2))
    {
        cout<<'=';
        return 0;
    }else
    {
        cout<<'<';
        return 0;
    }
}else
{
    if(!one(s2))
        {
            cout<<'>';
        return 0;
        }
    else
        {
    int m1=n1-s1.find_first_of('1'),m2=n2-s2.find_first_of('1');
    if(m2<m1)
    {
        if(isThere(s2,n2-m1))
            s1[n1-m1]='0';
        else
        {
            cout<<'>';
            return 0;
        }

    }else
    {
        if(isThere(s1,n1-m2))
            s2[n2-m2]='0';
        else
            {
            cout<<'<';
        return 0;
        }

    }

}
    }
}

}


#include<iostream>
using namespace std;

bool isThere(string &str,int i)
{
    if(i<str.size())
    {
        if(str[i]=='1')
            {
                str[i]='0';
                return true;
            }
       else if(i+1<str.size()&&str[i+1]=='1')
        {
            str[i+1]='0';
            return (isThere(str,i+2));
        }
            else
            return false;
    }
        else
        return false;
}
bool one(string s)
{
    for(int i=0;i<s.length();++i)
        if(s[i]=='1')
        return true;
    return false;
}
int main(){
string s1,s2,s3;
cin>>s1>>s2;
int n1=s1.length()-1,n2=s2.length()-1;
while(true)
{
if(!one(s1))
{
    if(!one(s2))
    {
        cout<<'=';
        return 0;
    }else
    {
        cout<<'<';
        return 0;
    }
}else
{
    if(!one(s2))
        {
            cout<<'>';
        return 0;
        }
    else
        {
    int m1=n1-s1.find_first_of('1'),m2=n2-s2.find_first_of('1');
    if(m2<m1)
    {
        if(isThere(s2,n2-m1))
            s1[n1-m1]='0';
        else
        {
            cout<<'>';
            return 0;
        }

    }else
    {
        if(isThere(s1,n1-m2))
            s2[n2-m2]='0';
        else
            {
            cout<<'<';
        return 0;
        }

    }

}
    }
}
}