using System;
using System.IO;
using System.Text;

namespace Rosetta_Problem
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            string s = Convert.ToString(Next(), 8);
            writer.WriteLine(s.Substring(s.Length - 1));
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace codeforces
{
    class Program
    {
        //16:23
        //reading
        static string ReadLine()
        {
            return Console.ReadLine();
        }
        static string[] ReadArray()
        {
            return ReadLine().Split(' ');
        }
        static List<string> ReadList()
        {
            return ReadArray().ToList();
        }
        static List<int> ReadIntList()
        {
            return ReadArray().Select(c => Convert.ToInt32(c)).ToList();
        }
        static List<long> ReadLongList()
        {
            return ReadArray().Select(c => Convert.ToInt64(c)).ToList();
        }
        static List<ulong> ReadULongList()
        {
            return ReadArray().Select(c => Convert.ToUInt64(c)).ToList();
        }
        static int ToInt(string str)
        {
            return Convert.ToInt32(str);
        }
        static long ToInt64(string str)
        {
            return Convert.ToInt64(str);
        }
        static ulong ToUInt64(string str)
        {
            return Convert.ToUInt64(str);
        }

        static void Main(string[] args)
        {
            string input = ReadLine();
            Console.WriteLine(input[0]);
            /*
            watch.Stop();
            var elapsedMs = watch.ElapsedMilliseconds;
            Console.WriteLine(elapsedMs);*/
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        int n = ReadInt();
        Write(n % 8);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array)writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }
    #endregion
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Rosetta_Problem
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            writer.WriteLine(Next()%8);
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace codeforces
{
    class Program
    {
        //16:23
        //reading
        static string ReadLine()
        {
            return Console.ReadLine();
        }
        static string[] ReadArray()
        {
            return ReadLine().Split(' ');
        }
        static List<string> ReadList()
        {
            return ReadArray().ToList();
        }
        static List<int> ReadIntList()
        {
            return ReadArray().Select(c => Convert.ToInt32(c)).ToList();
        }
        static List<long> ReadLongList()
        {
            return ReadArray().Select(c => Convert.ToInt64(c)).ToList();
        }
        static List<ulong> ReadULongList()
        {
            return ReadArray().Select(c => Convert.ToUInt64(c)).ToList();
        }
        static int ToInt(string str)
        {
            return Convert.ToInt32(str);
        }
        static long ToInt64(string str)
        {
            return Convert.ToInt64(str);
        }
        static ulong ToUInt64(string str)
        {
            return Convert.ToUInt64(str);
        }

        static void Main(string[] args)
        {
            string input = ReadLine();
            Console.WriteLine(input[1] - input[0]);
            /*
            watch.Stop();
            var elapsedMs = watch.ElapsedMilliseconds;
            Console.WriteLine(elapsedMs);*/
        }
    }
}


using System;
using System.IO;
using System.Text;

namespace Kavi_on_Pairing_Duty
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            const int mod = 998244353;

            int n = Next();

            var p = new int[n + 1];
            var s = new long[n + 1];
            s[1] = 1;
            long sum = 2;

            for (int i = 2; i < p.Length; i++)
            {
                for (int j = i + i; j < p.Length; j += i)
                {
                    p[j]++;
                }

                s[i] = (1 + sum + p[i])%mod;
                sum += s[i];
                sum %= mod;
            }
            writer.WriteLine(s[n]);
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
using System.Globalization;
using System.Threading;

using static System.Math;

namespace FertiLib.Contest.B
{
	public class Solver
	{
		Scanner sr;
		StreamWriter sw;

		bool isMultipleTestCases = false;

		public void Solve()
		{
			var n = sr.ReadInt();
			var devisor = Enumerable.Range(0, n + 1).ToArray();
			for (int i = 2; i * i <= n; i++)
			{
				if (devisor[i] != i) continue;
				var t = i * 2;
				while (t <= n)
				{
					devisor[t] = i;
					t += i;
				}
			}
			var dp = new ModInt[n + 1];
			dp[1] = 1;
			ModInt dpsum = 1;
			for (int i = 2; i <= n; i++)
			{
				dp[i] = 1;
				var factors = new Dictionary<int, int>();
				var cur = i;
				while (cur > 1)
				{
					if (!factors.ContainsKey(devisor[cur])) factors.Add(devisor[cur], 0);
					factors[devisor[cur]]++;
					cur /= devisor[cur];
				}
				foreach (var (key, value) in factors)
				{
					dp[i] *= value + 1;
				}
				dp[i] += dpsum;
				dpsum += dp[i];
			}
			Console.WriteLine(dp[n]);
		}

		public Solver(Scanner cin, StreamWriter cout)
		{
			this.sr = cin;
			this.sw = cout;
		}

		public void Start()
		{
			int _t = 1;
			if (isMultipleTestCases) _t = sr.ReadInt();
			while (_t-- > 0) Solve();
		}

		public static void YESNO(bool condition) => Console.WriteLine(condition ? "YES" : "NO");
		public static void YesNo(bool condition) => Console.WriteLine(condition ? "Yes" : "No");
		public static void yesno(bool condition) => Console.WriteLine(condition ? "yes" : "no");

		public static T SignOutput<T>(int x, T pos, T zero, T neg) => x == 0 ? zero : (x > 0 ? pos : neg);

		public static T[] CreateArray<T>(int n, Func<int, T> func) => Enumerable.Range(0, n).Select(p => func(p)).ToArray();
		public static T[][] CreateArray<T>(int h, int w, Func<int, int, T> func) => Enumerable.Range(0, h).Select(i => Enumerable.Range(0, w).Select(j => func(i, j)).ToArray()).ToArray();
	}

	public struct ModInt : IEquatable<ModInt>
	{
		public static long MOD = 998244353;
		public static bool isModPrime { get; set; }

		private readonly long num;

		public ModInt(long n) { num = n; isModPrime = true; }

		public override string ToString() => num.ToString();

		public static ModInt operator +(ModInt l, ModInt r)
		{
			long x = l.num + r.num;
			if (x >= MOD) x -= MOD;
			return new ModInt(x);
		}
		public static ModInt operator -(ModInt l, ModInt r)
		{
			long x = l.num - r.num;
			if (x < 0) x += MOD;
			return new ModInt(x);
		}
		public static ModInt operator *(ModInt l, ModInt r) => new ModInt((l.num * r.num) % MOD);
		public static ModInt operator /(ModInt l, ModInt r) => l * r.Inverse();

		public static ModInt operator ++(ModInt x)
		{
			var tmp = x + new ModInt(1);
			return tmp;
		}
		public static ModInt operator --(ModInt x)
		{
			var tmp = x - new ModInt(1);
			return tmp;
		}

		public static bool operator ==(ModInt l, ModInt r) => l.Equals(r);
		public static bool operator !=(ModInt l, ModInt r) => !l.Equals(r);

		public static implicit operator long(ModInt x) => x.num;
		public static implicit operator ModInt(long n)
		{
			n %= MOD;
			if (n < 0) n += MOD;
			return new ModInt(n);
		}

		public ModInt Inverse() => Inverse(this, MOD);
		public static ModInt Inverse(ModInt x) => Inverse(x.num, MOD);
		public static long Inverse(long x, long m)
		{
			if (x % m == 0) throw new DivideByZeroException();
			long a = x, b = m, u = 1, v = 0;
			while (b > 0)
			{
				long t = a / b;

				a -= t * b;
				long p = a; a = b; b = p;   // swap(a, b);

				u -= t * v;
				p = u; u = v; v = p;        // swap(u, v);
			}
			u %= m;
			if (u < 0) u += m;
			return u;
		}

		public ModInt Pow(long n) => Pow(this, n);

		public static ModInt Pow(long x, long n)
		{
			if (n < 0) return Pow(x, -n).Inverse();
			x %= MOD;
			long now = 1;
			if (isModPrime) n %= MOD - 1;
			for (; n > 0; n /= 2, x = x * x % MOD)
			{
				if (n % 2 == 1) now = now * x % MOD;
			}
			return new ModInt(now);
		}

		public bool Equals(ModInt x) => num == x.num;

		public override bool Equals(object obj) => obj is ModInt m && num == m.num;

		public override int GetHashCode()
		{
			return HashCode.Combine(num);
		}

	}

	public static class Program
	{
		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);
			var cin = new Scanner();
			var solver = new Solver(cin, sw);
			solver.Start();
			Console.Out.Flush();
		}
	}

	public static class Extention
	{
		public static string Join<T>(this IEnumerable<T> x, string separator = "") => string.Join(separator, x);

		public static int UpperBound<T>(this IList<T> list, T value) => list.BinarySearch(value, true, 0, list.Count, Comparer<T>.Default);
		public static int LowerBound<T>(this IList<T> list, T value) => list.BinarySearch(value, false, 0, list.Count, Comparer<T>.Default);
		public static int BinarySearch<T>(this IList<T> list, T value, bool isUpperBound, int index, int length, Comparer<T> comparer)
		{
			var ng = index - 1;
			var ok = index + length;
			while (ok - ng > 1)
			{
				var mid = ng + (ok - ng) / 2;
				var res = comparer.Compare(list[mid], value);
				if (res < 0 || (isUpperBound && res == 0)) ng = mid;
				else ok = mid;
			}
			return ok;
		}

		public static bool Chmax<T>(ref this T a, T b) where T : struct, IComparable<T>
		{
			if (a.CompareTo(b) >= 0) return false;
			a = b;
			return true;
		}
		public static bool Chmin<T>(ref this T a, T b) where T : struct, IComparable<T>
		{
			if (a.CompareTo(b) <= 0) return false;
			a = b;
			return true;
		}
	}

	public class Scanner
	{
		string[] s;
		int i;

		char[] separator = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Read() => ReadString();

		public string ReadString()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(separator, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return ReadString();
			i = 0;
			return s[i++];
		}

		public string[] ReadStringArray(int N)
		{
			string[] Array = new string[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadString();
			}
			return Array;
		}

		public int ReadInt() => int.Parse(ReadString());

		public int[] ReadIntArray(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadInt() + add;
			}
			return Array;
		}

		public long ReadLong() => long.Parse(ReadString());

		public long[] ReadLongArray(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadLong() + add;
			}
			return Array;
		}

		public double ReadDouble() => double.Parse(ReadString());

		public double[] ReadDoubleArray(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadDouble() + add;
			}
			return Array;
		}

		public T1 ReadValue<T1>() => (T1)Convert.ChangeType(ReadString(), typeof(T1));

		public (T1, T2) ReadValue<T1, T2>()
		{
			var inputs = ReadStringArray(2);
			var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
			var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
			return (v1, v2);
		}

		public (T1, T2, T3) ReadValue<T1, T2, T3>()
		{
			var inputs = ReadStringArray(3);
			var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
			var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
			var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
			return (v1, v2, v3);
		}

		public (T1, T2, T3, T4) ReadValue<T1, T2, T3, T4>()
		{
			var inputs = ReadStringArray(4);
			var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
			var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
			var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
			var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
			return (v1, v2, v3, v4);
		}

		public (T1, T2, T3, T4, T5) ReadValue<T1, T2, T3, T4, T5>()
		{
			var inputs = ReadStringArray(5);
			var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
			var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
			var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
			var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
			var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));
			return (v1, v2, v3, v4, v5);
		}

		public (T1, T2, T3, T4, T5, T6) ReadValue<T1, T2, T3, T4, T5, T6>()
		{
			var inputs = ReadStringArray(6);
			var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
			var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
			var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
			var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
			var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));
			var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));
			return (v1, v2, v3, v4, v5, v6);
		}

		public (T1, T2, T3, T4, T5, T6, T7) ReadValue<T1, T2, T3, T4, T5, T6, T7>()
		{
			var inputs = ReadStringArray(7);
			var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
			var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
			var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
			var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
			var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));
			var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));
			var v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7));
			return (v1, v2, v3, v4, v5, v6, v7);
		}

		public T1[] ReadValueArray<T1>(int N)
		{
			var v1 = new T1[N];
			for (int i = 0; i < N; i++)
			{
				v1[i] = ReadValue<T1>();
			}
			return v1;
		}

		public (T1[], T2[]) ReadValueArray<T1, T2>(int N)
		{
			var (v1, v2) = (new T1[N], new T2[N]);
			for (int i = 0; i < N; i++)
			{
				var (t1, t2) = ReadValue<T1, T2>();
				v1[i] = t1;
				v2[i] = t2;
			}
			return (v1, v2);
		}

		public (T1[], T2[], T3[]) ReadValueArray<T1, T2, T3>(int N)
		{
			var (v1, v2, v3) = (new T1[N], new T2[N], new T3[N]);
			for (int i = 0; i < N; i++)
			{
				var (t1, t2, t3) = ReadValue<T1, T2, T3>();
				v1[i] = t1;
				v2[i] = t2;
				v3[i] = t3;
			}
			return (v1, v2, v3);
		}

		public (T1[], T2[], T3[], T4[]) ReadValueArray<T1, T2, T3, T4>(int N)
		{
			var (v1, v2, v3, v4) = (new T1[N], new T2[N], new T3[N], new T4[N]);
			for (int i = 0; i < N; i++)
			{
				var (t1, t2, t3, t4) = ReadValue<T1, T2, T3, T4>();
				v1[i] = t1;
				v2[i] = t2;
				v3[i] = t3;
				v4[i] = t4;
			}
			return (v1, v2, v3, v4);
		}

		public (T1[], T2[], T3[], T4[], T5[]) ReadValueArray<T1, T2, T3, T4, T5>(int N)
		{
			var (v1, v2, v3, v4, v5) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N]);
			for (int i = 0; i < N; i++)
			{
				var (t1, t2, t3, t4, t5) = ReadValue<T1, T2, T3, T4, T5>();
				v1[i] = t1;
				v2[i] = t2;
				v3[i] = t3;
				v4[i] = t4;
				v5[i] = t5;
			}
			return (v1, v2, v3, v4, v5);
		}

		public (T1[], T2[], T3[], T4[], T5[], T6[]) ReadValueArray<T1, T2, T3, T4, T5, T6>(int N)
		{
			var (v1, v2, v3, v4, v5, v6) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N]);
			for (int i = 0; i < N; i++)
			{
				var (t1, t2, t3, t4, t5, t6) = ReadValue<T1, T2, T3, T4, T5, T6>();
				v1[i] = t1;
				v2[i] = t2;
				v3[i] = t3;
				v4[i] = t4;
				v5[i] = t5;
				v6[i] = t6;
			}
			return (v1, v2, v3, v4, v5, v6);
		}

		public (T1[], T2[], T3[], T4[], T5[], T6[], T7[]) ReadValueArray<T1, T2, T3, T4, T5, T6, T7>(int N)
		{
			var (v1, v2, v3, v4, v5, v6, v7) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N], new T7[N]);
			for (int i = 0; i < N; i++)
			{
				var (t1, t2, t3, t4, t5, t6, t7) = ReadValue<T1, T2, T3, T4, T5, T6, T7>();
				v1[i] = t1;
				v2[i] = t2;
				v3[i] = t3;
				v4[i] = t4;
				v5[i] = t5;
				v6[i] = t6;
				v7[i] = t7;
			}
			return (v1, v2, v3, v4, v5, v6, v7);
		}
	}
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Threading;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using static util;
using P = pair<int, int>;

class Program {
    static void Main(string[] args) {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        var solver = new Solver(sw);
        // var t = new Thread(solver.solve, 1 << 28); // 256 MB
        // t.Start();
        // t.Join();
        solver.solve();
        sw.Flush();
    }
}

class Solver {
    StreamWriter sw;
    Scan sc;
    void Prt(string a) => sw.WriteLine(a);
    void Prt<T>(IEnumerable<T> a) => Prt(string.Join(" ", a));
    void Prt(params object[] a) => Prt(string.Join(" ", a));
    public Solver(StreamWriter sw) {
        this.sw = sw;
        this.sc = new Scan();
    }

    public void solve() {
        int n = sc.Int;
        var dp = new long[n + 1];
        dp[0] = 1;
        long sum = 1;
        for (int i = 1; i <= n; i++)
        {
            for (int j = i * 2; j <= n; j += i)
            {
                ++dp[j];
            }
            dp[i] = (dp[i] + sum) % M;
            sum = (sum + dp[i]) % M;
        }
        Prt(dp[n]);

    }
}

class pair<T, U> : IComparable<pair<T, U>> {
    public T v1;
    public U v2;
    public pair() : this(default(T), default(U)) {}
    public pair(T v1, U v2) { this.v1 = v1; this.v2 = v2; }
    public int CompareTo(pair<T, U> a) {
        int c = Comparer<T>.Default.Compare(v1, a.v1);
        return c != 0 ? c : Comparer<U>.Default.Compare(v2, a.v2);
    }
    public override string ToString() => $"{v1} {v2}";
    public void Deconstruct(out T a, out U b) { a = v1; b = v2; }
}
static class util {
    // public static readonly int M = 1000000007;
    public static readonly int M = 998244353;
    public static readonly long LM = 1L << 60;
    public static readonly double eps = 1e-11;
    public static void DBG(string a) => Console.Error.WriteLine(a);
    public static void DBG<T>(IEnumerable<T> a) => DBG(string.Join(" ", a));
    public static void DBG(params object[] a) => DBG(string.Join(" ", a));
    public static void Assert(params bool[] conds) {
        if (conds.Any(x => !x)) throw new Exception();
    }
    public static pair<T, U> make_pair<T, U>(T v1, U v2) => new pair<T, U>(v1, v2);
    public static int CompareList<T>(IList<T> a, IList<T> b) where T : IComparable<T> {
        for (int i = 0; i < a.Count && i < b.Count; i++)
            if (a[i].CompareTo(b[i]) != 0) return a[i].CompareTo(b[i]);
        return a.Count.CompareTo(b.Count);
    }
    public static bool inside(int i, int j, int h, int w) => i >= 0 && i < h && j >= 0 && j < w;
    public static readonly int[] dd = { 0, 1, 0, -1 };
    // static readonly string dstring = "RDLU";
    public static IEnumerable<P> adjacents(int i, int j) {
        for (int k = 0; k < 4; k++) yield return new P(i + dd[k], j + dd[k ^ 1]);
    }
    public static IEnumerable<P> adjacents(int i, int j, int h, int w) {
        for (int k = 0; k < 4; k++) if (inside(i + dd[k], j + dd[k ^ 1], h, w))
            yield return new P(i + dd[k], j + dd[k ^ 1]);
    }
    public static IEnumerable<P> adjacents(this P p) => adjacents(p.v1, p.v2);
    public static IEnumerable<P> adjacents(this P p, int h, int w) => adjacents(p.v1, p.v2, h, w);
    public static IEnumerable<int> all_subset(this int p) {
        for (int i = 0; ; i = i - p & p) {
            yield return i;
            if (i == p) break;
        }
    }
    public static Dictionary<T, int> compress<T>(this IEnumerable<T> a)
        => a.Distinct().OrderBy(v => v).Select((v, i) => new { v, i }).ToDictionary(p => p.v, p => p.i);
    public static Dictionary<T, int> compress<T>(params IEnumerable<T>[] a)
        => compress(a.SelectMany(x => x));
    public static T[] inv<T>(this Dictionary<T, int> dic) {
        var res = new T[dic.Count];
        foreach (var item in dic) res[item.Value] = item.Key;
        return res;
    }
    public static void swap<T>(ref T a, ref T b) where T : struct { var t = a; a = b; b = t; }
    public static void swap<T>(this IList<T> a, int i, int j) where T : struct {
        var t = a[i]; a[i] = a[j]; a[j] = t;
    }
    public static T[] copy<T>(this IList<T> a) {
        var ret = new T[a.Count];
        for (int i = 0; i < a.Count; i++) ret[i] = a[i];
        return ret;
    }
}

class Scan {
    StreamReader sr;
    public Scan() { sr = new StreamReader(Console.OpenStandardInput()); }
    public Scan(string path) { sr = new StreamReader(path); }
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public string Str => ReadLine.Trim();
    public string ReadLine => sr.ReadLine();
    public pair<T, U> Pair<T, U>() {
        T a; U b;
        Multi(out a, out b);
        return new pair<T, U>(a, b);
    }
    public P P => Pair<int, int>();
    public int[] IntArr => StrArr.Select(int.Parse).ToArray();
    public long[] LongArr => StrArr.Select(long.Parse).ToArray();
    public double[] DoubleArr => StrArr.Select(double.Parse).ToArray();
    public string[] StrArr => Str.Split(new[]{' '}, StringSplitOptions.RemoveEmptyEntries);
    bool eq<T, U>() => typeof(T).Equals(typeof(U));
    T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
    T cv<T>(string s) => eq<T, int>()    ? ct<T, int>(int.Parse(s))
                       : eq<T, long>()   ? ct<T, long>(long.Parse(s))
                       : eq<T, double>() ? ct<T, double>(double.Parse(s))
                       : eq<T, char>()   ? ct<T, char>(s[0])
                                         : ct<T, string>(s);
    public void Multi<T>(out T a) => a = cv<T>(Str);
    public void Multi<T, U>(out T a, out U b) {
        var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]);
    }
    public void Multi<T, U, V>(out T a, out U b, out V c) {
        var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
    }
    public void Multi<T, U, V, W>(out T a, out U b, out V c, out W d) {
        var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]);
    }
    public void Multi<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e) {
        var ar = StrArr;
        a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); e = cv<X>(ar[4]);
    }
    public void Multi<T, U, V, W, X, Y>(out T a, out U b, out V c, out W d, out X e, out Y f) {
        var ar = StrArr;
        a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        d = cv<W>(ar[3]); e = cv<X>(ar[4]); f = cv<Y>(ar[5]);
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Math;
using System.Text;
using System.Threading;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Library;

namespace Program
{
    public static class ProblemB
    {
        static bool SAIKI = false;
        static public int numberOfRandomCases = 0;
        static public void MakeTestCase(List<string> _input, List<string> _output, ref Func<string[], bool> _outputChecker)
        {
        }
        static public void Solve()
        {
            var n = NN;
            const int mod = 998244353;
            var dp = new long[n * 2 + 1];
            for (var i = 2; i <= 2 * n; ++i)
            {
                var len = i * 2 - 2;
                for (var j = len; j <= 2 * n; j += len)
                {
                    ++dp[j];
                }
            }
            var ruiseki = 0L;
            for (var i = 2; i <= 2 * n; i += 2)
            {
                dp[i] += ruiseki;
                dp[i] %= mod;
                ruiseki = (ruiseki + dp[i]) % mod;
            }

            Console.WriteLine(dp[n * 2] % mod);
        }
        class Printer : StreamWriter
        {
            public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
            public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }
            public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }
        }
        static LIB_FastIO fastio = new LIB_FastIODebug();
        static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }
        static long NN => fastio.Long();
        static double ND => fastio.Double();
        static string NS => fastio.Scan();
        static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();
        static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();
        static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();
        static long Count<T>(this IEnumerable<T> x, Func<T, bool> pred) => Enumerable.Count(x, pred);
        static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v, (int)n);
        static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s, (int)c);
        static IOrderedEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => Enumerable.OrderBy(x, _ => xorshift);
        static IOrderedEnumerable<T> OrderBy<T>(this IEnumerable<T> x) => Enumerable.OrderBy(x.OrderByRand(), e => e);
        static IOrderedEnumerable<T1> OrderBy<T1, T2>(this IEnumerable<T1> x, Func<T1, T2> selector) => Enumerable.OrderBy(x.OrderByRand(), selector);
        static IOrderedEnumerable<T> OrderByDescending<T>(this IEnumerable<T> x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);
        static IOrderedEnumerable<T1> OrderByDescending<T1, T2>(this IEnumerable<T1> x, Func<T1, T2> selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);
        static IOrderedEnumerable<string> OrderBy(this IEnumerable<string> x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);
        static IOrderedEnumerable<T> OrderBy<T>(this IEnumerable<T> x, Func<T, string> selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);
        static IOrderedEnumerable<string> OrderByDescending(this IEnumerable<string> x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);
        static IOrderedEnumerable<T> OrderByDescending<T>(this IEnumerable<T> x, Func<T, string> selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);
        static string Join<T>(this IEnumerable<T> x, string separator = "") => string.Join(separator, x);
        static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }
        static IEnumerator<uint> _xsi = _xsc();
        static IEnumerator<uint> _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }
        static bool Chmax<T>(this ref T lhs, T rhs) where T : struct, IComparable<T> { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }
        static bool Chmin<T>(this ref T lhs, T rhs) where T : struct, IComparable<T> { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }
        static void Fill<T>(this T[] array, T value) => array.AsSpan().Fill(value);
        static void Fill<T>(this T[,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0], array.Length).Fill(value);
        static void Fill<T>(this T[,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0], array.Length).Fill(value);
        static void Fill<T>(this T[,,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0, 0], array.Length).Fill(value);
    }
}
namespace Library {
    class LIB_FastIO
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_FastIO() { str = Console.OpenStandardInput(); }
        readonly Stream str;
        readonly byte[] buf = new byte[2048];
        int len, ptr;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        byte read()
        {
            if (ptr >= len)
            {
                ptr = 0;
                if ((len = str.Read(buf, 0, 2048)) <= 0)
                {
                    return 0;
                }
            }
            return buf[ptr++];
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        char Char()
        {
            byte b = 0;
            do b = read();
            while (b < 33 || 126 < b);
            return (char)b;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        virtual public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        virtual public long Long()
        {
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = (ret << 3) + (ret << 1) + b - '0';
            }
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }
    }
    class LIB_FastIODebug : LIB_FastIO
    {
        Queue<string> param = new Queue<string>();
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_FastIODebug() { }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override string Scan() => NextString();
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override long Long() => long.Parse(NextString());
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override double Double() => double.Parse(NextString());
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;

namespace Task
{
  static class Program
  {
    #region Read / Write
    static TextReader Reader;
    static TextWriter Writer;
    private static Queue<string> _currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return Reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (_currentLineTokens.Count == 0) _currentLineTokens = new Queue<string>(ReadAndSplitLine()); return _currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
      int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
      for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }
      return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = Reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { Writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array) Writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
      public new TValue this[TKey key]
      {
        get { return ContainsKey(key) ? base[key] : default(TValue); }
        set { base[key] = value; }
      }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }
    #endregion=

    public static bool NextPermutation(List<int> perm)
    {
      for (int i = perm.Count - 2; i >= 0; i--)
      {
        if (perm[i] < perm[i + 1])
        {
          int min = i + 1;
          for (int j = min; j < perm.Count; j++)
            if (perm[j] > perm[i] && perm[j] < perm[min])
              min = j;

          var tmp = perm[i];
          perm[i] = perm[min];
          perm[min] = tmp;
          perm.Reverse(i + 1, perm.Count - i - 1);
          return true;
        }
      }

      return false;
    }

    #region SegmentTree

    public static long SegmentTreeFunc(long a, long b)
    {
      return a + b;
    }

    public static void BuildSegmentTree(long[] a, long v, long tl, long tr)
    {
      if (tl == tr)
        t[v] = a[tl];
      else
      {
        long tm = (tl + tr) / 2;
        BuildSegmentTree(a, v * 2, tl, tm);
        BuildSegmentTree(a, v * 2 + 1, tm + 1, tr);
        t[v] = SegmentTreeFunc(t[v * 2], t[v * 2 + 1]);
      }
    }

    public static long QuerySegmentTree(long v, long tl, long tr, long l, long r)
    {
      if (l > r)
        return 0;
      if (l == tl && r == tr)
        return t[v];

      var tm = (tl + tr) / 2;
      var res = SegmentTreeFunc(QuerySegmentTree(v * 2, tl, tm, l, Math.Min(r, tm)), QuerySegmentTree(v * 2 + 1, tm + 1, tr, Math.Max(l, tm + 1), r));
      return res;
    }

    public static void UpdateSegmentTree(int v, int tl, int tr, int pos, int new_val)
    {
      if (tl == tr)
        t[v] = new_val;
      else
      {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
          UpdateSegmentTree(v * 2, tl, tm, pos, new_val);
        else
          UpdateSegmentTree(v * 2 + 1, tm + 1, tr, pos, new_val);
        t[v] = SegmentTreeFunc(t[v * 2], t[v * 2 + 1]);
      }
    }

    public static long[] t;

    #endregion

    private static readonly int modulus = 1000000007;
    // private static readonly int modulus1 = modulus - 1;

    public static long Pow(long a, long b)
    {
      long y = 1;

      while (true)
      {
        if ((b & 1) != 0)
          y = a * y % modulus;
        b = b >> 1;
        if (b == 0)
          return y;
        a = a * a % modulus;
      }
    }

    public static long ReversedNumbByPrimeModulo(long a)
    {
      return Pow(a, modulus - 2);
    }

    public static long FactByModulo(long a)
    {
      long ans = 1;

      while (a > 0)
      {
        ans = ans * a % modulus;
        a--;
      }

      return ans;
    }

    public static long nCkModulo(long n, long k)
    {
      if (k < n >> 1)
        k = n - k;

      long ans = 1;
      for (long i = n; i > k; i--)
        ans = ans * i % modulus;

      k = n - k;
      var fact = FactByModulo(k);
      var revFact = ReversedNumbByPrimeModulo(fact);

      ans = ans * revFact % modulus;

      return ans;
    }

    public static int maxForPrimeCalc = 1000000;
    public static List<int> primes = new List<int>(maxForPrimeCalc) {2};
    // public static int[] minPrimeDiv = new int[maxForPrimeCalc + 1];
    public static bool[] isPrime = new bool[maxForPrimeCalc + 1];

    public static void CalcPrimes()
    {
      isPrime[2] = true;
      for (var i = 4; i <= maxForPrimeCalc; i += 2)
      {
        isPrime[i] = false;
        // minPrimeDiv[i] = 2;
      }
      for (var i = 3; i <= maxForPrimeCalc; i += 2)
      {
        isPrime[i] = true;
      }

      for (var i = 3; i * i <= maxForPrimeCalc; i += 2)
      {
        if (isPrime[i])
        {
          // minPrimeDiv[i] = i;
          primes.Add(i);
          for (var j = i * i; j <= maxForPrimeCalc; j += i)
          {
            if (isPrime[j])
            {
              isPrime[j] = false;
              // minPrimeDiv[j] = i;
            }
          }
        }
      }
    }
    //
    // public static int[] PrimeDifferentDividersCountHash = new int[maxForPrimeCalc + 1];
    //
    // private static int PrimeDifferentDividersCount(long numb)
    // {
    //   if (numb == 1)
    //     return 0;
    //   if (isPrime[numb])
    //     return 1;
    //
    //   if (PrimeDifferentDividersCountHash[numb] > 0)
    //     return PrimeDifferentDividersCountHash[numb];
    //
    //   var divider = minPrimeDiv[numb];
    //   var prevNumb = numb / divider;
    //   var ans = PrimeDifferentDividersCount(prevNumb);
    //
    //   if (divider != minPrimeDiv[prevNumb])
    //   {
    //     ans += 1;
    //   }
    //
    //   PrimeDifferentDividersCountHash[numb] = ans;
    //
    //   return ans;
    // }

    // #region Heap
    //
    // public static void InsertElementInHeap(MyStruct value, MyStruct[] arr, ref int sizeOfTree)
    // {
    //   sizeOfTree++;
    //   arr[sizeOfTree] = value;
    //   HeapifyUp(sizeOfTree, arr);
    // }
    //
    // public static void HeapifyUp(int cur, MyStruct[] arr)
    // {
    //   while (true)
    //   {
    //     if (cur == 1)
    //     {
    //       return;
    //     }
    //
    //     var parent = cur >> 1;
    //
    //     if (arr[cur].Value < arr[parent].Value)
    //     {
    //       arr[cur].Value ^= arr[parent].Value;
    //       arr[parent].Value ^= arr[cur].Value;
    //       arr[cur].Value ^= arr[parent].Value;
    //
    //       // arr[cur].Index ^= arr[parent].Index;
    //       // arr[parent].Index ^= arr[cur].Index;
    //       // arr[cur].Index ^= arr[parent].Index;
    //
    //       cur = parent;
    //       continue;
    //     }
    //
    //     break;
    //   }
    // }
    //
    // public static MyStruct ExtractHeadOfHeap(MyStruct[] arr, ref int sizeOfTree)
    // {
    //   var extractedValue = arr[1];
    //   arr[1] = arr[sizeOfTree];
    //   sizeOfTree--;
    //   HeapifyDown(1, sizeOfTree, arr);
    //   return extractedValue;
    // }
    //
    // public static void HeapifyDown(int cur, int sizeOfTree, MyStruct[] arr)
    // {
    //   while (true)
    //   {
    //     var left = cur << 1;
    //     var right = left + 1;
    //     int smallestChild;
    //
    //     if (sizeOfTree < left)
    //     {
    //       return;
    //     }
    //
    //     if (sizeOfTree == left || arr[left].Value < arr[right].Value)
    //       smallestChild = left;
    //     else
    //       smallestChild = right;
    //
    //     if (arr[cur].Value > arr[smallestChild].Value)
    //     {
    //       arr[cur].Value ^= arr[smallestChild].Value;
    //       arr[smallestChild].Value ^= arr[cur].Value;
    //       arr[cur].Value ^= arr[smallestChild].Value;
    //
    //       // arr[cur].Index ^= arr[smallestChild].Index;
    //       // arr[smallestChild].Index ^= arr[cur].Index;
    //       // arr[cur].Index ^= arr[smallestChild].Index;
    //
    //       cur = smallestChild;
    //       continue;
    //     }
    //
    //     break;
    //   }
    // }
    //
    // #endregion

    #region Sorted Set

    public class LowerBoundSortedSet<T> : SortedSet<T>
    {
      private ComparerDecorator<T> _comparerDecorator;
      private class ComparerDecorator<T> : IComparer<T>
      {
        private IComparer<T> _comparer;
        public T LowerBound { get; private set; }
        public T HigherBound { get; private set; }
        private bool _reset = true;
        public void Reset()
        {
          _reset = true;
        }
        public ComparerDecorator(IComparer<T> comparer)
        {
          _comparer = comparer;
        }
        public int Compare(T x, T y)
        {
          int num = _comparer.Compare(x, y);
          if (_reset)
          {
            LowerBound = y;
          }
          if (num >= 0)
          {
            LowerBound = y;
            _reset = false;
          }
          if (num <= 0)
          {
            HigherBound = y;
            _reset = false;
          }
          return num;
        }
      }
      public LowerBoundSortedSet()
        : this(Comparer<T>.Default) {}
      public LowerBoundSortedSet(IComparer<T> comparer)
        : base(new ComparerDecorator<T>(comparer))
      {
        _comparerDecorator = (ComparerDecorator<T>) Comparer;
      }
      public T FindLowerBound(T key)
      {
        _comparerDecorator.Reset();
        this.Contains<T>(key);
        return _comparerDecorator.LowerBound;
      }
      public T FindHigherBound(T key)
      {
        _comparerDecorator.Reset();
        this.Contains<T>(key);
        return _comparerDecorator.HigherBound;
      }
    }

    #endregion

    static long GCD(long a, long b)
    {
      while (b > 0) {
        a %= b;
        a ^= b;
        b ^= a;
        a ^= b;
      }
      return a;
    }

    // private static List<int>[] _divs = new List<int>[100000 + 1];

    // private static void CalcDivs()
    // {
    //   for (var i = 0; i < _divs.Length; i++)
    //     _divs[i] = new List<int>();
    //
    //   for (var i = 1; i < _divs.Length; i++)
    //   {
    //     for (var j = i; j < _divs.Length; j += i)
    //       _divs[j].Add(i);
    //   }
    // }

    static void Main(string[] args)
    {
      Reader = new StreamReader(Console.OpenStandardInput());
      Writer = new StreamWriter(Console.OpenStandardOutput());

      // CalcPrimes();
      // CalcDivs();

      // var t = ReadInt();
      // for (var tmp = 0; tmp < t; tmp++)
      {
        Solve();
      }

      Reader.Close();
      Writer.Close();
    }

    static void Solve()
    {
      var n = ReadInt();

      var mod = 998244353L;
      var dp = new long[n + 1];
      dp[0] = 1;
      dp[1] = 1;
      var sum = 2L;
      for (var i = 2; i <= n; i++)
      {
        dp[i] = sum;
        dp[i] %= mod;

        var tmp = 0L;
        for (var j = 2; j <= i; j++)
          if (i % j == 0)
          {
            dp[i] += 1;
            dp[i] %= mod;
          }

        dp[i] += tmp;
        sum += dp[i];
        sum %= mod;
      }

      Write(dp[n]);
    }

    private static int RevertInd(int[] chainNumb, int ind, int[] inChainNumb, int permCount, List<List<int>> chains, out int oldInd)
    {
      var cn = chainNumb[ind];
      var inC = inChainNumb[ind];

      oldInd = inC - permCount % chains[cn].Count;
      if (oldInd < 0)
        oldInd += chains[cn].Count;
      return cn;
    }

    public struct MyStruct
    {
      public char Dir;
      public int X;
      public int Index;

      public MyStruct(char dir, int x, int index)
      {
        Dir = dir;
        X = x;
        Index = index;
      }
    }

    private static int gcdex (int a, int b, out int x, out int y) {
      if (a == 0) {
        x = 0; y = 1;
        return b;
      }
      int x1, y1;
      int d = gcdex (b%a, a, out x1, out y1);
      x = y1 - (b / a) * x1;
      y = x1;
      return d;
    }

    private static long GetNumb(Dictionary<char, int> letterDic, List<int> permutation, string s)
    {
      long res = 0;
      long mult = 1;
      for (var i = s.Length - 1; i >= 0; i--)
      {
        res += permutation[letterDic[s[i]]] * mult;

        mult *= 10;
      }

      return res;
    }

    static void Inc(this Dictionary<long, long> dict, long key, long addedValue)
    {
      if (dict.ContainsKey(key))
        dict[key] += addedValue;
      else
        dict[key] = addedValue;
    }

    static void Inc(this Dictionary<int, int> dict, int key, int addedValue)
    {
      if (dict.ContainsKey(key))
        dict[key] += addedValue;
      else
        dict[key] = addedValue;
    }
  }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Intrinsics.Arm;
using CompLib.Mathematics;
using CompLib.Util;

public class Program
{
    int N;
    public void Solve()
    {

        var sc = new Scanner();

        int N = sc.NextInt();
        int[] cntDiv = new int[N + 1];
        for (int i = 1; i <= N; i++)
        {
            for (int j = i; j <= N; j += i)
            {
                cntDiv[j]++;
            }
        }

        ModInt ans = 0;
        for (int i = 1; i < N; i++)
        {
            ans += ModInt.Pow(2, i - 1) * cntDiv[N - i];
        }
        ans += cntDiv[N];

        Console.WriteLine(ans);
    }

    public static void Main(string[] args) => new Program().Solve();
    // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();
}

namespace CompLib.Mathematics
{
    #region ModInt
    /// <summary>
    /// [0,<see cref="Mod"/>) までの値を取るような数
    /// </summary>
    public struct ModInt
    {
        /// <summary>
        /// 剰余を取る値．
        /// </summary>
        // public const long Mod = (int)1e9 + 7;
        public const long Mod = 998244353;

        /// <summary>
        /// 実際の数値．
        /// </summary>
        public long num;
        /// <summary>
        /// 値が <paramref name="n"/> であるようなインスタンスを構築します．
        /// </summary>
        /// <param name="n">インスタンスが持つ値</param>
        /// <remarks>パフォーマンスの問題上，コンストラクタ内では剰余を取りません．そのため，<paramref name="n"/> ∈ [0,<see cref="Mod"/>) を満たすような <paramref name="n"/> を渡してください．このコンストラクタは O(1) で実行されます．</remarks>
        public ModInt(long n) { num = n; }
        /// <summary>
        /// このインスタンスの数値を文字列に変換します．
        /// </summary>
        /// <returns>[0,<see cref="Mod"/>) の範囲内の整数を 10 進表記したもの．</returns>
        public override string ToString() { return num.ToString(); }
        public static ModInt operator +(ModInt l, ModInt r) { l.num += r.num; if (l.num >= Mod) l.num -= Mod; return l; }
        public static ModInt operator -(ModInt l, ModInt r) { l.num -= r.num; if (l.num < 0) l.num += Mod; return l; }
        public static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }
        public static implicit operator ModInt(long n) { n %= Mod; if (n < 0) n += Mod; return new ModInt(n); }

        /// <summary>
        /// 与えられた 2 つの数値からべき剰余を計算します．
        /// </summary>
        /// <param name="v">べき乗の底</param>
        /// <param name="k">べき指数</param>
        /// <returns>繰り返し二乗法により O(N log N) で実行されます．</returns>
        public static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }

        /// <summary>
        /// 与えられた 2 つの数値からべき剰余を計算します．
        /// </summary>
        /// <param name="v">べき乗の底</param>
        /// <param name="k">べき指数</param>
        /// <returns>繰り返し二乗法により O(N log N) で実行されます．</returns>
        public static ModInt Pow(long v, long k)
        {
            long ret = 1;
            for (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)
                if ((k & 1) == 1) ret = ret * v % Mod;
            return new ModInt(ret);
        }
        /// <summary>
        /// 与えられた数の逆元を計算します．
        /// </summary>
        /// <param name="v">逆元を取る対象となる数</param>
        /// <returns>逆元となるような値</returns>
        /// <remarks>法が素数であることを仮定して，フェルマーの小定理に従って逆元を O(log N) で計算します．</remarks>
        public static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }
    }
    #endregion
    #region Binomial Coefficient
    public class BinomialCoefficient
    {
        public ModInt[] fact, ifact;
        public BinomialCoefficient(int n)
        {
            fact = new ModInt[n + 1];
            ifact = new ModInt[n + 1];
            fact[0] = 1;
            for (int i = 1; i <= n; i++)
                fact[i] = fact[i - 1] * i;
            ifact[n] = ModInt.Inverse(fact[n]);
            for (int i = n - 1; i >= 0; i--)
                ifact[i] = ifact[i + 1] * (i + 1);
            ifact[0] = ifact[1];
        }
        public ModInt this[int n, int r]
        {
            get
            {
                if (n < 0 || n >= fact.Length || r < 0 || r > n) return 0;
                return fact[n] * ifact[n - r] * ifact[r];
            }
        }
        public ModInt RepeatedCombination(int n, int k)
        {
            if (k == 0) return 1;
            return this[n + k - 1, k];
        }
    }
    #endregion
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
			string[] str = Console.ReadLine().Split();
			int N = int.Parse(str[0]);
			int M = int.Parse(str[1]);
			int R = int.Parse(str[2]);
			int a1 = 999999999;
			string[] str2 = Console.ReadLine().Split();
			for(var i=0;i<N;i++){
				int a = int.Parse(str2[i]);
				a1 = Math.Min(a,a1);
			}
			int a2 = 0;
			string[] str3 = Console.ReadLine().Split();
			for(var i=0;i<M;i++){
				int a = int.Parse(str3[i]);
				a2 = Math.Max(a,a2);
			}
			int ans = R-(R/a1)*a1+(R/a1)*a2;
			if(a1>=a2){
				ans = R;
			}
			Console.WriteLine(ans);
	}
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp27
{
    class Program
    {
        static void Main(string[] args)
        {

            int[] N = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int[] M = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int[] E = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            Array.Sort(M);
            Array.Sort(E);
            int count = 0;
            if (M[0] < E[E.Length - 1])
            {
                count = N[2] / M[0];
                int add = N[2] % M[0];
                count = count * E[E.Length - 1] + add;

            }
            else {
                count = N[2];
            }
            Console.WriteLine(count);
        }
    }
}


using System;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int m = sc.NextInt();
        int r = sc.NextInt();

        int[] s = sc.IntArray();
        int[] b = sc.IntArray();

        int sMin = s.Min();

        int bMax = b.Max();

        int ans = r;
        if (sMin < bMax)
        {
            int d = ans / sMin;
            ans %= sMin;
            ans += d * bMax;
        }

        Console.WriteLine(ans);
    }

    public static void Main(string[] args) => new Program().Solve();
    // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


/*
csc -debug A.cs && mono --debug A.exe <<< "3 4 11
4 2 5
4 4 5 4"
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class HelloWorld {
    public static void SolveCodeForces() {
        var n = cin.NextInt();
        var m = cin.NextInt();
        var r = cin.NextInt();
        var S = cin.IntArray().OrderBy(s => s).ToArray();
        var B = cin.IntArray();

        var sellPrice = B.Max();

        var cnt = 0;
        for (var i = 0; i < S.Length; i++) {
            if (r >= S[i] && S[i] < sellPrice) {
                var c = r / S[i];
                cnt += c;
                r -= S[i] * c;
            }
        }

// System.Console.WriteLine(new {sellPrice, cnt, r});

        System.Console.WriteLine(r + cnt * sellPrice);
    }

    static Scanner cin = new Scanner();
    static StringBuilder cout = new StringBuilder();

    static public void Main () {
        SolveCodeForces();
        // System.Console.Write(cout.ToString());
    }
}

public static class Helpers {
    public static T[] CreateArray<T>(int length, Func<int, T> itemCreate) {
        var result = new T[length];
        for (var i = 0; i < result.Length; i++)
            result[i] = itemCreate(i);
        return result;
    }

    public static IEnumerable<int> IndicesWhere<T>(this IEnumerable<T> seq, Func<T, bool> cond) {
        var i = 0;
        foreach (var item in seq) {
            if (cond(item)) yield return i;
            i++;
        }
    }
}

public class Scanner
{
    private string[] line = new string[0];
    private int index = 0;

    public string Next() {
        if (line.Length <= index) {
            line = Console.ReadLine().Split(' ');
            index = 0;
        }
        var res = line[index];
        index++;
        return res;
    }

    public int NextInt() {
        return int.Parse(Next());
    }

    public long NextLong() {
        return long.Parse(Next());
    }

    public ulong NextUlong() {
        return ulong.Parse(Next());
    }

    public string[] Array() {
        line = Console.ReadLine().Split(' ');
        index = line.Length;
        return line;
    }

    public int[] IntArray(int emptyPrefixLen = 0) {
        var array = Array();
        var result = new int[emptyPrefixLen + array.Length];
        for (int i = 0; i < array.Length; i++)
            result[emptyPrefixLen + i] = int.Parse(array[i]);
        return result;
    }

    public long[] LongArray() {
        var array = Array();
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
            result[i] = long.Parse(array[i]);
        return result;
    }

    public ulong[] UlongArray() {
        var array = Array();
        var result = new ulong[array.Length];
        for (int i = 0; i < array.Length; i++)
            result[i] = ulong.Parse(array[i]);
        return result;
    }
}


using System;
using System.Linq;

namespace Contests {
    public class CF556_A {
        public static void Main() {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var r = input[2];
            var min = Console.ReadLine().Split().Select(int.Parse).Min();
            var k = r / min;
            var moneyLeft = r - k * min;
            var max = Console.ReadLine().Split().Select(int.Parse).Max();
            moneyLeft += max * k;
            Console.WriteLine(Math.Max(moneyLeft, r));
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CF556
{
    class Program
    {
        static void Main(string[] args)
        {
            int buy_count = 0;
            int sell_count = 0;
            int starting_balance = 0;

            var first_line = Console.ReadLine();
            var parts = first_line.Split(' ');

            buy_count = int.Parse(parts[0]);
            sell_count = int.Parse(parts[1]);
            starting_balance = int.Parse(parts[2]);

            var buy_offers = Console.ReadLine().Split(' ').Select(t => int.Parse(t));
            var sell_offers = Console.ReadLine().Split(' ').Select(t => int.Parse(t));

            var cheapest_buy = buy_offers.Min();
            var best_sell = sell_offers.Max();

            var bought = (int)Math.Floor((double)starting_balance / (double)cheapest_buy);

            if (cheapest_buy > best_sell)
                bought = 0;

            var leftover = starting_balance - (bought * cheapest_buy);

            var sold = bought * best_sell;

            Console.WriteLine(sold + leftover);
        }
    }
}


using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
class Problem
{
    static void Main()
    {
        //--------------------------------input--------------------------------//

        var inp = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );
        int n = inp[0], m = inp[1], r = inp[2];
        var s = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );
        var b = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );
        Array.Sort( s );
        Array.Sort( b, (x, y) => y - x );

        //--------------------------------solve--------------------------------/

        int max = r;
            int now = (r / s[0] )* b[0];
            r = r % s[0] + now;
            max = Math.Max( r, max );
        Console.WriteLine( max);

    }

}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Кассир
{

    class Program
    {

        public static long min(long a, long b)
        {
            if (a < b)
                return a;
            return b;
        }
        public struct student
        {
            public long a;
            public long b;
        }
        public static long degree(long a)
        {
            long degree = 1;
            while (a-- != 0)
            {
                degree *= 2;
            }
            return degree - 1;
        }
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]);
            int m = int.Parse(str[1]);
            int r = int.Parse(str[2]);
            int min = int.MaxValue;
            str = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                if (int.Parse(str[i])<min)
                {
                    min = int.Parse(str[i]);
                }

            }
            int max = 0;
            str = Console.ReadLine().Split(' ');
            for (int i = 0; i < m; i++)
            {
                if (int.Parse(str[i]) > max)
                {
                    max = int.Parse(str[i]);
                }

            }
            int difference = max - min;
            if(difference<0)
                Console.WriteLine(r);
            else
            {
                int count = r / min;
                Console.WriteLine(r-(r/min)*min+count* max);
            }
        }
    }

}


using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var nmr = Input.ar;
        var ss = Input.ar;
        var bs = Input.ar;
        if (ss.Min() > bs.Max())
        {
            WriteLine(nmr[2]);
            return;
        }
        else
        {
            WriteLine(nmr[2] % ss.Min() + nmr[2] / ss.Min() * bs.Max());
        }
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h)
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        return default(T);
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


using System;
using System.Linq;

public class Program
{
	public static void Main()
	{
		var Koll = Console.ReadLine().Split().Select(int.Parse).ToArray();
		var Buy = Console.ReadLine().Split().Select(int.Parse).ToArray();
		var Sell = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int minB = Buy[0];
		int maxS = Sell[0];
		for ( int i = 0; i < Koll[0]; i++ )
			if ( minB > Buy[i] ) minB = Buy[i];
		for ( int i = 0; i < Koll[1]; i++ )
			if ( maxS < Sell[i] ) maxS = Sell[i];
		int akcBuy = Koll[2] / minB;
		int ostatok = Koll[2] - (akcBuy * minB);
		int dengi = akcBuy * maxS + ostatok;
		if ( minB >= maxS ) Console.WriteLine(Koll[2]);
		else Console.WriteLine(dengi);
	}
}


using System;
using System.IO;
using System.Linq;
using System.Text;

namespace Stock_Arbitraging
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve(args));
            writer.Flush();
        }

        private static int Solve(string[] args)
        {
            int n = Next();
            int m = Next();
            int r = Next();

            var nn = new int[n];
            for (int i = 0; i < n; i++)
            {
                nn[i] = Next();
            }
            var mm = new int[m];
            for (int i = 0; i < m; i++)
            {
                mm[i] = Next();
            }

            int t = nn.Min();
            int c = r/t;

            return Math.Max(r, c*mm.Max() + r%t);
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


using System;

namespace FirstProject
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string[] i1 = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(i1[0]);
            int m = Convert.ToInt32(i1[1]);
            int r = Convert.ToInt32(i1[2]);
            int[] s = new int[n];
            string[] i2 = Console.ReadLine().Split(' ');
            int mx = 0, mn = (int)1e9;
            for(int i=0;i<n;i++)
            {
                s[i] = Convert.ToInt32(i2[i]);
                mn = Math.Min(mn, s[i]);
            }
            int[] b = new int[m];
            string[] i3 = Console.ReadLine().Split(' ');
            for (int i = 0; i < m; i++)
            {
                b[i] = Convert.ToInt32(i3[i]);
                mx = Math.Max(mx, b[i]);
            }
            int ans = (r / mn) * mx + r % mn;
            ans = Math.Max(ans, r);
            Console.Write(ans);
        }
    }
}


// Problem: 1150A - Stock Arbitraging
// Author: Gusztav Szmolik

using System;

class StockArbitraging
    {
    public static int Main ()
        {
        string line = Console.ReadLine ();
        if (line == null)
            return -1;
        char[] delims = {' ', '\t'};
        string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != 3)
            return -1;
        byte n;
        if (!Byte.TryParse (words[0], out n))
            return -1;
        if (n < 1 || n > 30)
            return -1;
        byte m;
        if (!Byte.TryParse (words[1], out m))
            return -1;
        if (m < 1 || m > 30)
            return -1;
        ushort r;
        if (!UInt16.TryParse (words[2], out r))
            return -1;
        if (r < 1 || r > 1000)
            return -1;
        line = Console.ReadLine ();
        if (line == null)
            return -1;
        words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != n)
            return -1;
        ushort sMin = 1000;
        for (byte i = 0; i < n; i++)
            {
            ushort si;
            if (!UInt16.TryParse (words[i], out si))
                return -1;
            if (si < 1 || si > 1000)
                return -1;
            if (si < sMin)
                sMin = si;
            }
        ushort numShare = Convert.ToUInt16 (r/sMin);
        ushort sumBuy = Convert.ToUInt16 (numShare*sMin);
        line = Console.ReadLine ();
        if (line == null)
            return -1;
        words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != m)
            return -1;
        ushort bMax = 1;
        for (byte i = 0; i < m; i++)
            {
            ushort bi;
            if (!UInt16.TryParse (words[i], out bi))
                return -1;
            if (bi < 1 || bi > 1000)
                return -1;
            if (bi > bMax)
                bMax = bi;
            }
        uint sumSell = Convert.ToUInt32 (numShare*bMax);
        uint ans = (sumSell > sumBuy ? r+sumSell-sumBuy : r);
        Console.WriteLine (ans);
        return 0;
        }
    }


/* Date: 06.05.2019  *  Time: 21:45 */
//
// https://docs.microsoft.com/en-us/dotnet/api/system.tuple-8?redirectedfrom=MSDN&view=netframework-4.7.2
//

/*
�	fflush(stdout) � ����� C++;
�	System.out.flush() � Java;
�	stdout.flush() � Python;
�	flush(output) � Pascal;
*/

using System;
using System.Globalization;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

class Example
{
	class Pair : IComparable
	{
		public int fi, se;
		public Pair ()
		{
			fi = 0; se = 0;
		}
		public Pair (int pfi, int pse)
		{
			fi = pfi; se = pse;
		}
		public Pair (Pair p)
		{
			fi = p.fi; se = p.se;
		}
		public static bool operator < (Pair p1, Pair p2)
		{
			return p1.fi < p2.fi || p1.fi == p2.fi && p1.se < p2.se;
		}
		public static bool operator > (Pair p1, Pair p2)
		{
			return p1.fi > p2.fi || p1.fi == p2.fi && p1.se > p2.se;
		}
		public int CompareTo (object p2)
		{
			if ( this < (p2 as Pair) )
				return -1;
			if ( this > (p2 as Pair) )
				return 1;
			return 0;
		}
	}

	public static void Main (string[] args)
	{
# if ( ! ONLINE_JUDGE )
		StreamReader sr = new StreamReader ("C:\\TRR\\2019\\Task\\07 Codeforces\\038\\A.TXT");
		StreamWriter sw = new StreamWriter ("C:\\TRR\\2019\\Task\\07 Codeforces\\038\\OUTPUT.OUT");
# endif

		NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;

		string s;
		int n, m, k;

# if ( ONLINE_JUDGE )
		s = Console.ReadLine ();
# else
		s = sr.ReadLine ();
		sw.WriteLine ("*** " + s);
# endif

		{
			string [] ss = s.Split (' ');
			n = int.Parse (ss [0]);
			m = int.Parse (ss [1]);
			k = int.Parse (ss [2]);
		}

# if ( ONLINE_JUDGE )
		s = Console.ReadLine ();
# else
		s = sr.ReadLine ();
		sw.WriteLine ("*** " + s);
# endif

		int [] a = new int [n];
		int mi = 999999999;
		{
			string [] ss = s.Split (' ');
			for ( int i=0; i < n; i++ )
			{
				a [i] = int.Parse (ss [i]);
				if ( a [i] < mi )
					mi = a [i];
			}
		}

# if ( ONLINE_JUDGE )
		s = Console.ReadLine ();
# else
		s = sr.ReadLine ();
		sw.WriteLine ("*** " + s);
# endif

		int [] b = new int [m];
		int ma = 0;
		{
			string [] ss = s.Split (' ');
			for ( int i=0; i < m; i++ )
			{
				b [i] = int.Parse (ss [i]);
				if ( b [i] > ma )
					ma = b [i];
			}
		}

# if ( ! ONLINE_JUDGE )
		sw.WriteLine ("*** mi = " + mi);
		sw.WriteLine ("*** ma = " + ma);
# endif

		int kk = k + (k / mi) * (ma - mi);
		if ( k > kk )
			kk = k;

# if ( ONLINE_JUDGE )
		Console.WriteLine (kk);
# else
		sw.WriteLine (kk);
		sw.Close ();
# endif

	}
}


using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System;
using System.Numerics;

class Solution
{

    static void Main(string[] args)
    {
        var arr = Array.ConvertAll(Console.ReadLine().Trim().Split(), Convert.ToInt64);
        var n = arr[0];
        var m = arr[1];
        var r = arr[2];

        var s = Array.ConvertAll(Console.ReadLine().Trim().Split(), Convert.ToInt64);
        var b = Array.ConvertAll(Console.ReadLine().Trim().Split(), Convert.ToInt64);

        var mp = s.Min();
        var maxp = b.Max();
        if (mp >= maxp)
        {
            Console.WriteLine(r);
        }
        else
        {
            Console.WriteLine((r/mp) * maxp +(r%mp));
        }

    }

}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    class IOHelper : IDisposable
    {
        StreamReader reader;
        StreamWriter writer;

        public IOHelper(string inputFile, string outputFile, Encoding encoding)
        {
            StreamReader iReader;
            StreamWriter oWriter;
            if (inputFile == null)
                iReader = new StreamReader(Console.OpenStandardInput(), encoding);
            else
                iReader = new StreamReader(inputFile, encoding);

            if (outputFile == null)
                oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);
            else
                oWriter = new StreamWriter(outputFile, false, encoding);

            reader = iReader;
            writer = oWriter;

            curLine = new string[] { };
            curTokenIdx = 0;
        }

        string[] curLine;
        int curTokenIdx;

        char[] whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public string ReadNextToken()
        {
            if (curTokenIdx >= curLine.Length)
            {
                //Read next line
                string line = reader.ReadLine();
                if (line != null)
                    curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    curLine = new string[] { };
                curTokenIdx = 0;
            }

            if (curTokenIdx >= curLine.Length)
                return null;

            return curLine[curTokenIdx++];
        }

        public int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        public double ReadNextDouble()
        {
            var nextToken = ReadNextToken();
            var result = 0.0;
            nextToken = nextToken.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);
            result = double.Parse(nextToken);
            return result;
        }

        public void Write(string stringToWrite)
        {
            writer.Write(stringToWrite);
        }

        public void WriteLine(string stringToWrite)
        {
            writer.WriteLine(stringToWrite);
        }

        public void WriteLine(double valueToWrite)
        {
			writer.WriteLine(valueToWrite.ToString("F8"));
        }

        public void Dispose()
        {
            try
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (writer != null)
                {
                    writer.Dispose();
                }
            }
            catch { };
        }

        public void Flush()
        {
            if (writer != null)
            {
                writer.Flush();
            }
        }
    }

    class Program
    {
        protected IOHelper ioHelper;

        int n, m, r;

        int buy;
        int sell;

        public void Solve()
        {
            n = ioHelper.ReadNextInt();
            m = ioHelper.ReadNextInt();
            r = ioHelper.ReadNextInt();

            buy = int.MaxValue;

            int i;

            for(i=0;i<n;i++)
            {
                int b = ioHelper.ReadNextInt();
                if (b < buy)
                    buy = b;
            }

            sell = 0;

            for (i = 0; i < m; i++)
            {
                int s = ioHelper.ReadNextInt();
                if (s > sell)
                    sell = s;
            }

            int qty = r / buy;

            int result = r - qty * buy;

            result += qty*Math.Max(buy, sell);

            ioHelper.WriteLine(result.ToString());
            ioHelper.Flush();

            //Console.ReadKey();
        }

        public Program(string inputFile, string outputFile)
        {
            ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);
            Solve();
            ioHelper.Dispose();
        }

        static void Main(string[] args)
        {
            Program myProgram = new Program(null, null);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using static System.Math;

//
public class A
{
    private static void Solve()
    {
        int n = ReadInt();
        int m = ReadInt();
        int r = ReadInt();

        int[] s = ReadIntArray();
        int[] b = ReadIntArray();

        int profit = (r / s.Min()) * b.Max() + r % s.Min();

        if (profit > r)
            Write(profit);
        else
            Write(r);
    }

    #region Main

    private static TextReader reader;
    private static TextWriter writer;

    public static void Main()
    {
#if DEBUG

        //reader = new StreamReader("C:\\Users\\Axel\\Desktop\\input.txt");
        reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;

        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());

        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            Solve();

            //var thread = new Thread(new String_Task().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion Main

    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string Read()
    {
        while (currentLineTokens.Count == 0) currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(Read());
    }

    public static long ReadLong()
    {
        return long.Parse(Read());
    }

    public static double ReadDouble()
    {
        return double.Parse(Read(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }

    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix;
    }

    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines;
    }

    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write(params object[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array) writer.WriteLine(a);
    }

    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }

    private static T[] Init<T>(int size) where T : new()
    {
        var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret;
    }

    #endregion Read / Write
}


using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace CSharp
{
    static class Program
    {
        static void Main(string[] args)
        {
            int n, m, r;
            ReadInt(out n, out m, out r);
            int[] S = ReadIntArray();
            int[] B = ReadIntArray();

            if (S.Min() < B.Max())
            {
                int count = r / S.Min();
                r -= S.Min() * count;
                r += B.Max() * count;
            }

            Console.WriteLine(r);
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        #endregion
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Threading;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
#if !ONLINE_JUDGE
            Console.SetIn(new System.IO.StreamReader(@"..\..\..\in"));
            Console.SetOut(new System.IO.StreamWriter(@"..\..\..\out"));
            for (int testN = 0; testN < 2; testN++)
            {
#endif
                var n = NextLong();
                var m = NextLong();
                var r = NextLong();
                var b = ReadLongs();
                var s = ReadLongs();
                long res = 0;

                var cnt = r / b.Min();
                var nr = r - cnt * b.Min();

                nr += cnt * s.Max();
                res = nr;
                res = res > r ? res : r;

                Console.WriteLine(res);
                //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, "{0:F4}", res));
#if !ONLINE_JUDGE
                Console.ReadLine();
            }
            Console.In.Close();
            Console.Out.Close();
#endif
        }

        private static char[] _defaultSplitter = new char[] { ' ', '\t' };

        private static char[] ReadChars(int n)
        {
            char[] buffer = new char[n];
            Console.In.ReadBlock(buffer, 0, n);
            return buffer;
        }

        private static string[] ReadAll()
        {
            return Console.In.ReadToEnd().Split(new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords()
        {
            return ReadWords(_defaultSplitter);
        }

        private static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        private static int[] ReadInts(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        private static int[] ReadInts()
        {
            return ReadInts(_defaultSplitter);
        }

        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        private static long[] ReadLongs(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToArray();
        }

        private static long[] ReadLongs()
        {
            return ReadLongs(_defaultSplitter);
        }

        private static double ReadDouble()
        {
            return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);
        }

        private static int _pos = 0;
        private static string[] _inputLine = new string[0];

        private static void CheckInputLine()
        {
            if (_pos >= _inputLine.Length)
            {
                _inputLine = ReadWords();
                _pos = 0;
            }
        }

        private static string NextWord()
        {
            CheckInputLine();
            return _inputLine[_pos++];
        }

        private static int NextInt()
        {
            CheckInputLine();
            return int.Parse(_inputLine[_pos++]);
        }

        private static long NextLong()
        {
            CheckInputLine();
            return long.Parse(_inputLine[_pos++]);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[]y=Console.ReadLine().Split(' ');
            int n=int.Parse(y[0]);
            int m=int.Parse(y[1]);
            int r=int.Parse(y[2]);
            string[]y1=Console.ReadLine().Split(' ');
            string[]y2=Console.ReadLine().Split(' ');
            int[]a=new int[n];
            int []b=new int[m];
            for(int i=0;i<n;i++)
            a[i]=int.Parse(y1[i]);
            for(int i=0;i<m;i++)
            b[i]=int.Parse(y2[i]);
            int min=a.Min();
            int max=b.Max();
            if(min<max)
            Console.WriteLine(r/min*max+(r%min));
            else
            Console.WriteLine(r);

        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[]y=Console.ReadLine().Split(' ');
            int n=int.Parse(y[0]);
            int m=int.Parse(y[1]);
            int r=int.Parse(y[2]);
            string[]y1=Console.ReadLine().Split(' ');
            string[]y2=Console.ReadLine().Split(' ');
            int[]a=new int[n];
            int []b=new int[m];
            for(int i=0;i<n;i++)
            a[i]=int.Parse(y1[i]);
            for(int i=0;i<n;i++)
            b[i]=int.Parse(y2[i]);
            int min=a.Min();
            int max=b.Max();
            if(min<max)
            Console.WriteLine(r/min*max+(r%min));
            else
            Console.WriteLine(r);

        }
    }
}


using System;

namespace FirstProject
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string[] i1 = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(i1[0]);
            int m = Convert.ToInt32(i1[1]);
            int r = Convert.ToInt32(i1[2]);
            int[] s = new int[n];
            string[] i2 = Console.ReadLine().Split(' ');
            int mx = 0, mn = (int)1e9;
            for(int i=0;i<n;i++)
            {
                s[i] = Convert.ToInt32(i2[i]);
                mn = Math.Min(mn, s[i]);
            }
            int[] b = new int[m];
            string[] i3 = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                b[i] = Convert.ToInt32(i3[i]);
                mx = Math.Max(mx, b[i]);
            }
            int ans = (r / mn) * mx + r % mn;
            ans = Math.Max(ans, r);
            Console.Write(ans);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Кассир
{

    class Program
    {

        public static long min(long a, long b)
        {
            if (a < b)
                return a;
            return b;
        }
        public struct student
        {
            public long a;
            public long b;
        }
        public static long degree(long a)
        {
            long degree = 1;
            while (a-- != 0)
            {
                degree *= 2;
            }
            return degree - 1;
        }
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]);
            int m = int.Parse(str[1]);
            int r = int.Parse(str[2]);
            int min = int.MaxValue;
            str = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                if (int.Parse(str[i])<min)
                {
                    min = int.Parse(str[i]);
                }

            }
            int max = 0;
            str = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                if (int.Parse(str[i]) > min)
                {
                    max = int.Parse(str[i]);
                }

            }
            int difference = max - min;
            if(difference<0)
                Console.WriteLine(r);
            else
            {
                int count = r / min;
                Console.WriteLine(r-(r/min)*min+count* max);
            }
        }
    }

}