import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.Rectangle2D; import java.io.BufferedInputStream; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.ConcurrentSkipListSet; public class Main { public static final int C = 1000000007; static final int CY = 1000000000; public void calc() { StringBuilder sb = new StringBuilder(); BufferedInputStream bs = new BufferedInputStream(System.in); Scanner sc = new Scanner(bs); String s = sc.next(); int ans = 0; //double ans = 0.0; for (int i=0; i < s.length(); i++) { String ns = ""; ns += s.substring(i); ns += s.substring(0, i); ans = Math.max(ans, msd(ns)); } System.out.println(ans); } int msd(String s) { if (s.endsWith("+") || s.endsWith("-") || s.startsWith("+") || s.startsWith("-")) { return -1; } int ret = 0; String[] ss = s.split("\\+"); for (String str: ss) { int num = 0; String[] sst = str.split("-"); for (int i=0; i < sst.length;i++) { if (i==0) { num += Integer.parseInt(sst[i]); }else { num -= Integer.parseInt(sst[i]); } } ret += num; } return ret; } public static void main(String[] args) { Main main = new Main(); main.calc(); } }